The GL 3.1 and ES 3.0 specs say of glGetActiveUniformsiv:
   "If an error occurs, nothing will be written to params."

So, make a pass through the array and check for errors before the pass
that actually writes to params.

Fixes es3conform's getactiveuniformsiv_for_nonexistent_uniform_indices
test.
---
 src/mesa/main/uniform_query.cpp |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index cbdd39e..3245500 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -97,7 +97,6 @@ _mesa_GetActiveUniformsiv(GLuint program,
 
    for (i = 0; i < uniformCount; i++) {
       GLuint index = uniformIndices[i];
-      const struct gl_uniform_storage *uni = &shProg->UniformStorage[index];
 
       if (index >= shProg->NumUserUniformStorage) {
         _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
@@ -106,6 +105,26 @@ _mesa_GetActiveUniformsiv(GLuint program,
 
       switch (pname) {
       case GL_UNIFORM_TYPE:
+      case GL_UNIFORM_SIZE:
+      case GL_UNIFORM_NAME_LENGTH:
+      case GL_UNIFORM_BLOCK_INDEX:
+      case GL_UNIFORM_OFFSET:
+      case GL_UNIFORM_ARRAY_STRIDE:
+      case GL_UNIFORM_MATRIX_STRIDE:
+      case GL_UNIFORM_IS_ROW_MAJOR:
+         break;
+      default:
+        _mesa_error(ctx, GL_INVALID_ENUM, "glGetActiveUniformsiv(pname)");
+        return;
+      }
+   }
+
+   for (i = 0; i < uniformCount; i++) {
+      GLuint index = uniformIndices[i];
+      const struct gl_uniform_storage *uni = &shProg->UniformStorage[index];
+
+      switch (pname) {
+      case GL_UNIFORM_TYPE:
         params[i] = uni->type->gl_type;
         break;
 
@@ -139,10 +158,6 @@ _mesa_GetActiveUniformsiv(GLuint program,
       case GL_UNIFORM_IS_ROW_MAJOR:
         params[i] = uni->row_major;
         break;
-
-      default:
-        _mesa_error(ctx, GL_INVALID_ENUM, "glGetActiveUniformsiv(pname)");
-        return;
       }
    }
 }
-- 
1.7.8.6

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to