Mesa (master): glsl: Count function call outvals as writing to variables for linker checks.

Eric Anholt anholt at kemper.freedesktop.org
Mon Aug 23 20:07:05 UTC 2010


Module: Mesa
Branch: master
Commit: 18a60239001c27ff98739865d5fc70fd3d011b2e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=18a60239001c27ff98739865d5fc70fd3d011b2e

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug 23 11:29:25 2010 -0700

glsl: Count function call outvals as writing to variables for linker checks.

Fixes: glsl-vs-position-outval.  Bug #28138 (regnum online)

---

 src/glsl/linker.cpp |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index deb30d7..38d19c4 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -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;




More information about the mesa-commit mailing list