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>
This commit is contained in:
parent
e02e1ccbee
commit
29fc115d58
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue