diff options
-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. */ |