Mesa (master): mesa: gl_fragment_program:: FogOption is always GL_NONE so don't check it

Ian Romanick idr at kemper.freedesktop.org
Thu Apr 21 17:34:36 PDT 2011


Module: Mesa
Branch: master
Commit: f0188d4b08b84aa72c6d8148ca94e40d665c7b68
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0188d4b08b84aa72c6d8148ca94e40d665c7b68

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Apr 15 18:45:06 2011 -0700

mesa: gl_fragment_program::FogOption is always GL_NONE so don't check it

Reviewed-by: Eric Anholt <eric at anholt.net>
Acked-by: Corbin Simpson <MostAwesomeDude at gmail.com>
Acked-by: Alex Deucher <alexdeucher at gmail.com>

---

 src/mesa/swrast/s_context.c |   15 ++++-----------
 src/mesa/tnl/t_context.c    |   12 ++++--------
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 491fcfc..b3e3968 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -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;
 }
 
 
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 5f5e266..a6da8ca 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -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)



More information about the mesa-commit mailing list