From 29fc115d5810f1b1b65686b543b687d6d08205e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 2 Nov 2020 11:17:56 +0200 Subject: [PATCH] mesa: do not throw _mesa_problem when invalid enum is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like with other getters, invalid enum is dealt in find_value by setting error to GL_INVALID_ENUM and returning INVALID_TYPE which makes get_value_size return 0. Fixes false 'implementation errors' seen with Piglit test: ext_external_objects-memory-object-api-errors "Mesa 20.3.0-devel implementation error: invalid value type in GetUnsignedBytei_vEXT() Please report at https://gitlab.freedesktop.org/mesa/mesa/-/issues" v2: add assert to get_value_size() (Lionel) Fixes: e064d660205 ("mesa: implement glGetUnsignedByte{v|i_v}") Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Reviewed-by: Eleni Maria Stea Part-of: --- src/mesa/main/get.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eb8f2c553a0..9b1f36cd9c8 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1704,6 +1704,7 @@ get_value_size(enum value_type type, const union value *v) case TYPE_MATRIX_T: return sizeof (GLfloat) * 16; default: + assert(!"invalid value_type given for get_value_size()"); return -1; } } @@ -2349,9 +2350,6 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data) d = find_value(func, pname, &p, &v); size = get_value_size(d->type, &v); - if (size <= 0) { - _mesa_problem(ctx, "invalid value type in GetUnsignedBytevEXT()"); - } switch (d->type) { case TYPE_BIT_0: @@ -3262,9 +3260,6 @@ _mesa_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data) type = find_value_indexed(func, target, index, &v); size = get_value_size(type, &v); - if (size <= 0) { - _mesa_problem(ctx, "invalid value type in GetUnsignedBytei_vEXT()"); - } switch (type) { case TYPE_UINT: