diff options
author | Gert Wollny <gert.wollny@collabora.com> | 2021-05-04 10:59:31 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-05-07 16:35:15 +0000 |
commit | f94f2e1223ada056663c4c54c8098504eb091f55 (patch) | |
tree | e792a795216e43dfd0b94c81c76637cc52cc4e3e /src/mesa/main | |
parent | 0ab2336f3feb6eb3418d6aa882fb094d67ee622c (diff) |
mesa: add an extension MESA_bgra
This GLES extension allows to combine the formats BGR and BGRA
as host-side formatsto be combined with the internal formats
RGB8/SRGB8 and RGBA8/SRGB8_ALPHA8 respectively.
This extension is of interest to support a subset of OpenGL in
virtualized environments where the host only supports GLES.
Initial mesa/glformat.c patch: rohan.garg@collabora.com
v2: - Correct names for ClearTexture calls
- Add BGR(A)_EXT tokens
- Add format check for BGR_EXT
(All Adam Jackson)
v3: Fix ordering in extension table (Marge)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com> (v2)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10613>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/extensions_table.h | 1 | ||||
-rw-r--r-- | src/mesa/main/glformats.c | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 0afa5d365b3..37f1febd4f2 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -367,6 +367,7 @@ EXT(KHR_texture_compression_astc_hdr , KHR_texture_compression_astc_hdr EXT(KHR_texture_compression_astc_ldr , KHR_texture_compression_astc_ldr , GLL, GLC, x , ES2, 2012) EXT(KHR_texture_compression_astc_sliced_3d , KHR_texture_compression_astc_sliced_3d , GLL, GLC, x , ES2, 2015) +EXT(MESA_bgra , dummy_true , x , x , x , ES2, 2021) EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 30, 2018) EXT(MESA_pack_invert , dummy_true , GLL, GLC, x , x , 2002) EXT(MESA_shader_integer_functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 3d34a226fbd..641b103a914 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -2859,7 +2859,17 @@ _mesa_gles_error_check_format_and_type(const struct gl_context *ctx, switch (format) { case GL_BGRA_EXT: - if (type != GL_UNSIGNED_BYTE || internalFormat != GL_BGRA) + if (type != GL_UNSIGNED_BYTE || + (internalFormat != GL_BGRA && + internalFormat != GL_RGBA8 && + internalFormat != GL_SRGB8_ALPHA8)) + return GL_INVALID_OPERATION; + break; + + case GL_BGR_EXT: + if (type != GL_UNSIGNED_BYTE || + (internalFormat != GL_RGB8 && + internalFormat != GL_SRGB8)) return GL_INVALID_OPERATION; break; |