[Mesa-dev] [PATCH 19/20] mesa: Add missing check for glUniform*v count > 1 on non-array

Ian Romanick idr at freedesktop.org
Fri Oct 28 10:42:46 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/uniform_query.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 50a724b..96de541 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -389,6 +389,8 @@ validate_uniform_parameters(struct gl_context *ctx,
     *
     *         - if no variable with a location of location exists in the
     *           program object currently in use and location is not -1,
+    *         - if count is greater than one, and the uniform declared in the
+    *           shader is not an array variable,
     */
    if (location < -1) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
@@ -404,6 +406,13 @@ validate_uniform_parameters(struct gl_context *ctx,
       return false;
    }
 
+   if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+		  "%s(count > 1 for non-array, location=%d)",
+		  caller, location);
+      return false;
+   }
+
    /* This case should be impossible.  The implication is that a call like
     * glGetUniformLocation(prog, "foo[8]") was successful but "foo" is not an
     * array.
-- 
1.7.6.4



More information about the mesa-dev mailing list