From 18a60239001c27ff98739865d5fc70fd3d011b2e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 11:29:25 -0700 Subject: [PATCH] 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 file changed, 21 insertions(+) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index deb30d7fecf..38d19c4c711 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; -- 2.30.2