summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-05-13 15:53:08 +1000
committerTimothy Arceri <[email protected]>2017-05-16 11:53:16 +1000
commitf25b2f76b031f2427f97a4a4fc58f4d237b764b4 (patch)
treee265897ab0ac5c4c5ba7b68bc5d40757405f4a48 /src/mesa/main/uniform_query.cpp
parentb1af896853569ba9bb85189bf094efeeb8c01ce2 (diff)
mesa: don't crash in KHR_no_error uniform variants when location == -1
From Seciton 7.6 (UNIFORM VARIABLES) of the OpenGL 4.5 spec: "If the value of location is -1, the Uniform* commands will silently ignore the data passed in, and the current uniform values will not be changed. Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/mesa/main/uniform_query.cpp')
-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 0e02a764a92..79a66a7ac3a 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -911,6 +911,15 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
struct gl_uniform_storage *uni;
if (_mesa_is_no_error_enabled(ctx)) {
+ /* From Seciton 7.6 (UNIFORM VARIABLES) of the OpenGL 4.5 spec:
+ *
+ * "If the value of location is -1, the Uniform* commands will
+ * silently ignore the data passed in, and the current uniform values
+ * will not be changed.
+ */
+ if (location == -1)
+ return;
+
uni = shProg->UniformRemapTable[location];
/* The array index specified by the uniform location is just the