diff options
author | Brian Paul <[email protected]> | 2008-08-25 09:20:00 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-08-25 09:20:00 -0600 |
commit | 2d5087bf74f2d0e58037847058a123fe9d142038 (patch) | |
tree | 5e7069b458ac130267908f7e24ef66d2a25aa1d9 /src/mesa/shader/prog_parameter.c | |
parent | d6df735f1c22c64c17103dd92fffd7b658a46cda (diff) |
mesa: glsl: grab latest fixes from gallium-0.1 branch
Includes:
1. Fixes failed asserting about bad swizzles in src reg emit.
2. Tracks uniform var usage.
3. Emit exp() in terms of EXP2 instruction.
Diffstat (limited to 'src/mesa/shader/prog_parameter.c')
-rw-r--r-- | src/mesa/shader/prog_parameter.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index d87e8f6e15f..2dfd923a0f3 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -29,9 +29,9 @@ */ -#include "glheader.h" -#include "imports.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" #include "prog_instruction.h" #include "prog_parameter.h" #include "prog_statevars.h" @@ -278,6 +278,26 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, /** + * Mark the named uniform as 'used'. + */ +void +_mesa_use_uniform(struct gl_program_parameter_list *paramList, + const char *name) +{ + GLuint i; + for (i = 0; i < paramList->NumParameters; i++) { + struct gl_program_parameter *p = paramList->Parameters + i; + if (p->Type == PROGRAM_UNIFORM && _mesa_strcmp(p->Name, name) == 0) { + p->Used = GL_TRUE; + /* Note that large uniforms may occupy several slots so we're + * not done searching yet. + */ + } + } +} + + +/** * Add a sampler to the parameter list. * \param name uniform's name * \param datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. @@ -591,21 +611,24 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) /** Not too efficient, but correct */ for (i = 0; i < list->NumParameters; i++) { struct gl_program_parameter *p = list->Parameters + i; + struct gl_program_parameter *pCopy; GLuint size = MIN2(p->Size, 4); GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType, list->ParameterValues[i], NULL); ASSERT(j >= 0); + pCopy = clone->Parameters + j; + pCopy->Used = p->Used; /* copy state indexes */ if (p->Type == PROGRAM_STATE_VAR) { GLint k; - struct gl_program_parameter *q = clone->Parameters + j; for (k = 0; k < STATE_LENGTH; k++) { - q->StateIndexes[k] = p->StateIndexes[k]; + pCopy->StateIndexes[k] = p->StateIndexes[k]; } } else { clone->Parameters[j].Size = p->Size; } + } clone->StateFlags = list->StateFlags; |