Mesa (master): mesa: do scope replacement for variable initializers too

Brian Paul brianp at kemper.freedesktop.org
Fri Oct 31 23:48:31 UTC 2008


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

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Fri Oct 31 17:27:41 2008 -0600

mesa: do scope replacement for variable initializers too

---

 src/mesa/shader/slang/slang_compile_operation.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c
index c0d469c..1002be1 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/shader/slang/slang_compile_operation.c
@@ -84,6 +84,17 @@ slang_replace_scope(slang_operation *oper,
        oper->locals->outer_scope == oldScope) {
       oper->locals->outer_scope = newScope;
    }
+
+   if (oper->type == SLANG_OPER_VARIABLE_DECL) {
+      slang_variable *var;
+      var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE);
+      if (var && var->initializer) {
+         printf("replace scope for %s initializer\n",
+                (char *) var->a_name);
+         slang_replace_scope(var->initializer, oldScope, newScope);
+      }
+   }
+
    for (i = 0; i < oper->num_children; i++) {
       slang_replace_scope(&oper->children[i], oldScope, newScope);
    }




More information about the mesa-commit mailing list