dispatch: stop generating separate GLES1 API code.
[mesa.git] / src / mesa / main / fog.c
index 88aa31a7fcbe0315a095a41cfac7cda92c35b67a..07405fb4b4207cc31eccd05f1e1c14a664f53967 100644 (file)
@@ -141,6 +141,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
          update_fog_scale(ctx);
          break;
       case GL_FOG_INDEX:
+         if (ctx->API != API_OPENGL)
+            goto invalid_pname;
         if (ctx->Fog.Index == *params)
            return;
         FLUSH_VERTICES(ctx, _NEW_FOG);
@@ -161,7 +163,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
          break;
       case GL_FOG_COORDINATE_SOURCE_EXT: {
         GLenum p = (GLenum) (GLint) *params;
-         if (!ctx->Extensions.EXT_fog_coord ||
+         if (ctx->API != API_OPENGL || !ctx->Extensions.EXT_fog_coord ||
              (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
            _mesa_error(ctx, GL_INVALID_ENUM, "glFog");
            return;
@@ -172,14 +174,32 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
         ctx->Fog.FogCoordinateSource = p;
         break;
       }
+      case GL_FOG_DISTANCE_MODE_NV: {
+        GLenum p = (GLenum) (GLint) *params;
+         if (ctx->API != API_OPENGL || !ctx->Extensions.NV_fog_distance ||
+             (p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {
+           _mesa_error(ctx, GL_INVALID_ENUM, "glFog");
+           return;
+        }
+        if (ctx->Fog.FogDistanceMode == p)
+           return;
+        FLUSH_VERTICES(ctx, _NEW_FOG);
+        ctx->Fog.FogDistanceMode = p;
+        break;
+      }
       default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
-         return;
+         goto invalid_pname;
    }
 
    if (ctx->Driver.Fogfv) {
       (*ctx->Driver.Fogfv)( ctx, pname, params );
    }
+
+   return;
+
+invalid_pname:
+   _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
+   return;
 }
 
 
@@ -201,4 +221,5 @@ void _mesa_init_fog( struct gl_context * ctx )
    ctx->Fog.ColorSumEnabled = GL_FALSE;
    ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
    ctx->Fog._Scale = 1.0f;
+   ctx->Fog.FogDistanceMode = GL_EYE_PLANE_ABSOLUTE_NV;
 }