mesa: gl_fragment_program::FogOption is always GL_NONE so don't check it
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 16 Apr 2011 01:45:06 +0000 (18:45 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 22 Apr 2011 00:33:21 +0000 (17:33 -0700)
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
src/mesa/swrast/s_context.c
src/mesa/tnl/t_context.c

index 491fcfcdbbf96f121875de620e56be5bf2e75de4..b3e39689cfa6621c8d0f0cf7e8f9f7bc6f76ed1b 100644 (file)
@@ -248,18 +248,11 @@ _swrast_update_fog_state( struct gl_context *ctx )
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
 
+   assert((fp == NULL) || (fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB));
+
    /* determine if fog is needed, and if so, which fog mode */
-   swrast->_FogEnabled = GL_FALSE;
-   if (fp && fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
-      if (fp->FogOption != GL_NONE) {
-         swrast->_FogEnabled = GL_TRUE;
-         swrast->_FogMode = fp->FogOption;
-      }
-   }
-   else if (ctx->Fog.Enabled) {
-      swrast->_FogEnabled = GL_TRUE;
-      swrast->_FogMode = ctx->Fog.Mode;
-   }
+   swrast->_FogEnabled = (fp == NULL && ctx->Fog.Enabled);
+   swrast->_FogMode = ctx->Fog.Mode;
 }
 
 
index 5f5e2663b5fd259d439d0e583136f14b52f2a78e..a6da8cafe5a9a7e1400f8fcfd31d3c40c10fb81f 100644 (file)
@@ -138,16 +138,12 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
      }
    }
 
-   if (ctx->Fog.Enabled) {
-      /* fixed-function fog */
+   if (ctx->Fog.Enabled
+       || (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) {
+      /* Either fixed-function fog or a fragment program needs fog coord.
+       */
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
    }
-   else if (fp) {
-      if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
-         /* fragment program needs fog coord */
-         RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
-      }
-   }
 
    if (ctx->Polygon.FrontMode != GL_FILL || 
        ctx->Polygon.BackMode != GL_FILL)