summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-11-11 14:42:41 -0700
committerBrian Paul <[email protected]>2008-11-11 14:42:41 -0700
commit19e4222f937c9bb95d3a899dd788afb930eecaa4 (patch)
tree5bb25227f53ad93fbdb9dc889ded690dc40ad1d9 /src/mesa/shader/shader_api.c
parent7f3d45758ccbbcff6428d57d26794960e3e9532c (diff)
parent90246d3ea54f54d60593dce1b89f0226058a3c56 (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: src/mesa/shader/prog_execute.c src/mesa/shader/slang/library/slang_vertex_builtin_gc.h
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 7a8501dcdd3..122688826cd 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1615,6 +1615,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
const GLvoid *values, GLenum type)
{
struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
+ struct gl_uniform *uniform;
GLint elems, offset;
if (!shProg || !shProg->LinkStatus) {
@@ -1661,12 +1662,14 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ uniform = &shProg->Uniforms->Uniforms[location];
+
/* A uniform var may be used by both a vertex shader and a fragment
* shader. We may need to update one or both shader's uniform here:
*/
if (shProg->VertexProgram) {
/* convert uniform location to program parameter index */
- GLint index = shProg->Uniforms->Uniforms[location].VertPos;
+ GLint index = uniform->VertPos;
if (index >= 0) {
set_program_uniform(ctx, &shProg->VertexProgram->Base,
index, offset, type, count, elems, values);
@@ -1675,14 +1678,14 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
if (shProg->FragmentProgram) {
/* convert uniform location to program parameter index */
- GLint index = shProg->Uniforms->Uniforms[location].FragPos;
+ GLint index = uniform->FragPos;
if (index >= 0) {
set_program_uniform(ctx, &shProg->FragmentProgram->Base,
index, offset, type, count, elems, values);
}
}
- shProg->Uniforms->Uniforms[location].Initialized = GL_TRUE;
+ uniform->Initialized = GL_TRUE;
}
@@ -1749,8 +1752,9 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose, const GLfloat *values)
{
- GLint offset;
struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
+ struct gl_uniform *uniform;
+ GLint offset;
if (!shProg || !shProg->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -1774,9 +1778,11 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ uniform = &shProg->Uniforms->Uniforms[location];
+
if (shProg->VertexProgram) {
/* convert uniform location to program parameter index */
- GLint index = shProg->Uniforms->Uniforms[location].VertPos;
+ GLint index = uniform->VertPos;
if (index >= 0) {
set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base,
index, offset,
@@ -1786,7 +1792,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
if (shProg->FragmentProgram) {
/* convert uniform location to program parameter index */
- GLint index = shProg->Uniforms->Uniforms[location].FragPos;
+ GLint index = uniform->FragPos;
if (index >= 0) {
set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base,
index, offset,
@@ -1794,7 +1800,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
}
}
- shProg->Uniforms->Uniforms[location].Initialized = GL_TRUE;
+ uniform->Initialized = GL_TRUE;
}