diff options
author | Brian Paul <brianp@vmware.com> | 2010-05-03 13:58:51 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-05-07 08:59:08 -0600 |
commit | 210b74c613c435dd1f1f212466c5d120b9b9e6e8 (patch) | |
tree | ea7e0eb9ba669ea05d8c5a69b8fe0a030acdbdec | |
parent | f7638f004d4a1fdb2ea6cd7485a00a0cac8f8218 (diff) |
glsl: change variable declared assertion into conditional
The slang_variable::declared field originated as a debug field but
can be promoted for use during sematic error checking.
Fixes fd.o bug 27921.
NOTE: this is a candidate for back-porting to the 7.8 stable branch.
(cherry picked from commit a12614362a79d676eeb1c3030ed52057bcb8f4f8)
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 3 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.h | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index ecb2f6d5c1..7d5e5eb293 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -4187,11 +4187,10 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper) slang_atom name = oper->var ? oper->var->a_name : oper->a_id; slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE); slang_ir_node *n; - if (!var) { + if (!var || !var->declared) { slang_info_log_error(A->log, "undefined variable '%s'", (char *) name); return NULL; } - assert(var->declared); n = new_var(A, var); return n; } diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h index b4585599f2..5c9d248b35 100644 --- a/src/mesa/shader/slang/slang_compile_variable.h +++ b/src/mesa/shader/slang/slang_compile_variable.h @@ -41,7 +41,7 @@ typedef struct slang_variable_ GLuint size; /**< Variable's size in bytes */ GLboolean is_global; GLboolean isTemp; /**< a named temporary (__resultTmp) */ - GLboolean declared; /**< for debug */ + GLboolean declared; /**< has the var been declared? */ struct slang_ir_storage_ *store; /**< Storage for this var */ } slang_variable; |