diff options
author | Ian Romanick <[email protected]> | 2013-01-21 22:32:07 -0500 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-01-25 09:07:34 -0500 |
commit | 6a0c1bc16334b72de25e57d0c7e0a72dcd7c5ecf (patch) | |
tree | c4bba8900777cc79d2082042b180e83de8bdfd68 /src/glsl/link_uniforms.cpp | |
parent | 23b7ce3a824013c8b4d7340294cb59b0b4cb8f87 (diff) |
glsl: Modify uniform_field_visitor::recursion to take a row_major parameter
Not used yet, but the UBO layout visitor will use this.
v2: Add some commentary as to why row_major is always set to false in
process. Suggesed by Paul Berry.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Carl Worth <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/link_uniforms.cpp')
-rw-r--r-- | src/glsl/link_uniforms.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index c639a3d16a4..c5661bb2f47 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); |