Mesa (master): mesa: add additional checks for uniform location query

Tapani Pälli tpalli at kemper.freedesktop.org
Mon Oct 26 10:55:44 UTC 2015


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

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Mon Oct 26 11:13:14 2015 +0200

mesa: add additional checks for uniform location query

Patch adds additional check to make sure we don't return locations for
structures or arrays of structures.

>From page 79 of the OpenGL 4.2 spec:
    "A valid name cannot be a structure, an array of structures, or any
    portion of a single vector or a matrix."

v2: use without-array() to simplify code (Timothy)

No Piglit or CTS regressions observed.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

---

 src/mesa/main/shader_query.cpp |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 8182d3d..84cbfbc 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -808,6 +808,14 @@ program_resource_location(struct gl_shader_program *shProg,
       if (RESOURCE_UNI(res)->builtin)
          return -1;
 
+     /* From page 79 of the OpenGL 4.2 spec:
+      *
+      *     "A valid name cannot be a structure, an array of structures, or any
+      *     portion of a single vector or a matrix."
+      */
+      if (RESOURCE_UNI(res)->type->without_array()->is_record())
+         return -1;
+
       /* From the GL_ARB_uniform_buffer_object spec:
        *
        *     "The value -1 will be returned if <name> does not correspond to an




More information about the mesa-commit mailing list