diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-19 21:39:50 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-19 21:39:50 +0000 |
commit | 527be7b2878f024f572a230b499f11ef1a62f8bf (patch) | |
tree | f114820c9f82f4345d14cdadf6a5ae130246d790 | |
parent | 33c201791f1fede943ef5b38457deee74556ad39 (diff) |
make sure bindprogram notifications are made when texenvprogram active
-rw-r--r-- | src/mesa/main/state.c | 27 |
1 files 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; } + } |