summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-09-05 14:15:30 -0700
committerIan Romanick <[email protected]>2012-09-28 08:19:54 -0700
commit6c01a0e770432eda0e29dbd7278a94efc688a6d3 (patch)
tree73bc0feead43a5903b4600b69e5c60230628f728
parentbe66cf950e01d217b5341f8e56676dc5bf81ca47 (diff)
mesa: Don't set uniform dispatch pointers for many things in ES2 or core
NOTE: This is a candidate for the 9.0 branch Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/mesa/main/api_exec.c2
-rw-r--r--src/mesa/main/uniforms.c70
-rw-r--r--src/mesa/main/uniforms.h3
3 files changed, 39 insertions, 36 deletions
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index f9a45d436ef..69179abb1e7 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -365,7 +365,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
_mesa_init_shader_dispatch(ctx, exec);
- _mesa_init_shader_uniform_dispatch(exec);
+ _mesa_init_shader_uniform_dispatch(ctx, exec);
/* 2. GL_EXT_blend_color */
#if 0
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 04cf0a2b0d1..39fac1534b3 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -804,7 +804,8 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
* Plug in shader uniform-related functions into API dispatch table.
*/
void
-_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
+_mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec)
{
#if FEATURE_GL
SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
@@ -833,38 +834,39 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
/* OpenGL 2.1 */
- SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
- SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
- SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
- SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
- SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
- SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
-
- /* OpenGL 3.0 */
- SET_Uniform1uiEXT(exec, _mesa_Uniform1ui);
- SET_Uniform2uiEXT(exec, _mesa_Uniform2ui);
- SET_Uniform3uiEXT(exec, _mesa_Uniform3ui);
- SET_Uniform4uiEXT(exec, _mesa_Uniform4ui);
- SET_Uniform1uivEXT(exec, _mesa_Uniform1uiv);
- SET_Uniform2uivEXT(exec, _mesa_Uniform2uiv);
- SET_Uniform3uivEXT(exec, _mesa_Uniform3uiv);
- SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
- SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
-
- /* GL_ARB_robustness */
- SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
- SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
- SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
- SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
-
- /* GL_ARB_uniform_buffer_object / GL 3.1 */
- SET_GetUniformBlockIndex(exec, _mesa_GetUniformBlockIndex);
- SET_GetUniformIndices(exec, _mesa_GetUniformIndices);
- SET_GetActiveUniformsiv(exec, _mesa_GetActiveUniformsiv);
- SET_GetActiveUniformBlockiv(exec, _mesa_GetActiveUniformBlockiv);
- SET_GetActiveUniformBlockName(exec, _mesa_GetActiveUniformBlockName);
- SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
- SET_UniformBlockBinding(exec, _mesa_UniformBlockBinding);
-
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
+ SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
+ SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
+ SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
+ SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
+ SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
+
+ /* OpenGL 3.0 */
+ SET_Uniform1uiEXT(exec, _mesa_Uniform1ui);
+ SET_Uniform2uiEXT(exec, _mesa_Uniform2ui);
+ SET_Uniform3uiEXT(exec, _mesa_Uniform3ui);
+ SET_Uniform4uiEXT(exec, _mesa_Uniform4ui);
+ SET_Uniform1uivEXT(exec, _mesa_Uniform1uiv);
+ SET_Uniform2uivEXT(exec, _mesa_Uniform2uiv);
+ SET_Uniform3uivEXT(exec, _mesa_Uniform3uiv);
+ SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
+ SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
+
+ /* GL_ARB_robustness */
+ SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
+ SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
+ SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
+ SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
+
+ /* GL_ARB_uniform_buffer_object / GL 3.1 */
+ SET_GetUniformBlockIndex(exec, _mesa_GetUniformBlockIndex);
+ SET_GetUniformIndices(exec, _mesa_GetUniformIndices);
+ SET_GetActiveUniformsiv(exec, _mesa_GetActiveUniformsiv);
+ SET_GetActiveUniformBlockiv(exec, _mesa_GetActiveUniformBlockiv);
+ SET_GetActiveUniformBlockName(exec, _mesa_GetActiveUniformBlockName);
+ SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
+ SET_UniformBlockBinding(exec, _mesa_UniformBlockBinding);
+ }
#endif /* FEATURE_GL */
}
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index e84964c6fc9..3fe7d4402c7 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -227,7 +227,8 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
char *errMsg, size_t errMsgLength);
extern void
-_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
+_mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec);
extern const struct gl_program_parameter *
get_uniform_parameter(struct gl_shader_program *shProg, GLint index);