From 2b2a6a238ed77d003cbf38c43a2629b8f2a37380 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 9 Feb 2024 10:19:29 +0100 Subject: [PATCH] mesa/main: mark GL_BGRA as color-renderable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EXT_texture_format_BGRA8888-spec is quite clear that this format is color-renderable, so let's mark it properly as such. It should also be texture-filterable, because in the version of OpenGL ES it was written against all texture-formats were filterable to begin with. While we're at it, use the non-EXT version of the enum; it's been in the headers since OpenGL 1.2... Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/genmipmap.c | 5 ----- src/mesa/main/glformats.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 519be2578c7..3d3b896a16c 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -87,15 +87,10 @@ _mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx, * not specified with an unsized internal format from table 8.3 or a * sized internal format that is both color-renderable and * texture-filterable according to table 8.10." - * - * GL_EXT_texture_format_BGRA8888 adds a GL_BGRA_EXT unsized internal - * format, and includes it in a very similar looking table. So we - * include it here as well. */ return internalformat == GL_RGBA || internalformat == GL_RGB || internalformat == GL_LUMINANCE_ALPHA || internalformat == GL_LUMINANCE || internalformat == GL_ALPHA || - internalformat == GL_BGRA_EXT || (_mesa_is_es3_color_renderable(ctx, internalformat) && _mesa_is_es3_texture_filterable(ctx, internalformat)); } diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 116d12e48d8..5fbcb0f3afd 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -4027,6 +4027,9 @@ _mesa_is_es3_color_renderable(const struct gl_context *ctx, case GL_RGBA16_SNORM: return _mesa_has_EXT_texture_norm16(ctx) && _mesa_has_EXT_render_snorm(ctx); + case GL_BGRA: + assert(_mesa_has_EXT_texture_format_BGRA8888(ctx)); + return true; default: return false; } @@ -4085,6 +4088,9 @@ _mesa_is_es3_texture_filterable(const struct gl_context *ctx, * for the R32F, RG32F, RGB32F, and RGBA32F formats." */ return _mesa_has_OES_texture_float_linear(ctx); + case GL_BGRA: + assert(_mesa_has_EXT_texture_format_BGRA8888(ctx)); + return true; default: return false; }