From f76960388fc1f3f96f0aa7cfc39e6d9d7a6db668 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 29 Jul 2021 08:05:43 +0200 Subject: [PATCH] render/gles2: add support for some 24 and 16-bit formats On little-endian, we can enable pixel formats which don't use gl_type = GL_UNSIGNED_BYTE. See [1]. [1]: https://afrantzis.com/pixel-format-guide/ --- render/gles2/pixel_format.c | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c index 3f230df9..9e671193 100644 --- a/render/gles2/pixel_format.c +++ b/render/gles2/pixel_format.c @@ -32,6 +32,45 @@ static const struct wlr_gles2_pixel_format formats[] = { .gl_type = GL_UNSIGNED_BYTE, .has_alpha = true, }, + { + .drm_format = DRM_FORMAT_BGR888, + .gl_format = GL_RGB, + .gl_type = GL_UNSIGNED_BYTE, + .has_alpha = false, + }, +#if WLR_LITTLE_ENDIAN + { + .drm_format = DRM_FORMAT_RGBX4444, + .gl_format = GL_RGBA, + .gl_type = GL_UNSIGNED_SHORT_4_4_4_4, + .has_alpha = false, + }, + { + .drm_format = DRM_FORMAT_RGBA4444, + .gl_format = GL_RGBA, + .gl_type = GL_UNSIGNED_SHORT_4_4_4_4, + .has_alpha = true, + }, + { + .drm_format = DRM_FORMAT_RGBX5551, + .gl_format = GL_RGBA, + .gl_type = GL_UNSIGNED_SHORT_5_5_5_1, + .has_alpha = false, + }, + { + .drm_format = DRM_FORMAT_RGBA5551, + .gl_format = GL_RGBA, + .gl_type = GL_UNSIGNED_SHORT_5_5_5_1, + .has_alpha = true, + }, + { + .drm_format = DRM_FORMAT_RGB565, + .gl_format = GL_RGB, + .gl_type = GL_UNSIGNED_SHORT_5_6_5, + .has_alpha = false, + }, + // TODO: EXT_texture_type_2_10_10_10_REV support +#endif }; // TODO: more pixel formats