Mesa (master): mesa: Do not list inactive block members as active

Ian Romanick idr at kemper.freedesktop.org
Mon Aug 4 21:40:44 UTC 2014


Module: Mesa
Branch: master
Commit: 46356c46ea9c09cc2eb8dfe753d3b066e698003b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=46356c46ea9c09cc2eb8dfe753d3b066e698003b

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Jul 16 11:57:53 2014 -0700

mesa: Do not list inactive block members as active

Fixes gles3conform failures in:

ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_packed
ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_packed
ES3-CTS.shaders.uniform_block.random.scalar_types.7
ES3-CTS.shaders.uniform_block.random.basic_arrays.4
ES3-CTS.shaders.uniform_block.random.basic_arrays.6
ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2
ES3-CTS.shaders.uniform_block.random.nested_structs.9
ES3-CTS.shaders.uniform_block.random.all_shared_buffer.3

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/main/uniforms.c |   32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index f450173..b6512fe 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -1089,18 +1089,38 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
       params[0] = strlen(block->Name) + 1;
       return;
 
-   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
-      params[0] = block->NumUniforms;
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: {
+      unsigned count = 0;
+
+      for (i = 0; i < block->NumUniforms; i++) {
+	 unsigned offset;
+         const int idx =
+            _mesa_get_uniform_location(ctx, shProg,
+                                       block->Uniforms[i].IndexName,
+                                       &offset);
+         if (idx != -1)
+            count++;
+      }
+
+      params[0] = count;
       return;
+   }
+
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: {
+      unsigned count = 0;
 
-   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
       for (i = 0; i < block->NumUniforms; i++) {
 	 unsigned offset;
-	 params[i] = _mesa_get_uniform_location(ctx, shProg,
-						block->Uniforms[i].IndexName,
-						&offset);
+         const int idx =
+            _mesa_get_uniform_location(ctx, shProg,
+                                       block->Uniforms[i].IndexName,
+                                       &offset);
+
+         if (idx != -1)
+            params[count++] = idx;
       }
       return;
+   }
 
    case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
       params[0] = shProg->UniformBlockStageIndex[MESA_SHADER_VERTEX][uniformBlockIndex] != -1;




More information about the mesa-commit mailing list