summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-01-21 23:06:45 -0500
committerIan Romanick <[email protected]>2013-01-25 09:07:34 -0500
commit25e75b0a134f8f4de326c310349fc13f5ca906f2 (patch)
tree59d2af1f1bceda50ce3e5fdaeb9782cdc0241cf3
parent5383661092fc46cf7013052210e6d624f4d5b596 (diff)
glsl: Handle instance array declarations
v2: Add a comment and an assertion about the array size in the non-instance name case. Suggested by Paul Berry. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/glsl/ast_to_hir.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 80a02e9da4e..80dd86e7803 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4273,14 +4273,30 @@ ast_uniform_block::hir(exec_list *instructions,
* field selector ( . ) operator (analogously to structures)."
*/
if (this->instance_name) {
- ir_variable *var = new(state) ir_variable(block_type,
- this->instance_name,
- ir_var_uniform);
+ ir_variable *var;
+
+ if (this->array_size != NULL) {
+ const glsl_type *block_array_type =
+ process_array_type(&loc, block_type, this->array_size, state);
+
+ var = new(state) ir_variable(block_array_type,
+ this->instance_name,
+ ir_var_uniform);
+ } else {
+ var = new(state) ir_variable(block_type,
+ this->instance_name,
+ ir_var_uniform);
+ }
var->interface_type = block_type;
state->symbols->add_variable(var);
instructions->push_tail(var);
} else {
+ /* In order to have an array size, the block must also be declared with
+ * an instane name.
+ */
+ assert(this->array_size == NULL);
+
for (unsigned i = 0; i < num_variables; i++) {
ir_variable *var =
new(state) ir_variable(fields[i].type,