summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-31 17:27:41 -0600
committerBrian Paul <[email protected]>2008-10-31 17:51:25 -0600
commit40217db75ae08d04eee696d5092b34d2b2cfd8b0 (patch)
tree091a37b8afd65bac6ef1ef28053ae489f7836c7e /src/mesa/shader
parent851dbaa5b5b5a7bd85e95e504ed9917dae66525e (diff)
mesa: do scope replacement for variable initializers too
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.c11
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 c0d469c8294..1002be16cb7 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);
}