summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-11-06 11:43:45 -0700
committerEric Anholt <[email protected]>2010-11-06 11:44:32 -0700
commitd348b0c72d41603178c0923e276869c7280904c7 (patch)
tree6fff215e2889f1e30e89624b5c3862ae15463121 /src/mesa/main/shaderapi.c
parent8eaa97592a4330d1a253f6fa32df7a3fd04f53ae (diff)
mesa: Fix delayed state flagging for EXT_sso-related program changes.
Flushing the vertices after having already updated the state doesn't do any good. Fixes useshaderprogram-flushverts-1. As a side effect, by moving it to the right place we end up skipping no-op state changes for traditional glUseProgram.
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 9717e005597..030236e7350 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -992,6 +992,7 @@ use_shader_program(struct gl_context *ctx, GLenum type,
}
if (*target != shProg) {
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
_mesa_reference_shader_program(ctx, target, shProg);
return true;
}
@@ -1005,19 +1006,11 @@ use_shader_program(struct gl_context *ctx, GLenum type,
void
_mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
{
- bool changed = false;
-
- changed = use_shader_program(ctx, GL_VERTEX_SHADER, shProg);
- changed = use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg)
- || changed;
- changed = use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg)
- || changed;
+ use_shader_program(ctx, GL_VERTEX_SHADER, shProg);
+ use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg);
+ use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg);
_mesa_active_program(ctx, shProg, "glUseProgram");
- if (changed) {
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
- }
-
if (ctx->Driver.UseProgram)
ctx->Driver.UseProgram(ctx, shProg);
}
@@ -1589,8 +1582,6 @@ _mesa_UseProgramObjectARB(GLhandleARB program)
struct gl_transform_feedback_object *obj =
ctx->TransformFeedback.CurrentObject;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
if (obj->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseProgram(transform feedback active)");
@@ -1737,11 +1728,7 @@ void
_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
struct gl_shader_program *shProg)
{
- bool changed;
-
- changed = use_shader_program(ctx, type, shProg);
- if (changed)
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ use_shader_program(ctx, type, shProg);
if (ctx->Driver.UseProgram)
ctx->Driver.UseProgram(ctx, shProg);