From 2927c81ed10c0dc617f734c00376d0582ac3c061 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 14:21:43 -0700 Subject: [PATCH] glsl2: Don't mark a variable as constant if it was used as an out param. --- src/glsl/ir_constant_variable.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp index ef5e1e418e5..c5ccd52e5db 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. */ -- 2.30.2