diff options
author | Eric Anholt <[email protected]> | 2012-04-16 09:26:32 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-04-19 16:33:12 -0700 |
commit | 538ba0a36373d7d0bd047e6fc4ef4e6e8d8bb8d7 (patch) | |
tree | 831989002f43dd6c4ba37d3b43d76b4c0096f1b1 /src/glsl | |
parent | 36a8c9caafef79524920120286649a0f53fe5228 (diff) |
glsl: Rename the "whole_array_access" member in array splitting.
This was carried over from structure splitting, without thinking about
whether the name still made sense in this context.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/opt_array_splitting.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index 387bd5cba08..73b35b5289f 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -49,7 +49,7 @@ public: variable_entry(ir_variable *var) { this->var = var; - this->whole_array_access = 0; + this->split = true; this->declaration = false; this->components = NULL; this->mem_ctx = NULL; @@ -62,8 +62,8 @@ public: ir_variable *var; /* The key: the variable's pointer. */ unsigned size; /* array length or matrix columns */ - /** Number of times the variable is referenced, including assignments. */ - unsigned whole_array_access; + /** Whether this array should be split or not. */ + bool split; bool declaration; /* If the variable had a decl in the instruction stream */ @@ -154,12 +154,13 @@ ir_array_reference_visitor::visit(ir_dereference_variable *ir) { variable_entry *entry = this->get_variable_entry(ir->var); - /* If we made it to here, then the dereference of this array didn't - * have a constant index (see the visit_continue_with_parent - * below), so we can't split the variable. + /* If we made it to here without seeing an ir_dereference_array, + * then the dereference of this array didn't have a constant index + * (see the visit_continue_with_parent below), so we can't split + * the variable. */ if (entry) - entry->whole_array_access++; + entry->split = false; return visit_continue; } @@ -173,8 +174,11 @@ ir_array_reference_visitor::visit_enter(ir_dereference_array *ir) variable_entry *entry = this->get_variable_entry(deref->var); + /* If the access to the array has a variable index, we wouldn't + * know which split variable this dereference should go to. + */ if (entry && !ir->array_index->as_constant()) - entry->whole_array_access++; + entry->split = false; return visit_continue_with_parent; } @@ -204,12 +208,12 @@ ir_array_reference_visitor::get_split_list(exec_list *instructions, variable_entry *entry = (variable_entry *)iter.get(); if (debug) { - printf("array %s@%p: decl %d, whole_access %d\n", + printf("array %s@%p: decl %d, split %d\n", entry->var->name, (void *) entry->var, entry->declaration, - entry->whole_array_access); + entry->split); } - if (!entry->declaration || entry->whole_array_access) { + if (!(entry->declaration && entry->split)) { entry->remove(); } } |