From 63a2f949621a8fac35d5e6ea3e2edad9537f2856 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 6 Jun 2024 22:15:22 +0200 Subject: [PATCH] mesa/main: validate integer-formats RG integer-textures are only supported on OpenGL if the combination of EXT_texture_integer and ARB_texture_rg is supported. It's also supported on GL3, but both of those extensions are required there anyway. In addition GLES3 is supported. BGR, BGRA and alpha integer-textures are only supported by EXT_texture_integer. Luminance and luminance-alpha integer-textures similarly, but are unsupported in core contexts, because general luminance support is removed. Reviewed-by: Adam Jackson Part-of: --- src/mesa/main/glformats.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 3adc35c1664..3148e32aca3 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -1754,6 +1754,28 @@ valid_texture_format_enum(const struct gl_context *ctx, GLenum format) _mesa_has_EXT_texture_format_BGRA8888(ctx)); return true; + case GL_RED_INTEGER: + case GL_GREEN_INTEGER: + case GL_BLUE_INTEGER: + case GL_RGB_INTEGER: + case GL_RGBA_INTEGER: + return _mesa_has_integer_textures(ctx); + + case GL_RG_INTEGER: + return (_mesa_has_EXT_texture_integer(ctx) && + _mesa_has_ARB_texture_rg(ctx)) || + _mesa_is_gles3(ctx); + + case GL_BGR_INTEGER: + case GL_BGRA_INTEGER: + case GL_ALPHA_INTEGER: + return _mesa_has_EXT_texture_integer(ctx); + + case GL_LUMINANCE_INTEGER_EXT: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + return _mesa_is_desktop_gl_compat(ctx) && + _mesa_has_EXT_texture_integer(ctx); + case GL_DEPTH_COMPONENT: return _mesa_is_desktop_gl(ctx) || _mesa_has_OES_depth_texture(ctx);