浏览代码

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 15 年前
父节点
当前提交
a12614362a
共有 2 个文件被更改,包括 2 次插入3 次删除
  1. 1
    2
      src/mesa/shader/slang/slang_codegen.c
  2. 1
    1
      src/mesa/shader/slang/slang_compile_variable.h

+ 1
- 2
src/mesa/shader/slang/slang_codegen.c 查看文件

slang_atom name = oper->var ? oper->var->a_name : oper->a_id; slang_atom name = oper->var ? oper->var->a_name : oper->a_id;
slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE); slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE);
slang_ir_node *n; slang_ir_node *n;
if (!var) {
if (!var || !var->declared) {
slang_info_log_error(A->log, "undefined variable '%s'", (char *) name); slang_info_log_error(A->log, "undefined variable '%s'", (char *) name);
return NULL; return NULL;
} }
assert(var->declared);
n = new_var(A, var); n = new_var(A, var);
return n; return n;
} }

+ 1
- 1
src/mesa/shader/slang/slang_compile_variable.h 查看文件

GLuint size; /**< Variable's size in bytes */ GLuint size; /**< Variable's size in bytes */
GLboolean is_global; GLboolean is_global;
GLboolean isTemp; /**< a named temporary (__resultTmp) */ 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 */ struct slang_ir_storage_ *store; /**< Storage for this var */
} slang_variable; } slang_variable;



正在加载...
取消
保存