mesa/main: allow GL_BGRA for FBOs

The EXT_texture_format_BGRA8888 spec clearly defines GL_BGRA as a
color-renderable format, so we need to support it here as well.

This has been broken since the day support for the extension was added.
Oh well, let's fix it up!

Fixes: 1d595c7cd4 ("gles2: Add GL_EXT_texture_format_BGRA8888 support")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27720>
(cherry picked from commit 3b23e9d89dd285f3bc33a44dc669aebf2fbc1f56)
This commit is contained in:
Erik Faye-Lund 2024-02-21 12:10:36 +01:00 committed by Eric Engestrom
parent 76bb6e7f8e
commit da3ac67e23
2 changed files with 11 additions and 1 deletions

View file

@ -1504,7 +1504,7 @@
"description": "mesa/main: allow GL_BGRA for FBOs",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "1d595c7cd4aefc7baf1942626f53bec8f6699f7f",
"notes": null

View file

@ -2659,6 +2659,16 @@ _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat)
case GL_RGB565:
return _mesa_is_gles(ctx) || ctx->Extensions.ARB_ES2_compatibility
? GL_RGB : 0;
case GL_BGRA:
/* EXT_texture_format_BGRA8888 only adds this as color-renderable for
* GLES 2 and later
*/
if (_mesa_has_EXT_texture_format_BGRA8888(ctx) && _mesa_is_gles2(ctx))
return GL_RGBA;
else
return 0;
default:
return 0;
}