summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2015-04-23 14:19:33 +0300
committerTapani Pälli <tapani.palli@intel.com>2015-04-24 13:42:24 +0300
commit18f44d303014c3c16084c1b15d1999833e0d55db (patch)
tree479df76f5f17adc079c02a267a6c17fbefbbaa28 /src/mesa/main/uniform_query.cpp
parenta563689a408b7a28c710fb0e382272a0d823f38a (diff)
downloadexternal_mesa3d-18f44d303014c3c16084c1b15d1999833e0d55db.zip
external_mesa3d-18f44d303014c3c16084c1b15d1999833e0d55db.tar.gz
external_mesa3d-18f44d303014c3c16084c1b15d1999833e0d55db.tar.bz2
mesa: fix glGetActiveUniformsiv regression
Commit 7519ddb caused regression to glGetActiveUniformsiv. Patch adds back validation loop of all given uniforms before writing any values, not touching params in case of errors is tested by the conformance suite. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90149 Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'src/mesa/main/uniform_query.cpp')
-rw-r--r--src/mesa/main/uniform_query.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 4e77b32..3e857ed 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/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"))