Mesa (master): mesa: do not throw _mesa_problem when invalid enum is used

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 3 14:41:43 UTC 2020


Module: Mesa
Branch: master
Commit: 29fc115d5810f1b1b65686b543b687d6d08205e9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=29fc115d5810f1b1b65686b543b687d6d08205e9

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Mon Nov  2 11:17:56 2020 +0200

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: e064d660205 ("mesa: implement glGetUnsignedByte{v|i_v}")
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Eleni Maria Stea <estea at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>

---

 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:



More information about the mesa-commit mailing list