summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_uniform.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/prog_uniform.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/prog_uniform.c')
-rw-r--r--src/mesa/shader/prog_uniform.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c
index 11f2e3e561c..0642713148c 100644
--- a/src/mesa/shader/prog_uniform.c
+++ b/src/mesa/shader/prog_uniform.c
@@ -52,11 +52,12 @@ _mesa_free_uniform_list(struct gl_uniform_list *list)
}
-GLboolean
+struct gl_uniform *
_mesa_append_uniform(struct gl_uniform_list *list,
const char *name, GLenum target, GLuint progPos)
{
const GLuint oldNum = list->NumUniforms;
+ struct gl_uniform *uniform;
GLint index;
assert(target == GL_VERTEX_PROGRAM_ARB ||
@@ -84,31 +85,37 @@ _mesa_append_uniform(struct gl_uniform_list *list,
return GL_FALSE;
}
- list->Uniforms[oldNum].Name = _mesa_strdup(name);
- list->Uniforms[oldNum].VertPos = -1;
- list->Uniforms[oldNum].FragPos = -1;
- list->Uniforms[oldNum].Initialized = GL_FALSE;
- index = oldNum;
+ uniform = list->Uniforms + oldNum;
+
+ uniform->Name = _mesa_strdup(name);
+ uniform->VertPos = -1;
+ uniform->FragPos = -1;
+ uniform->Initialized = GL_FALSE;
+
list->NumUniforms++;
}
+ else {
+ /* found */
+ uniform = list->Uniforms + index;
+ }
/* update position for the vertex or fragment program */
if (target == GL_VERTEX_PROGRAM_ARB) {
- if (list->Uniforms[index].VertPos != -1) {
+ if (uniform->VertPos != -1) {
/* this uniform is already in the list - that shouldn't happen */
return GL_FALSE;
}
- list->Uniforms[index].VertPos = progPos;
+ uniform->VertPos = progPos;
}
else {
- if (list->Uniforms[index].FragPos != -1) {
+ if (uniform->FragPos != -1) {
/* this uniform is already in the list - that shouldn't happen */
return GL_FALSE;
}
- list->Uniforms[index].FragPos = progPos;
+ uniform->FragPos = progPos;
}
- return GL_TRUE;
+ return uniform;
}