From 79b643dd02ac4e19f24c9cd88843719746f8ec69 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 10 Jul 2010 19:21:42 -0400 Subject: mesa: make uniform work with geometry shaders --- src/mesa/main/uniforms.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index c869942d2eb..d68a7768df5 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; } -- cgit v1.2.3