mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
[mesa.git] / src / mesa / main / fog.c
index d65add9302db4a14955ef75795e84a8dcccb9526..6aa80e858d06d8d18547cd92248c87039dedc856 100644 (file)
@@ -17,7 +17,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
@@ -97,7 +97,6 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    GLenum m;
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    switch (pname) {
       case GL_FOG_MODE:
@@ -141,6 +140,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
          update_fog_scale(ctx);
          break;
       case GL_FOG_INDEX:
+         if (ctx->API != API_OPENGL_COMPAT)
+            goto invalid_pname;
         if (ctx->Fog.Index == *params)
            return;
         FLUSH_VERTICES(ctx, _NEW_FOG);
@@ -161,7 +162,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_COMPAT || !ctx->Extensions.EXT_fog_coord ||
              (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
            _mesa_error(ctx, GL_INVALID_ENUM, "glFog");
            return;
@@ -174,7 +175,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
       }
       case GL_FOG_DISTANCE_MODE_NV: {
         GLenum p = (GLenum) (GLint) *params;
-         if (!ctx->Extensions.NV_fog_distance ||
+         if (ctx->API != API_OPENGL_COMPAT || !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;
@@ -186,13 +187,18 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
         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;
 }