diff options
author | Ian Romanick <[email protected]> | 2014-07-16 11:57:53 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-08-04 14:40:06 -0700 |
commit | 46356c46ea9c09cc2eb8dfe753d3b066e698003b (patch) | |
tree | a2ad150fe41144f1edb40043a5ed0895a8186811 /src/mesa | |
parent | 1ca25abe257c8bd7749c39baf8b1c659fcb69dc2 (diff) |
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 <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/uniforms.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index f450173af27..b6512fe6f3b 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; |