diff options
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 8 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.h | 1 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 3 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile_operation.c | 1 |
4 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index ee5a50ca82e..b62cfc36af1 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -3763,6 +3763,14 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, #endif } + if (var->type.qualifier == SLANG_QUAL_UNIFORM && + !A->allow_uniform_initializers) { + slang_info_log_error(A->log, + "initializer for uniform %s not allowed", + varName); + return NULL; + } + /* IR for the variable we're initializing */ varRef = new_var(A, var); if (!varRef) { diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h index ee3be55a459..461633fe346 100644 --- a/src/mesa/shader/slang/slang_codegen.h +++ b/src/mesa/shader/slang/slang_codegen.h @@ -42,6 +42,7 @@ typedef struct slang_assemble_ctx_ struct gl_sl_pragmas *pragmas; slang_var_table *vartable; slang_info_log *log; + GLboolean allow_uniform_initializers; /* current loop stack */ const slang_operation *LoopOperStack[MAX_LOOP_DEPTH]; diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index f60ad9ee385..6499cfcb2fe 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2143,6 +2143,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, if (C->global_scope) { slang_assemble_ctx A; memset(&A, 0, sizeof(slang_assemble_ctx)); + A.allow_uniform_initializers = C->version > 110; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -2162,6 +2163,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, if (var->initializer != NULL) { slang_assemble_ctx A; memset(&A, 0, sizeof(slang_assemble_ctx)); + A.allow_uniform_initializers = C->version > 110; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -2519,6 +2521,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, A.vartable = o.vartable; A.EmitContReturn = ctx->Shader.EmitContReturn; A.log = C->L; + A.allow_uniform_initializers = C->version > 110; /* main() takes no parameters */ if (mainFunc->param_count > 0) { diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c index be73094ca04..3a15d9d3ab5 100644 --- a/src/mesa/shader/slang/slang_compile_operation.c +++ b/src/mesa/shader/slang/slang_compile_operation.c @@ -46,6 +46,7 @@ slang_operation_construct(slang_operation * oper) oper->literal_size = 1; oper->array_constructor = GL_FALSE; oper->a_id = SLANG_ATOM_NULL; + oper->a_obj = SLANG_ATOM_NULL; oper->locals = _slang_variable_scope_new(NULL); if (oper->locals == NULL) return GL_FALSE; |