From 527be7b2878f024f572a230b499f11ef1a62f8bf Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 19 Mar 2007 21:39:50 +0000 Subject: make sure bindprogram notifications are made when texenvprogram active --- src/mesa/main/state.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 55fb4552d2..449b85a781 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -943,6 +943,7 @@ update_arrays( GLcontext *ctx ) static void update_program(GLcontext *ctx) { + /* For now, just set the _Enabled (really enabled) flags. * In the future we may have to check other state to be sure we really * have a runable program or shader. @@ -954,20 +955,24 @@ update_program(GLcontext *ctx) ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled && ctx->ATIFragmentShader.Current->Instructions; - ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; - ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; + if (ctx->_UseTexEnvProgram) { + const struct gl_fragment_program *prev = ctx->FragmentProgram._Current; - if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) { -#if 0 - if (!ctx->_TexEnvProgram) - ctx->_TexEnvProgram = (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - ctx->FragmentProgram._Current = ctx->_TexEnvProgram; -#endif + ctx->FragmentProgram._Active = GL_TRUE; - if (ctx->_UseTexEnvProgram) - ctx->FragmentProgram._Active = GL_TRUE; + if (ctx->FragmentProgram._Enabled) + ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + + if (ctx->FragmentProgram._Current != prev && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + (struct gl_program *) ctx->FragmentProgram._Current); + } + } + else { + ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; } + } -- cgit v1.2.3