summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-01-22 00:23:24 -0500
committerIan Romanick <[email protected]>2013-01-25 09:07:35 -0500
commit90b1dd03e52d125c95007e174028d17e5a01c336 (patch)
treed7bd28d805c7b88891a98cc9087e0a33a4d18964 /src/glsl
parent11d42de681d07884efd7f5b09bd639ee4423093b (diff)
glsl: Add gl_uniform_buffer_variable::IndexName field
glGetUniformIndices requires that the block instance index not be present in the name of queried uniforms. However, gl_uniform_buffer_variable::Name will include the instance index. The IndexName field is added to handle this difference. Note that currently IndexName will always point to the same string as Name. This will change soon. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Carl Worth <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast_to_hir.cpp1
-rw-r--r--src/glsl/link_uniforms.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 80dd86e7803..bf4130fa8c6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4322,6 +4322,7 @@ ast_uniform_block::hir(exec_list *instructions,
&ubo->Uniforms[ubo->NumUniforms++];
ubo_var->Name = ralloc_strdup(state->uniform_blocks, fields[i].name);
+ ubo_var->IndexName = ubo_var->Name;
ubo_var->Type = fields[i].type;
ubo_var->Offset = 0; /* Assigned at link time. */
ubo_var->RowMajor = fields[i].row_major;
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 531efa4a39f..68cafbf3946 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -510,7 +510,13 @@ link_cross_validate_uniform_block(void *mem_ctx,
struct gl_uniform_buffer_variable *ubo_var =
&linked_block->Uniforms[i];
- ubo_var->Name = ralloc_strdup(*linked_blocks, ubo_var->Name);
+ if (ubo_var->Name == ubo_var->IndexName) {
+ ubo_var->Name = ralloc_strdup(*linked_blocks, ubo_var->Name);
+ ubo_var->IndexName = ubo_var->Name;
+ } else {
+ ubo_var->Name = ralloc_strdup(*linked_blocks, ubo_var->Name);
+ ubo_var->IndexName = ralloc_strdup(*linked_blocks, ubo_var->IndexName);
+ }
}
return linked_block_index;