GL_INTENSITY case was incorrect in extract_float_rgba()
[mesa.git] / src / mesa / main / enable.c
index f1870415f30c32c48c2ebb856d7321524531aea3..173b4b0f227ed2b57cf440dea4558b88c1a02337 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: enable.c,v 1.42 2001/02/16 18:14:41 keithw Exp $ */
+/* $Id: enable.c,v 1.48 2001/03/29 21:16:25 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.5
  *
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2001  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"),
@@ -67,7 +67,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state )
       var = &ctx->Array.Index.Enabled;
       flag = _NEW_ARRAY_INDEX;
       break;
-   case GL_TEXTURE_COORD_ARRAY: 
+   case GL_TEXTURE_COORD_ARRAY:
       var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
       flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
       break;
@@ -84,7 +84,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state )
       flag = _NEW_ARRAY_SECONDARYCOLOR;
       break;
    default:
-      gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
       return;
    }
 
@@ -95,7 +95,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state )
    ctx->Array.NewState |= flag;
    *var = state;
 
-   if (state) 
+   if (state)
       ctx->Array._Enabled |= flag;
    else
       ctx->Array._Enabled &= ~flag;
@@ -134,12 +134,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
    if (MESA_VERBOSE & VERBOSE_API)
       fprintf(stderr, "%s %s (newstate is %x)\n",
              state ? "glEnable" : "glDisable",
-             gl_lookup_enum_by_nr(cap),
+             _mesa_lookup_enum_by_nr(cap),
              ctx->NewState);
 
    switch (cap) {
    case GL_ALPHA_TEST:
-      if (ctx->Color.AlphaEnabled == state) 
+      if (ctx->Color.AlphaEnabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_COLOR);
       ctx->Color.AlphaEnabled = state;
@@ -151,13 +151,13 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Eval.AutoNormal = state;
       break;
    case GL_BLEND:
-      if (ctx->Color.BlendEnabled == state) 
+      if (ctx->Color.BlendEnabled == state)
         return;
 
       FLUSH_VERTICES(ctx, _NEW_COLOR);
       ctx->Color.BlendEnabled = state;
       /* The following needed to accomodate 1.0 RGB logic op blending */
-      ctx->Color.ColorLogicOpEnabled = 
+      ctx->Color.ColorLogicOpEnabled =
         (ctx->Color.BlendEquation == GL_LOGIC_OP && state);
       break;
    case GL_CLIP_PLANE0:
@@ -167,7 +167,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
    case GL_CLIP_PLANE4:
    case GL_CLIP_PLANE5: {
       GLuint p = cap-GL_CLIP_PLANE0;
-        
+
       if (ctx->Transform.ClipEnabled[p] == state)
         return;
 
@@ -175,38 +175,34 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Transform.ClipEnabled[p] = state;
 
       if (state) {
-        ctx->_Enabled |= ENABLE_USERCLIP;
         ctx->Transform._AnyClip++;
-       
+
         if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
            _math_matrix_analyse( &ctx->ProjectionMatrix );
         }
-       
+
         /* This derived state also calculated in clip.c and
-         * from gl_update_state() on changes to EyeUserPlane
+         * from _mesa_update_state() on changes to EyeUserPlane
          * and ctx->ProjectionMatrix respectively.
          */
-        gl_transform_vector( ctx->Transform._ClipUserPlane[p],
+        _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
                              ctx->Transform.EyeUserPlane[p],
                              ctx->ProjectionMatrix.inv );
-      } else {
-        if (--ctx->Transform._AnyClip == 0)
-           ctx->_Enabled &= ~ENABLE_USERCLIP;  
-      }        
+      }
    }
    break;
    case GL_COLOR_MATERIAL:
-      if (ctx->Light.ColorMaterialEnabled == state) 
+      if (ctx->Light.ColorMaterialEnabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
       ctx->Light.ColorMaterialEnabled = state;
       if (state) {
         FLUSH_CURRENT(ctx, 0);
-        gl_update_color_material( ctx, ctx->Current.Color );
+        _mesa_update_color_material( ctx, ctx->Current.Color );
       }
       break;
    case GL_CULL_FACE:
-      if (ctx->Polygon.CullFlag == state) 
+      if (ctx->Polygon.CullFlag == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.CullFlag = state;
@@ -216,7 +212,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
         _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
         return;
       }
-      if (ctx->Depth.Test==state) 
+      if (ctx->Depth.Test==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_DEPTH);
       ctx->Depth.Test = state;
@@ -225,21 +221,20 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       if (ctx->NoDither) {
         state = GL_FALSE; /* MESA_NO_DITHER env var */
       }
-      if (ctx->Color.DitherFlag==state) 
+      if (ctx->Color.DitherFlag==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_COLOR);
       ctx->Color.DitherFlag = state;
       break;
    case GL_FOG:
-      if (ctx->Fog.Enabled==state) 
+      if (ctx->Fog.Enabled==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_FOG);
       ctx->Fog.Enabled = state;
-      ctx->_Enabled ^= ENABLE_FOG;
       break;
    case GL_HISTOGRAM:
-      if (!ctx->Extensions.EXT_histogram) {
-        gl_error(ctx, GL_INVALID_ENUM, "glEnable(GL_HISTOGRAM)");
+      if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
+        _mesa_error(ctx, GL_INVALID_ENUM, "glEnable(GL_HISTOGRAM)");
         return;
       }
       if (ctx->Pixel.HistogramEnabled == state)
@@ -255,7 +250,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
    case GL_LIGHT5:
    case GL_LIGHT6:
    case GL_LIGHT7:
-      if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) 
+      if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
       ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
@@ -268,42 +263,41 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       }
       break;
    case GL_LIGHTING:
-      if (ctx->Light.Enabled == state) 
+      if (ctx->Light.Enabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
       ctx->Light.Enabled = state;
-      ctx->_Enabled ^= ENABLE_LIGHT;
 
       if ((ctx->Light.Enabled &&
           ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
          || ctx->Fog.ColorSumEnabled)
-        ctx->_TriangleCaps |= DD_SEPERATE_SPECULAR; 
+        ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
       else
-        ctx->_TriangleCaps &= ~DD_SEPERATE_SPECULAR; 
+        ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
 
       break;
    case GL_LINE_SMOOTH:
-      if (ctx->Line.SmoothFlag == state) 
+      if (ctx->Line.SmoothFlag == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_LINE);
       ctx->Line.SmoothFlag = state;
       ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
       break;
    case GL_LINE_STIPPLE:
-      if (ctx->Line.StippleFlag == state) 
+      if (ctx->Line.StippleFlag == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_LINE);
       ctx->Line.StippleFlag = state;
       ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
       break;
    case GL_INDEX_LOGIC_OP:
-      if (ctx->Color.IndexLogicOpEnabled == state) 
+      if (ctx->Color.IndexLogicOpEnabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_COLOR);
       ctx->Color.IndexLogicOpEnabled = state;
       break;
    case GL_COLOR_LOGIC_OP:
-      if (ctx->Color.ColorLogicOpEnabled == state) 
+      if (ctx->Color.ColorLogicOpEnabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_COLOR);
       ctx->Color.ColorLogicOpEnabled = state;
@@ -423,61 +417,59 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Pixel.MinMaxEnabled = state;
       break;
    case GL_NORMALIZE:
-      if (ctx->Transform.Normalize == state) 
+      if (ctx->Transform.Normalize == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
       ctx->Transform.Normalize = state;
-      ctx->_Enabled ^= ENABLE_NORMALIZE;
       break;
    case GL_POINT_SMOOTH:
-      if (ctx->Point.SmoothFlag==state) 
+      if (ctx->Point.SmoothFlag==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POINT);
       ctx->Point.SmoothFlag = state;
       ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
       break;
    case GL_POLYGON_SMOOTH:
-      if (ctx->Polygon.SmoothFlag==state) 
+      if (ctx->Polygon.SmoothFlag==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.SmoothFlag = state;
       ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
       break;
    case GL_POLYGON_STIPPLE:
-      if (ctx->Polygon.StippleFlag==state) 
+      if (ctx->Polygon.StippleFlag==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.StippleFlag = state;
       ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
       break;
    case GL_POLYGON_OFFSET_POINT:
-      if (ctx->Polygon.OffsetPoint==state) 
+      if (ctx->Polygon.OffsetPoint==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.OffsetPoint = state;
       break;
    case GL_POLYGON_OFFSET_LINE:
-      if (ctx->Polygon.OffsetLine==state) 
+      if (ctx->Polygon.OffsetLine==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.OffsetLine = state;
       break;
    case GL_POLYGON_OFFSET_FILL:
       /*case GL_POLYGON_OFFSET_EXT:*/
-      if (ctx->Polygon.OffsetFill==state) 
+      if (ctx->Polygon.OffsetFill==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_POLYGON);
       ctx->Polygon.OffsetFill = state;
       break;
    case GL_RESCALE_NORMAL_EXT:
-      if (ctx->Transform.RescaleNormals == state) 
+      if (ctx->Transform.RescaleNormals == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
       ctx->Transform.RescaleNormals = state;
-      ctx->_Enabled ^= ENABLE_RESCALE;
       break;
    case GL_SCISSOR_TEST:
-      if (ctx->Scissor.Enabled==state) 
+      if (ctx->Scissor.Enabled==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_SCISSOR);
       ctx->Scissor.Enabled = state;
@@ -493,17 +485,16 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
         _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
         return;
       }
-      if (ctx->Stencil.Enabled==state) 
+      if (ctx->Stencil.Enabled==state)
         return;
       FLUSH_VERTICES(ctx, _NEW_STENCIL);
       ctx->Stencil.Enabled = state;
-      ctx->_TriangleCaps ^= DD_STENCIL;
       break;
    case GL_TEXTURE_1D: {
       const GLuint curr = ctx->Texture.CurrentUnit;
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
       GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D;
-      if (state) 
+      if (state)
         newenabled |= TEXTURE0_1D;
       if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
         return;
@@ -515,7 +506,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       const GLuint curr = ctx->Texture.CurrentUnit;
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
       GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D;
-      if (state) 
+      if (state)
         newenabled |= TEXTURE0_2D;
       if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
         return;
@@ -527,7 +518,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       const GLuint curr = ctx->Texture.CurrentUnit;
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
       GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D;
-      if (state) 
+      if (state)
         newenabled |= TEXTURE0_3D;
       if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
         return;
@@ -558,7 +549,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       FLUSH_VERTICES(ctx, _NEW_TEXTURE);
       texUnit->TexGenEnabled = newenabled;
       break;
-   }  
+   }
    break;
    case GL_TEXTURE_GEN_S: {
       GLuint unit = ctx->Texture.CurrentUnit;
@@ -571,7 +562,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       FLUSH_VERTICES(ctx, _NEW_TEXTURE);
       texUnit->TexGenEnabled = newenabled;
       break;
-   }   
+   }
    break;
    case GL_TEXTURE_GEN_T: {
       GLuint unit = ctx->Texture.CurrentUnit;
@@ -594,7 +585,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
    case GL_NORMAL_ARRAY:
    case GL_COLOR_ARRAY:
    case GL_INDEX_ARRAY:
-   case GL_TEXTURE_COORD_ARRAY: 
+   case GL_TEXTURE_COORD_ARRAY:
    case GL_EDGE_FLAG_ARRAY:
    case GL_FOG_COORDINATE_ARRAY_EXT:
    case GL_SECONDARY_COLOR_ARRAY_EXT:
@@ -604,7 +595,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       /* GL_HP_occlusion_test */
    case GL_OCCLUSION_TEST_HP:
       if (!ctx->Extensions.HP_occlusion_test) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Depth.OcclusionTest == state)
@@ -620,7 +611,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       /* GL_SGIS_pixel_texture */
    case GL_PIXEL_TEXTURE_SGIS:
       if (!ctx->Extensions.SGIS_pixel_texture) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Pixel.PixelTextureEnabled == state)
@@ -632,7 +623,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       /* GL_SGIX_pixel_texture */
    case GL_PIXEL_TEX_GEN_SGIX:
       if (!ctx->Extensions.SGIX_pixel_texture) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Pixel.PixelTextureEnabled == state)
@@ -643,8 +634,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
 
       /* GL_SGI_color_table */
    case GL_COLOR_TABLE_SGI:
-      if (!ctx->Extensions.SGI_color_table) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+      if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) {
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Pixel.ColorTableEnabled == state)
@@ -653,8 +644,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Pixel.ColorTableEnabled = state;
       break;
    case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
-      if (!ctx->Extensions.SGI_color_table) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+      if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) {
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
@@ -663,8 +654,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Pixel.PostConvolutionColorTableEnabled = state;
       break;
    case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
-      if (!ctx->Extensions.SGI_color_table) {
-        gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+      if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) {
+        _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
         return;
       }
       if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
@@ -675,8 +666,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
 
       /* GL_EXT_convolution */
    case GL_CONVOLUTION_1D:
-      if (!ctx->Extensions.EXT_convolution) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+      if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) {
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (ctx->Pixel.Convolution1DEnabled == state)
@@ -685,8 +676,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Pixel.Convolution1DEnabled = state;
       break;
    case GL_CONVOLUTION_2D:
-      if (!ctx->Extensions.EXT_convolution) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+      if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) {
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (ctx->Pixel.Convolution2DEnabled == state)
@@ -695,8 +686,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       ctx->Pixel.Convolution2DEnabled = state;
       break;
    case GL_SEPARABLE_2D:
-      if (!ctx->Extensions.EXT_convolution) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+      if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) {
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (ctx->Pixel.Separable2DEnabled == state)
@@ -710,10 +701,10 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       const GLuint curr = ctx->Texture.CurrentUnit;
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
       GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE;
-      if (state) 
+      if (state)
         newenabled |= TEXTURE0_CUBE;
       if (!ctx->Extensions.ARB_texture_cube_map) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
@@ -725,27 +716,27 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       /* GL_EXT_secondary_color */
    case GL_COLOR_SUM_EXT:
       if (!ctx->Extensions.EXT_secondary_color) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (ctx->Fog.ColorSumEnabled == state)
         return;
       FLUSH_VERTICES(ctx, _NEW_FOG);
       ctx->Fog.ColorSumEnabled = state;
-      
+
       if ((ctx->Light.Enabled &&
           ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
          || ctx->Fog.ColorSumEnabled)
-        ctx->_TriangleCaps |= DD_SEPERATE_SPECULAR; 
+        ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
       else
-        ctx->_TriangleCaps &= ~DD_SEPERATE_SPECULAR; 
+        ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
 
       break;
 
       /* GL_MESA_sprite_point */
    case GL_SPRITE_POINT_MESA:
       if (!ctx->Extensions.MESA_sprite_point) {
-        gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+        _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
         return;
       }
       if (ctx->Point.SpriteMode == state)
@@ -755,7 +746,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       break;
 
    default:
-      gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+      _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
       return;
    }
 
@@ -818,11 +809,11 @@ _mesa_IsEnabled( GLenum cap )
       case GL_FOG:
         return ctx->Fog.Enabled;
       case GL_HISTOGRAM:
-         if (ctx->Extensions.EXT_histogram) {
+         if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) {
             return ctx->Pixel.HistogramEnabled;
          }
          else {
-            gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+            _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
             return GL_FALSE;
          }
       case GL_LIGHTING:
@@ -963,7 +954,7 @@ _mesa_IsEnabled( GLenum cap )
             return ctx->Depth.OcclusionTest;
          }
          else {
-            gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+            _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
             return GL_FALSE;
          }
 
@@ -998,7 +989,7 @@ _mesa_IsEnabled( GLenum cap )
             return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE;
          }
          else {
-            gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+            _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
             return GL_FALSE;
          }
 
@@ -1007,14 +998,7 @@ _mesa_IsEnabled( GLenum cap )
          return ctx->Point.SpriteMode;
 
       default:
-        gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+        _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
         return GL_FALSE;
    }
 }
-
-
-
-
-
-
-