mesa: Remove _Active and _UseTexEnvProgram flags from fragment programs.
authorEric Anholt <eric@anholt.net>
Wed, 7 Jan 2009 22:09:07 +0000 (14:09 -0800)
committerAlan Hourihane <alanh@vmware.com>
Fri, 9 Jan 2009 11:16:39 +0000 (11:16 +0000)
There was a note in state.c about _Active deserving to die, and there were
potential issues with it due to i965 forgetting to set _UseTexEnvProgram.
Removing both simplifies things.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/dri/i915/i915_context.c
src/mesa/drivers/dri/i915/i915_state.c
src/mesa/drivers/dri/intel/intel_pixel_draw.c
src/mesa/main/context.c
src/mesa/main/mtypes.h
src/mesa/main/state.c
src/mesa/swrast/s_aalinetemp.h
src/mesa/tnl/t_context.c

index 9bff74294d859f3f6175b0acc1c5ac14786c7450..3d6af38057e5bd3c5d9f706410348c4fe7d2c67b 100644 (file)
@@ -171,7 +171,6 @@ i915CreateContext(const __GLcontextModes * mesaVis,
    ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
 
    ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
-   ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
 
    driInitExtensions(ctx, i915_extensions, GL_FALSE);
 
index 9d04358e4f300fde3e1d8e9915ea8b2dcd447795..a53f120a817371f085db42590fc1f737e80cc46a 100644 (file)
@@ -569,7 +569,7 @@ i915_update_fog(GLcontext * ctx)
    GLboolean enabled;
    GLboolean try_pixel_fog;
 
-   if (ctx->FragmentProgram._Active) {
+   if (ctx->FragmentProgram._Current) {
       /* Pull in static fog state from program */
       mode = ctx->FragmentProgram._Current->FogOption;
       enabled = (mode != GL_NONE);
index 0d66935ad278b6d79058bf64f545ff88cbf48d43..2af839b803125b30f76569b802c9cad2d82b4317 100644 (file)
@@ -386,27 +386,6 @@ intelDrawPixels(GLcontext * ctx,
    if (INTEL_DEBUG & DEBUG_PIXEL)
       _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
 
-   if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
-      /*
-       * We don't want the i915 texenv program to be applied to DrawPixels.
-       * This is really just a performance optimization (mesa will other-
-       * wise happily run the fragment program on each pixel in the image).
-       */
-      struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
-   /* can't just set current frag prog to 0 here as on buffer resize
-      we'll get new state checks which will segfault. Remains a hack. */
-      ctx->FragmentProgram._Current = NULL;
-      ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE;
-      ctx->FragmentProgram._Active = GL_FALSE;
-      _swrast_DrawPixels( ctx, x, y, width, height, format, type,
-                          unpack, pixels );
-      ctx->FragmentProgram._Current = fpSave;
-      ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
-      ctx->FragmentProgram._Active = GL_TRUE;
-      _swrast_InvalidateState(ctx, _NEW_PROGRAM);
-   }
-   else {
-      _swrast_DrawPixels( ctx, x, y, width, height, format, type,
-                          unpack, pixels );
-   }
+   _swrast_DrawPixels(ctx, x, y, width, height, format, type,
+                     unpack, pixels);
 }
index ea52b26f0f7ccb5bd491f396c96c3c540a70b866..82996282181b810e78e8b4cb179d816fe6c04a80 100644 (file)
@@ -1226,7 +1226,6 @@ _mesa_initialize_context(GLcontext *ctx,
 
    ctx->FragmentProgram._MaintainTexEnvProgram
       = (_mesa_getenv("MESA_TEX_PROG") != NULL);
-   ctx->FragmentProgram._UseTexEnvProgram = ctx->FragmentProgram._MaintainTexEnvProgram;
 
    ctx->VertexProgram._MaintainTnlProgram
       = (_mesa_getenv("MESA_TNL_PROG") != NULL);
index a17bf9c7b0c0d03e44753e7a63c77b120d2b3c5f..25dee52ad07e080c9b5140491348aa6d72e2f738 100644 (file)
@@ -2014,8 +2014,6 @@ struct gl_fragment_program_state
 
    /** Should fixed-function texturing be implemented with a fragment prog? */
    GLboolean _MaintainTexEnvProgram;
-   GLboolean _UseTexEnvProgram;
-   GLboolean _Active;     /**< Use internal texenv program? */
 
    /** Program to emulate fixed-function texture env/combine (see above) */
    struct gl_fragment_program *_TexEnvProgram;
index 3c111759d272a2e1ebc208ca21145bfec92a9799..718cd9984767653dbc657df3c628a00f45a64122 100644 (file)
@@ -254,17 +254,6 @@ update_program(GLcontext *ctx)
       _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
    }
 
-   /* XXX: get rid of _Active flag.
-    */
-#if 1
-   ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
-   if (ctx->FragmentProgram._MaintainTexEnvProgram &&
-       !ctx->FragmentProgram._Enabled) {
-      if (ctx->FragmentProgram._UseTexEnvProgram)
-        ctx->FragmentProgram._Active = GL_TRUE;
-   }
-#endif
-
    /* Let the driver know what's happening:
     */
    if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
index ca08203d8315178b555cc6e1aa067dc8252a59b5..42ffe9f20c1164b0c75b0037e1915bc2d297bf73 100644 (file)
@@ -76,7 +76,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
    ATTRIB_LOOP_BEGIN
       GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
       if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0
-          && !ctx->FragmentProgram._Active) {
+          && !ctx->FragmentProgram._Current) {
          /* texcoord w/ divide by Q */
          const GLuint unit = attr - FRAG_ATTRIB_TEX0;
          const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]);
index ce37dc04282e12c78e50d94052ffefd96085b71e..fdf4534b360636a23581e65865766d1a10313b4f 100644 (file)
@@ -140,7 +140,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
       /* fixed-function fog */
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
    }
-   else if (ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) {
+   else if (ctx->FragmentProgram._Current) {
       struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
       if (fp) {
          if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {