aboutsummaryrefslogtreecommitdiff
path: root/render/gles2
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-07-29 08:05:43 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-07-29 10:47:34 -0400
commitf76960388fc1f3f96f0aa7cfc39e6d9d7a6db668 (patch)
tree7235b4baf7a948e31a8868476a8de47c6222db53 /render/gles2
parent6973361d60ee6e2198accb6810c48ecbd568c751 (diff)
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/
Diffstat (limited to 'render/gles2')
-rw-r--r--render/gles2/pixel_format.c39
1 files changed, 39 insertions, 0 deletions
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