&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;
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;
struct gl_uniform_buffer_variable
{
char *Name;
+
+ /**
+ * Name of the uniform as seen by glGetUniformIndices.
+ *
+ * glGetUniformIndices requires that the block instance index \b not be
+ * present in the name of queried uniforms.
+ *
+ * \note
+ * \c gl_uniform_buffer_variable::IndexName and
+ * \c gl_uniform_buffer_variable::Name may point to identical storage.
+ */
+ char *IndexName;
+
const struct glsl_type *Type;
unsigned int Offset;
GLboolean RowMajor;
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
params[i] = _mesa_get_uniform_location(ctx, shProg,
- block->Uniforms[i].Name,
+ block->Uniforms[i].IndexName,
&offset);
}
return;