diff options
author | Ian Romanick <[email protected]> | 2010-08-27 16:22:36 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-09-03 11:55:22 -0700 |
commit | 4e5b41c2f6b6423d0df260a9dea7938546134ec6 (patch) | |
tree | 0da43f750a31ab45cd57960ca507ac95323eab6b /src/glsl/ir_constant_propagation.cpp | |
parent | de7c3fe31a7b88a5392dceee3b13b45ed78cdeae (diff) |
glsl2: Allow copy / constant propagation into array indices
Diffstat (limited to 'src/glsl/ir_constant_propagation.cpp')
-rw-r--r-- | src/glsl/ir_constant_propagation.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp index 76c1ce7013f..f7a0599f425 100644 --- a/src/glsl/ir_constant_propagation.cpp +++ b/src/glsl/ir_constant_propagation.cpp @@ -90,7 +90,7 @@ public: virtual ir_visitor_status visit_enter(class ir_loop *); virtual ir_visitor_status visit_enter(class ir_function_signature *); virtual ir_visitor_status visit_enter(class ir_function *); - virtual ir_visitor_status visit_enter(class ir_assignment *); + virtual ir_visitor_status visit_leave(class ir_assignment *); virtual ir_visitor_status visit_enter(class ir_call *); virtual ir_visitor_status visit_enter(class ir_if *); @@ -119,7 +119,7 @@ public: void ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) { - if (!*rvalue) + if (this->in_assignee || !*rvalue) return; const glsl_type *type = (*rvalue)->type; @@ -216,22 +216,16 @@ ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir) } ir_visitor_status -ir_constant_propagation_visitor::visit_enter(ir_assignment *ir) +ir_constant_propagation_visitor::visit_leave(ir_assignment *ir) { - /* Inline accepting children, skipping the LHS. */ - ir->rhs->accept(this); - handle_rvalue(&ir->rhs); - - if (ir->condition) { - ir->condition->accept(this); - handle_rvalue(&ir->condition); - } + if (this->in_assignee) + return visit_continue; kill(ir->lhs->variable_referenced(), ir->write_mask); add_constant(ir); - return visit_continue_with_parent; + return visit_continue; } ir_visitor_status |