summaryrefslogtreecommitdiff
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-07-10 19:21:42 -0400
committerZack Rusin <zackr@vmware.com>2010-07-10 19:21:42 -0400
commit79b643dd02ac4e19f24c9cd88843719746f8ec69 (patch)
treea70b7372721e459709a940cf55b4455501958f78 /src/mesa/main/uniforms.c
parent748d8d46134a835f61675ae0206d52869eb03240 (diff)
mesa: make uniform work with geometry shaders
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index c869942d2e..d68a7768df 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -132,6 +132,11 @@ get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index)
progPos = shProg->Uniforms->Uniforms[index].FragPos;
if (progPos >= 0) {
prog = &shProg->FragmentProgram->Base;
+ } else {
+ progPos = shProg->Uniforms->Uniforms[index].GeomPos;
+ if (progPos >= 0) {
+ prog = &shProg->GeometryProgram->Base;
+ }
}
}
@@ -315,6 +320,11 @@ lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location,
progPos = shProg->Uniforms->Uniforms[location].FragPos;
if (progPos >= 0) {
prog = &shProg->FragmentProgram->Base;
+ } else {
+ progPos = shProg->Uniforms->Uniforms[location].GeomPos;
+ if (progPos >= 0) {
+ prog = &shProg->GeometryProgram->Base;
+ }
}
}
}
@@ -829,6 +839,15 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
}
}
+ if (shProg->GeometryProgram) {
+ /* convert uniform location to program parameter index */
+ GLint index = uniform->GeomPos;
+ if (index >= 0) {
+ set_program_uniform(ctx, &shProg->GeometryProgram->Base,
+ index, offset, type, count, elems, values);
+ }
+ }
+
uniform->Initialized = GL_TRUE;
}
@@ -962,6 +981,16 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
}
}
+ if (shProg->GeometryProgram) {
+ /* convert uniform location to program parameter index */
+ GLint index = uniform->GeomPos;
+ if (index >= 0) {
+ set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base,
+ index, offset,
+ count, rows, cols, transpose, values);
+ }
+ }
+
uniform->Initialized = GL_TRUE;
}