summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/glsl/opt_array_splitting.cpp
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-07-09 20:35:21 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-07-09 20:35:21 +0000
commit90414e9e8766ee4a4f0ba93d8206de27cf984ce6 (patch)
tree83dd43b1cace3aa9d449e272b195871441746ae8 /dist/Mesa/src/glsl/opt_array_splitting.cpp
parent417af3adbc72ea5a850bad6c0490b7b0f2424a38 (diff)
Import Mesa 10.2.3
Diffstat (limited to 'dist/Mesa/src/glsl/opt_array_splitting.cpp')
-rw-r--r--dist/Mesa/src/glsl/opt_array_splitting.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/dist/Mesa/src/glsl/opt_array_splitting.cpp b/dist/Mesa/src/glsl/opt_array_splitting.cpp
index f4a7ef99b..97d3a57e9 100644
--- a/dist/Mesa/src/glsl/opt_array_splitting.cpp
+++ b/dist/Mesa/src/glsl/opt_array_splitting.cpp
@@ -40,6 +40,8 @@
static bool debug = false;
+namespace {
+
namespace opt_array_splitting {
class variable_entry : public exec_node
@@ -77,6 +79,7 @@ public:
};
} /* namespace */
+
using namespace opt_array_splitting;
/**
@@ -112,13 +115,15 @@ public:
void *mem_ctx;
};
+} /* namespace */
+
variable_entry *
ir_array_reference_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
- if (var->mode != ir_var_auto &&
- var->mode != ir_var_temporary)
+ if (var->data.mode != ir_var_auto &&
+ var->data.mode != ir_var_temporary)
return NULL;
if (!(var->type->is_array() || var->type->is_matrix()))
@@ -127,11 +132,11 @@ ir_array_reference_visitor::get_variable_entry(ir_variable *var)
/* If the array hasn't been sized yet, we can't split it. After
* linking, this should be resolved.
*/
- if (var->type->is_array() && var->type->length == 0)
+ if (var->type->is_unsized_array())
return NULL;
- foreach_iter(exec_list_iterator, iter, this->variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ foreach_list(n, &this->variable_list) {
+ variable_entry *entry = (variable_entry *) n;
if (entry->var == var)
return entry;
}
@@ -219,8 +224,8 @@ ir_array_reference_visitor::get_split_list(exec_list *instructions,
}
/* Trim out variables we found that we can't split. */
- foreach_iter(exec_list_iterator, iter, variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ foreach_list_safe(n, &variable_list) {
+ variable_entry *entry = (variable_entry *) n;
if (debug) {
printf("array %s@%p: decl %d, split %d\n",
@@ -265,8 +270,8 @@ ir_array_splitting_visitor::get_splitting_entry(ir_variable *var)
{
assert(var);
- foreach_iter(exec_list_iterator, iter, *this->variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ foreach_list(n, this->variable_list) {
+ variable_entry *entry = (variable_entry *) n;
if (entry->var == var) {
return entry;
}
@@ -363,8 +368,8 @@ optimize_split_arrays(exec_list *instructions, bool linked)
/* Replace the decls of the arrays to be split with their split
* components.
*/
- foreach_iter(exec_list_iterator, iter, refs.variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ foreach_list(n, &refs.variable_list) {
+ variable_entry *entry = (variable_entry *) n;
const struct glsl_type *type = entry->var->type;
const struct glsl_type *subtype;
@@ -395,7 +400,7 @@ optimize_split_arrays(exec_list *instructions, bool linked)
visit_list_elements(&split, instructions);
if (debug)
- _mesa_print_ir(instructions, NULL);
+ _mesa_print_ir(stdout, instructions, NULL);
ralloc_free(mem_ctx);