diff options
author | Brian Paul <[email protected]> | 2008-11-10 12:33:17 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-11-10 12:39:36 -0700 |
commit | 2d76a0d77af7be9539f89cba37ce84338c1cdda4 (patch) | |
tree | 6e722f4d0f8356707ed9402dc9eeeb5dc56704b4 /src/mesa/shader/slang/slang_codegen.c | |
parent | 379ff8c9567940ebff44870cf7b0202882445fa6 (diff) |
mesa: track initialization status of uniform variables. Plus, asst clean-ups.
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 8ab1fa8f2a6..dea1fcf0874 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -3715,7 +3715,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); @@ -3747,18 +3747,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 */ @@ -3767,6 +3763,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 { |