mesa/main: mark GL_BGRA as color-renderable

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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27521>
This commit is contained in:
Erik Faye-Lund 2024-02-09 10:19:29 +01:00 committed by Marge Bot
parent a7e8dc6835
commit 2b2a6a238e
2 changed files with 6 additions and 5 deletions

View file

@ -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));
}

View file

@ -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;
}