diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-11-10 12:33:17 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-01-06 08:39:06 -0700 |
commit | 6b05708ce2c4120921f43d82f1751e039306e0d6 (patch) | |
tree | 700d9da432f136714c1f53ab50fe933f466b7684 /src/mesa/shader/slang | |
parent | de445478915af41e1e078cbb8c2cbcce340f83b6 (diff) |
mesa: track initialization status of uniform variables. Plus, asst clean-ups.
(cherry picked from commit 2d76a0d77af7be9539f89cba37ce84338c1cdda4)
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 17 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 5 |
2 files changed, 13 insertions, 9 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 { diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 4361efc56e..79fd9a064f 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -193,7 +193,10 @@ link_uniform_vars(struct gl_shader_program *shProg, if ((p->Type == PROGRAM_UNIFORM && p->Used) || p->Type == PROGRAM_SAMPLER) { - _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); + struct gl_uniform *uniform = + _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); + if (uniform) + uniform->Initialized = p->Initialized; } if (p->Type == PROGRAM_SAMPLER) { |