diff options
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index a76b6da32b..f9199a917f 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -3712,7 +3712,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, /* temporary work-around */ GLenum datatype = GL_FLOAT; GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, - totalSize, datatype); + totalSize, datatype, NULL); store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, totalSize, swizzle); @@ -3744,18 +3744,14 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, } } else { - GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, - totalSize, datatype); - store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, - totalSize, swizzle); + GLint uniformLoc; + const GLfloat *initialValues = NULL; if (var->initializer) { _slang_simplify(var->initializer, &A->space, A->atoms); if (var->initializer->type == SLANG_OPER_LITERAL_FLOAT || var->initializer->type == SLANG_OPER_LITERAL_INT) { /* simple float/vector initializer */ - GLfloat *uniformValue = - prog->Parameters->ParameterValues[uniformLoc]; - COPY_4V(uniformValue, var->initializer->literal); + initialValues = var->initializer->literal; } else { /* complex initializer */ @@ -3764,6 +3760,11 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, return GL_FALSE; } } + + uniformLoc = _mesa_add_uniform(prog->Parameters, varName, + totalSize, datatype, initialValues); + store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, + totalSize, swizzle); } } else { |