mesa: do not throw _mesa_problem when invalid enum is used

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: e064d66020 ("mesa: implement glGetUnsignedByte{v|i_v}")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>
(cherry picked from commit 29fc115d58)
This commit is contained in:
Tapani Pälli 2020-11-02 11:17:56 +02:00 committed by Dylan Baker
parent 3ed72705b3
commit 9c55ccd8fd
2 changed files with 2 additions and 7 deletions

View file

@ -5134,7 +5134,7 @@
"description": "mesa: do not throw _mesa_problem when invalid enum is used",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "e064d660205a04e7d9c63fdceebf3c293a6872ed"
},

View file

@ -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: