glsl: Don't tree-graft in an expression in place of a function outval.
authorEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 01:25:55 +0000 (18:25 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 01:34:45 +0000 (18:34 -0700)
Fixes: glsl-constant-folding-call-1 (bug #29737)
src/glsl/ir_tree_grafting.cpp

index 6acc5b86c5185fc223231840a5f9c119d58e8a64..748dcecefc685993cc3ba331eab56529a5e257d4 100644 (file)
@@ -188,11 +188,16 @@ ir_tree_grafting_visitor::visit_enter(ir_function_signature *ir)
 ir_visitor_status
 ir_tree_grafting_visitor::visit_enter(ir_call *ir)
 {
+   exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator();
    /* Reminder: iterating ir_call iterates its parameters. */
    foreach_iter(exec_list_iterator, iter, *ir) {
+      ir_variable *sig_param = (ir_variable *)sig_iter.get();
       ir_rvalue *ir = (ir_rvalue *)iter.get();
       ir_rvalue *new_ir = ir;
 
+      if (sig_param->mode != ir_var_in)
+        continue;
+
       if (do_graft(&new_ir)) {
         ir->replace_with(new_ir);
         return visit_stop;