diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-10-31 17:27:50 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-10-31 17:48:53 -0600 |
commit | db2bbb2d2703880ae3b4805620308c1eda5c27f3 (patch) | |
tree | e710456d15e0ccd42d918839bb24fc26c8953b50 | |
parent | 83de88bf4b698b37f9a943d2e9ccc4abc8e7eca3 (diff) | |
download | mesa-db2bbb2d2703880ae3b4805620308c1eda5c27f3.tar.gz |
mesa: do scope replacement for variable initializers too
-rw-r--r-- | 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 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); } |