diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-07-27 00:54:57 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-07-27 00:54:57 +1000 |
commit | 9e445d3e6374c2a9b163f1262ea5a1047e596cae (patch) | |
tree | 7a63f048928947fb57342de9b53a3d0924f50d5b /src/mesa/shader/slang/slang_compile_variable.c | |
parent | d1dc937c62083c3d8ab9f420df8e54f5c3217468 (diff) | |
parent | ff7a7031caa0ac592f210aca696a20c9de6dc0d4 (diff) |
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_variable.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index d53255075f..3428b49e16 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -28,7 +28,7 @@ * \author Michal Krol */ -#include "imports.h" +#include "main/imports.h" #include "slang_compile.h" #include "slang_mem.h" @@ -267,6 +267,7 @@ slang_variable_construct(slang_variable * var) var->size = 0; var->isTemp = GL_FALSE; var->aux = NULL; + var->declared = 0; return 1; } @@ -325,16 +326,23 @@ slang_variable_copy(slang_variable * x, const slang_variable * y) } +/** + * Search for named variable in given scope. + * \param all if true, search parent scopes too. + */ slang_variable * _slang_locate_variable(const slang_variable_scope * scope, const slang_atom a_name, GLboolean all) { - GLuint i; - - for (i = 0; i < scope->num_variables; i++) - if (a_name == scope->variables[i]->a_name) - return scope->variables[i]; - if (all && scope->outer_scope != NULL) - return _slang_locate_variable(scope->outer_scope, a_name, 1); + while (scope) { + GLuint i; + for (i = 0; i < scope->num_variables; i++) + if (a_name == scope->variables[i]->a_name) + return scope->variables[i]; + if (all) + scope = scope->outer_scope; + else + scope = NULL; + } return NULL; } |