From 227c6627cb66cb72b75fd062c3b6df78854b0038 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 30 May 2024 14:11:30 +0200 Subject: [PATCH] mesa/main: do not allow RGBA_INTEGER et al in gles3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GLES3 doesn't allow all the format/type combinations that ARB_texture_rgb10_a2ui does, so let's tighten the error-checking here a bit. Fixes: b5a370dc250 ("mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3") Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/glformats.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 5c7057190dd..452695d79c7 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -1772,7 +1772,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, break; /* OK */ } if (format == GL_RGB_INTEGER && - _mesa_has_texture_rgb10_a2ui(ctx)) { + _mesa_has_ARB_texture_rgb10_a2ui(ctx)) { break; /* OK */ } return GL_INVALID_OPERATION; @@ -1787,7 +1787,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, break; /* OK */ } if ((format == GL_RGBA_INTEGER || format == GL_BGRA_INTEGER) && - _mesa_has_texture_rgb10_a2ui(ctx)) { + _mesa_has_ARB_texture_rgb10_a2ui(ctx)) { break; /* OK */ } return GL_INVALID_OPERATION; @@ -1801,7 +1801,11 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, break; /* OK */ } if ((format == GL_RGBA_INTEGER || format == GL_BGRA_INTEGER) && - _mesa_has_texture_rgb10_a2ui(ctx)) { + _mesa_has_ARB_texture_rgb10_a2ui(ctx)) { + break; /* OK */ + } + if ((format == GL_RGBA_INTEGER || format == GL_BGRA_INTEGER) && + type == GL_UNSIGNED_INT_2_10_10_10_REV && _mesa_is_gles3(ctx)) { break; /* OK */ } if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB && @@ -2057,7 +2061,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return _mesa_has_texture_rgb10_a2ui(ctx) + return _mesa_has_ARB_texture_rgb10_a2ui(ctx) ? GL_NO_ERROR : GL_INVALID_ENUM; default: return GL_INVALID_ENUM;