Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / tnl / t_context.c
index dd590917701693e321300ebb16c80ffaf36a4256..ce37dc04282e12c78e50d94052ffefd96085b71e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.2
+ * Version:  7.2
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -136,11 +136,19 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX );
    }
 
-   if (ctx->Fog.Enabled ||
-       ((ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) &&
-        (ctx->FragmentProgram._Current->FogOption != GL_NONE ||
-         (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_FOGC))))
+   if (ctx->Fog.Enabled) {
+      /* fixed-function fog */
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
+   }
+   else if (ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) {
+      struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+      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)