[Mesa-dev] [PATCH 1/2] mesa: Make sure _TexEnvProgram points at the current ff fragment program

Ian Romanick idr at freedesktop.org
Thu Jan 19 17:53:11 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

At least one place, the _mesa_need_secondary_color function in
state.h, uses this to make decisions.  The next patch in this series
will add another dependency.  Ideally, this field would go away and be
replace by a flag or something.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/state.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index b910543..c59eff7 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -259,6 +259,8 @@ update_program(struct gl_context *ctx)
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
 			       (struct gl_fragment_program *)
 			       fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+			       NULL);
    }
    else if (ctx->FragmentProgram._Enabled) {
       /* Use user-defined fragment program */
@@ -267,6 +269,8 @@ update_program(struct gl_context *ctx)
 				     NULL);
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
                                ctx->FragmentProgram.Current);
+      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+			       NULL);
    }
    else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
       /* Use fragment program generated from fixed-function state */
@@ -278,10 +282,15 @@ update_program(struct gl_context *ctx)
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
 			       (struct gl_fragment_program *)
                                f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+			       (struct gl_fragment_program *)
+                               f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
    }
    else {
       /* No fragment program */
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
+      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+			       NULL);
    }
 
    if (gsProg && gsProg->LinkStatus
-- 
1.7.6.4



More information about the mesa-dev mailing list