Parcourir la source

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.
undefined
Brian Paul il y a 15 ans
Parent
révision
a12614362a

+ 1
- 2
src/mesa/shader/slang/slang_codegen.c Voir le fichier

@@ -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;
}

+ 1
- 1
src/mesa/shader/slang/slang_compile_variable.h Voir le fichier

@@ -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;


Chargement…
Annuler
Enregistrer