diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-29 17:29:30 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-29 17:29:30 -0600 |
commit | 1638edb3256b3b4bd8bc2eb65d02573601ef9a44 (patch) | |
tree | 6ba3be496e6755148d3dcab371decc90083d5d2e /src/mesa/shader/slang/slang_compile_variable.c | |
parent | 6225e51a73a51fa46d839a429f254d7786b1fd18 (diff) |
mesa: glsl: assorted fixes for resolving polymorphic functions
Plus,
- fix some issues in casting function arguments to format param types.
- fix some vec/mat constructor bugs
- find/report more syntax/semantic errors
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_variable.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index d53255075f..09ad26f62f 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -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; } |