summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/link_uniforms.cpp15
-rw-r--r--src/glsl/linker.h9
2 files changed, 19 insertions, 5 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index c639a3d..c5661bb 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -62,10 +62,15 @@ uniform_field_visitor::process(ir_variable *var)
{
const glsl_type *t = var->type;
+ /* false is always passed for the row_major parameter to the other
+ * processing functions because no information is available to do
+ * otherwise. See the warning in linker.h.
+ */
+
/* Only strdup the name if we actually will need to modify it. */
if (t->is_record() || (t->is_array() && t->fields.array->is_record())) {
char *name = ralloc_strdup(NULL, var->name);
- recursion(var->type, &name, strlen(name));
+ recursion(var->type, &name, strlen(name), false);
ralloc_free(name);
} else {
this->visit_field(t, var->name);
@@ -74,7 +79,7 @@ uniform_field_visitor::process(ir_variable *var)
void
uniform_field_visitor::recursion(const glsl_type *t, char **name,
- size_t name_length)
+ size_t name_length, bool row_major)
{
/* Records need to have each field processed individually.
*
@@ -90,7 +95,8 @@ uniform_field_visitor::recursion(const glsl_type *t, char **name,
/* Append '.field' to the current uniform name. */
ralloc_asprintf_rewrite_tail(name, &new_length, ".%s", field);
- recursion(t->fields.structure[i].type, name, new_length);
+ recursion(t->fields.structure[i].type, name, new_length,
+ t->fields.structure[i].row_major);
}
} else if (t->is_array() && t->fields.array->is_record()) {
for (unsigned i = 0; i < t->length; i++) {
@@ -99,7 +105,8 @@ uniform_field_visitor::recursion(const glsl_type *t, char **name,
/* Append the subscript to the current uniform name */
ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i);
- recursion(t->fields.array, name, new_length);
+ recursion(t->fields.array, name, new_length,
+ t->fields.structure[i].row_major);
}
} else {
this->visit_field(t, *name);
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index c8f3844..e69098a 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -75,6 +75,12 @@ public:
* \param var The uniform variable that is to be processed
*
* Calls \c ::visit_field for each leaf of the uniform.
+ *
+ * \warning
+ * This entry should only be used with uniform blocks in cases where the
+ * row / column ordering of matrices in the block does not matter. For
+ * example, enumerating the names of members of the block, but not for
+ * determining the offsets of members.
*/
void process(ir_variable *var);
@@ -92,7 +98,8 @@ private:
* \param name_length Length of the current name \b not including the
* terminating \c NUL character.
*/
- void recursion(const glsl_type *t, char **name, size_t name_length);
+ void recursion(const glsl_type *t, char **name, size_t name_length,
+ bool row_major);
};
void