diff options
author | Eric Anholt <eric@anholt.net> | 2010-07-20 14:21:43 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-07-20 15:59:04 -0700 |
commit | 2927c81ed10c0dc617f734c00376d0582ac3c061 (patch) | |
tree | a157c98632143c9e4533a303680d1af5a7f1498f /src | |
parent | 02d3711a21f5766d286b09fbe1eda5d8520d151a (diff) |
glsl2: Don't mark a variable as constant if it was used as an out param.
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ir_constant_variable.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp index ef5e1e418e..c5ccd52e5d 100644 --- a/src/glsl/ir_constant_variable.cpp +++ b/src/glsl/ir_constant_variable.cpp @@ -47,6 +47,7 @@ struct assignment_entry { class ir_constant_variable_visitor : public ir_hierarchical_visitor { public: virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_call *); exec_list list; }; @@ -107,6 +108,28 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir) return visit_continue; } +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_call *ir) +{ + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *param = (ir_variable *)sig_iter.get(); + + if (param->mode == ir_var_out || + param->mode == ir_var_inout) { + ir_variable *var = param_rval->variable_referenced(); + struct assignment_entry *entry; + + assert(var); + entry = get_assignment_entry(var, &this->list); + entry->assignment_count++; + } + sig_iter.next(); + } + return visit_continue; +} + /** * Does a copy propagation pass on the code present in the instruction stream. */ |