summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-07-16 11:57:53 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-08-04 14:40:06 -0700
commit46356c46ea9c09cc2eb8dfe753d3b066e698003b (patch)
treea2ad150fe41144f1edb40043a5ed0895a8186811 /src/mesa/main/uniforms.c
parent1ca25abe257c8bd7749c39baf8b1c659fcb69dc2 (diff)
downloadexternal_mesa3d-46356c46ea9c09cc2eb8dfe753d3b066e698003b.zip
external_mesa3d-46356c46ea9c09cc2eb8dfe753d3b066e698003b.tar.gz
external_mesa3d-46356c46ea9c09cc2eb8dfe753d3b066e698003b.tar.bz2
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@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c32
1 files 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;