From d348b0c72d41603178c0923e276869c7280904c7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Nov 2010 11:43:45 -0700 Subject: 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. --- src/mesa/main/shaderapi.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/mesa/main') 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); -- cgit v1.2.3