summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-10-18 16:28:21 -0700
committerIan Romanick <[email protected]>2011-11-07 13:33:16 -0800
commitc42ca36d67939bb1cda8bb362ff8da7c0da24a1d (patch)
tree25a63ab5c8f3c5487e64a7e65747f82e98fde06e
parent719909698c67c287a393d2380278e7b7495ae018 (diff)
mesa: Add missing check for glUniform*v count > 1 on non-array
Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
-rw-r--r--src/mesa/main/uniform_query.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 496f60416bf..debe3ae5963 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -399,6 +399,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)",
@@ -414,6 +416,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.