pixel-formats: Add gl_internalformat

Add GL internal format value to be passed to glRenderbufferStorage.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
Philipp Zabel 2023-06-08 12:35:26 +02:00 committed by Daniel Stone
parent fd3732e834
commit 68778dd6f4
2 changed files with 9 additions and 0 deletions

View file

@ -50,10 +50,12 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
#define GL_INTERNALFORMAT(fmt) .gl_internalformat = (fmt)
#define GL_FORMAT(fmt) .gl_format = (fmt)
#define GL_TYPE(type) .gl_type = (type)
#define SAMPLER_TYPE(type) .sampler_type = (type)
#else
#define GL_INTERNALFORMAT(fmt) .gl_internalformat = 0
#define GL_FORMAT(fmt) .gl_format = 0
#define GL_TYPE(type) .gl_type = 0
#define SAMPLER_TYPE(type) .sampler_type = 0
@ -237,6 +239,7 @@ static const struct pixel_format_info pixel_format_table[] = {
BITS_RGBA_FIXED(8, 8, 8, 0),
.addfb_legacy_depth = 24,
.bpp = 32,
GL_INTERNALFORMAT(GL_RGB8),
GL_FORMAT(GL_BGRA_EXT),
GL_TYPE(GL_UNSIGNED_BYTE),
#if __BYTE_ORDER == __LITTLE_ENDIAN
@ -251,6 +254,7 @@ static const struct pixel_format_info pixel_format_table[] = {
.opaque_substitute = DRM_FORMAT_XRGB8888,
.addfb_legacy_depth = 32,
.bpp = 32,
GL_INTERNALFORMAT(GL_RGBA8),
GL_FORMAT(GL_BGRA_EXT),
GL_TYPE(GL_UNSIGNED_BYTE),
#if __BYTE_ORDER == __LITTLE_ENDIAN
@ -331,6 +335,7 @@ static const struct pixel_format_info pixel_format_table[] = {
BITS_RGBA_FIXED(10, 10, 10, 0),
.addfb_legacy_depth = 30,
.bpp = 32,
GL_INTERNALFORMAT(GL_RGB10_A2),
#if __BYTE_ORDER == __LITTLE_ENDIAN
PIXMAN_FMT(x2r10g10b10),
#endif
@ -340,6 +345,7 @@ static const struct pixel_format_info pixel_format_table[] = {
BITS_RGBA_FIXED(10, 10, 10, 2),
.bpp = 32,
.opaque_substitute = DRM_FORMAT_XRGB2101010,
GL_INTERNALFORMAT(GL_RGB10_A2),
#if __BYTE_ORDER == __LITTLE_ENDIAN
PIXMAN_FMT(a2r10g10b10),
#endif

View file

@ -62,6 +62,9 @@ struct pixel_format_info {
* opaque. */
uint32_t sampler_type;
/** GL internal format; to be used when creating FBO renderbuffers */
int gl_internalformat;
/** GL format, if data can be natively/directly uploaded. Note that
* whilst DRM formats are little-endian unless explicitly specified,
* (i.e. DRM_FORMAT_ARGB8888 is stored BGRA as sequential bytes in