summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-10-27 20:09:33 -0600
committerBrian Paul <brianp@vmware.com>2009-10-27 20:10:59 -0600
commitb44304efdee562b294e542ea0e47d6c758816ee8 (patch)
tree95ce53a5322eaf28c154d05bdb0e7a05db2ae267 /src/mesa/shader
parent2947d1420270476730711892909c3683bb6c5bff (diff)
glsl: avoid redundant state changes in _mesa_use_program()
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/shader_api.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 30fa58ea52..453cd3964a 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1547,8 +1547,6 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
return;
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
-
if (program) {
shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram");
if (!shProg) {
@@ -1569,7 +1567,10 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
shProg = NULL;
}
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg);
+ if (ctx->Shader.CurrentProgram != shProg) {
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg);
+ }
}