aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/uniform_query.cpp')
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 4e77b3284..3e857ed10 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -129,14 +129,26 @@ _mesa_GetActiveUniformsiv(GLuint program,
res_prop = resource_prop_from_uniform_prop(pname);
+ /* We need to first verify that each entry exists as active uniform. If
+ * not, generate error and do not cause any other side effects.
+ *
+ * In the case of and error condition, Page 16 (section 2.3.1 Errors)
+ * of the OpenGL 4.5 spec says:
+ *
+ * "If the generating command modifies values through a pointer argu-
+ * ment, no change is made to these values."
+ */
for (int i = 0; i < uniformCount; i++) {
- res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
- uniformIndices[i]);
- if (!res) {
+ if (!_mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i])) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
- break;
+ return;
}
+ }
+ for (int i = 0; i < uniformCount; i++) {
+ res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i]);
if (!_mesa_program_resource_prop(shProg, res, uniformIndices[i],
res_prop, &params[i],
"glGetActiveUniformsiv"))