Fix minor fog / fragment program state bug.
Don't add diffuse and specular colors when using fragment program.
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 87d4bf8..e9755e9 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -196,19 +196,22 @@
    CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[GCOMP], ctx->Fog.Color[GCOMP]);
    CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[BCOMP], ctx->Fog.Color[BCOMP]);
 
-   /* determine if fog is needed */
+   /* determine if fog is needed, and if so, which fog mode */
    swrast->_FogEnabled = GL_FALSE;
-   if (ctx->Fog.Enabled) {
-      swrast->_FogEnabled = GL_TRUE;
-   }
-   else if (ctx->FragmentProgram._Enabled &&
-        ctx->FragmentProgram.Current->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
-      const struct fragment_program *p;
-      p = (struct fragment_program *) ctx->FragmentProgram.Current;
-      if (p->FogOption != GL_NONE) {
-         swrast->_FogEnabled = GL_TRUE;
+   if (ctx->FragmentProgram._Enabled) {
+      if (ctx->FragmentProgram.Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) {
+         const struct fragment_program *p
+            = (struct fragment_program *) ctx->FragmentProgram.Current;
+         if (p->FogOption != GL_NONE) {
+            swrast->_FogEnabled = GL_TRUE;
+            swrast->_FogMode = p->FogOption;
+         }
       }
    }
+   else if (ctx->Fog.Enabled) {
+      swrast->_FogEnabled = GL_TRUE;
+      swrast->_FogMode = ctx->Fog.Mode;
+   }
 }
 
 
@@ -480,7 +483,7 @@
       if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE)
 	 _swrast_update_texture_env( ctx );
 
-      if (swrast->NewState & _NEW_FOG)
+      if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM))
          _swrast_update_fog_state( ctx );
 
       if (swrast->NewState & _NEW_PROGRAM)
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index ea877a4..aba3275 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -286,6 +286,7 @@
    GLboolean _AnyTextureCombine;
    GLchan _FogColor[3];
    GLboolean _FogEnabled;
+   GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
 
    /* Accum buffer temporaries.
     */
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 89ed115..613759d 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -1,9 +1,8 @@
-
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  6.3
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2004  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"),
@@ -34,8 +33,6 @@
 #include "s_span.h"
 
 
-
-
 /**
  * Used to convert current raster distance to a fog factor in [0,1].
  */
@@ -99,7 +96,7 @@
       /* The span's fog values are fog coordinates, now compute blend factors
        * and blend the fragment colors with the fog color.
        */
-      switch (ctx->Fog.Mode) {
+      switch (swrast->_FogMode) {
       case GL_LINEAR:
          {
             const GLfloat fogEnd = ctx->Fog.End;
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index c4a86f1..247c7ee 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.1
+ * Version:  6.3
  *
  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
  *
@@ -1473,15 +1473,17 @@
 
    ASSERT(span->arrayMask & SPAN_RGBA);
 
-   /* Add base and specular colors */
-   if (ctx->Fog.ColorSumEnabled ||
-       (ctx->Light.Enabled &&
-        ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
-      if (span->interpMask & SPAN_SPEC) {
-         interpolate_specular(ctx, span);
+   if (!ctx->FragmentProgram._Enabled) {
+      /* Add base and specular colors */
+      if (ctx->Fog.ColorSumEnabled ||
+          (ctx->Light.Enabled &&
+           ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
+         if (span->interpMask & SPAN_SPEC) {
+            interpolate_specular(ctx, span);
+         }
+         ASSERT(span->arrayMask & SPAN_SPEC);
+         add_colors( span->end, span->array->rgba, span->array->spec );
       }
-      ASSERT(span->arrayMask & SPAN_SPEC);
-      add_colors( span->end, span->array->rgba, span->array->spec );
    }
 
    /* Fog */