glsl: Count function call outvals as writing to variables for linker checks.
authorEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 18:29:25 +0000 (11:29 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 19:57:59 +0000 (12:57 -0700)
Fixes: glsl-vs-position-outval. Bug #28138 (regnum online)
src/glsl/linker.cpp

index deb30d7fecf9534a787983e0e48801e777bb3307..38d19c4c71148efb6b7c0c0e80f80ab6f7552b9f 100644 (file)
@@ -106,6 +106,27 @@ public:
       return visit_continue_with_parent;
    }
 
+   virtual ir_visitor_status 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 *sig_param = (ir_variable *)sig_iter.get();
+
+        if (sig_param->mode == ir_var_out ||
+            sig_param->mode == ir_var_inout) {
+           ir_variable *var = param_rval->variable_referenced();
+           if (var && strcmp(name, var->name) == 0) {
+              found = true;
+              return visit_stop;
+           }
+        }
+        sig_iter.next();
+      }
+
+      return visit_continue_with_parent;
+   }
+
    bool variable_found()
    {
       return found;