diff options
author | Ian Romanick <[email protected]> | 2013-01-21 23:42:19 -0500 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-01-25 09:07:35 -0500 |
commit | 99b8935ce2d63902bdb3e5a76154240f0e011b80 (patch) | |
tree | 7cb85be241d58a9b09495bf6fdb88b8a7d6acfba /src/glsl/link_uniforms.cpp | |
parent | 007de494d2cd110786075f8aa014d8a0547d2063 (diff) |
glsl: Add new uniform_field_visitor::process variant
This flavor takes a type and a base name. It will be used to handle
cases where the block name (instead of the instance name) is used for an
interface block.
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 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index c77f83abab1..737e2ad48a6 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -58,6 +58,19 @@ values_for_type(const glsl_type *type) } void +uniform_field_visitor::process(const glsl_type *type, const char *name) +{ + assert(type->is_record() + || (type->is_array() && type->fields.array->is_record()) + || type->is_interface() + || (type->is_array() && type->fields.array->is_interface())); + + char *name_copy = ralloc_strdup(NULL, name); + recursion(type, &name_copy, strlen(name), false); + ralloc_free(name_copy); +} + +void uniform_field_visitor::process(ir_variable *var) { const glsl_type *t = var->type; @@ -161,6 +174,15 @@ public: this->num_shader_uniform_components = 0; } + void process(ir_variable *var) + { + if (var->is_interface_instance()) + uniform_field_visitor::process(var->interface_type, + var->interface_type->name); + else + uniform_field_visitor::process(var); + } + /** * Total number of active uniforms counted */ |