summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/enable.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-12-26 05:09:27 +0000
committerKeith Whitwell <[email protected]>2000-12-26 05:09:27 +0000
commitcab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 (patch)
tree45385bd755d8e3876c54b2b0113636f5ceb7976a /src/mesa/main/enable.c
parentd1ff1f6798b003a820f5de9fad835ff352f31afe (diff)
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r--src/mesa/main/enable.c1289
1 files changed, 667 insertions, 622 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index bbc5070d758..7b667600053 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.36 2000/12/08 00:20:15 brianp Exp $ */
+/* $Id: enable.c,v 1.37 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,14 +44,92 @@
#endif
+static void
+client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+{
+ GLuint flag;
+ GLboolean *var;
+
+ switch (cap) {
+ case GL_VERTEX_ARRAY:
+ var = &ctx->Array.Vertex.Enabled;
+ flag = _NEW_ARRAY_VERTEX;
+ break;
+ case GL_NORMAL_ARRAY:
+ var = &ctx->Array.Normal.Enabled;
+ flag = _NEW_ARRAY_NORMAL;
+ break;
+ case GL_COLOR_ARRAY:
+ var = &ctx->Array.Color.Enabled;
+ flag = _NEW_ARRAY_COLOR;
+ break;
+ case GL_INDEX_ARRAY:
+ var = &ctx->Array.Index.Enabled;
+ flag = _NEW_ARRAY_INDEX;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
+ flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ var = &ctx->Array.EdgeFlag.Enabled;
+ flag = _NEW_ARRAY_EDGEFLAG;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ var = &ctx->Array.FogCoord.Enabled;
+ flag = _NEW_ARRAY_FOGCOORD;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ var = &ctx->Array.SecondaryColor.Enabled;
+ flag = _NEW_ARRAY_SECONDARYCOLOR;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
+ }
+
+ if (*var == flag)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.NewState |= flag;
+ *var = state;
+
+ if (state)
+ ctx->Array._Enabled |= flag;
+ else
+ ctx->Array._Enabled &= ~flag;
+
+ if (ctx->Driver.Enable) {
+ (*ctx->Driver.Enable)( ctx, cap, state );
+ }
+}
+
+
+
+void
+_mesa_EnableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_TRUE );
+}
+
+
+
+void
+_mesa_DisableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_FALSE );
+}
+
/*
* Perform glEnable and glDisable calls.
*/
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
-
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "%s %s (newstate is %x)\n",
state ? "glEnable" : "glDisable",
@@ -59,588 +137,610 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->NewState);
switch (cap) {
- case GL_ALPHA_TEST:
- if (ctx->Color.AlphaEnabled!=state) {
- ctx->Color.AlphaEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_AUTO_NORMAL:
- ctx->Eval.AutoNormal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_BLEND:
- if (ctx->Color.BlendEnabled!=state) {
- ctx->Color.BlendEnabled = state;
- /* The following needed to accomodate 1.0 RGB logic op blending */
- if (ctx->Color.BlendEquation==GL_LOGIC_OP && state) {
- ctx->Color.ColorLogicOpEnabled = GL_TRUE;
- }
- else {
- ctx->Color.ColorLogicOpEnabled = GL_FALSE;
- }
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state)
- {
- GLuint p = cap-GL_CLIP_PLANE0;
-
- ctx->Transform.ClipEnabled[p] = state;
- ctx->NewState |= _NEW_TRANSFORM;
-
- if (state) {
- ctx->_Enabled |= ENABLE_USERCLIP;
- ctx->Transform._AnyClip++;
-
- if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
- _math_matrix_analyse( &ctx->ProjectionMatrix );
- }
+ case GL_ALPHA_TEST:
+ if (ctx->Color.AlphaEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.AlphaEnabled = state;
+ break;
+ case GL_AUTO_NORMAL:
+ if (ctx->Eval.AutoNormal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.AutoNormal = state;
+ break;
+ case GL_BLEND:
+ 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.BlendEquation == GL_LOGIC_OP && state);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5: {
+ GLuint p = cap-GL_CLIP_PLANE0;
+
+ if (ctx->Transform.ClipEnabled[p] == state)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.ClipEnabled[p] = state;
+
+ if (state) {
+ ctx->_Enabled |= ENABLE_USERCLIP;
+ ctx->Transform._AnyClip++;
- /* This derived state also calculated in clip.c and
- * from gl_update_state() on changes to EyeUserPlane
- * and ctx->ProjectionMatrix respectively.
- */
- gl_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) {
- ctx->Light.ColorMaterialEnabled = state;
- ctx->NewState |= _NEW_LIGHT;
-
- if (state) {
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
- gl_update_color_material( ctx, ctx->Current.Color );
- }
- }
- break;
- case GL_CULL_FACE:
- if (ctx->Polygon.CullFlag!=state) {
- ctx->Polygon.CullFlag = state;
-/* ctx->_TriangleCaps ^= DD_TRI_CULL; */
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_DEPTH_TEST:
- if (state && ctx->Visual.DepthBits==0) {
- _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
- return;
- }
- if (ctx->Depth.Test!=state) {
- ctx->Depth.Test = state;
- ctx->NewState |= _NEW_DEPTH;
- }
- break;
- case GL_DITHER:
- if (ctx->NoDither) {
- /* MESA_NO_DITHER env var */
- state = GL_FALSE;
- }
- if (ctx->Color.DitherFlag!=state) {
- ctx->Color.DitherFlag = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_FOG:
- if (ctx->Fog.Enabled!=state) {
- ctx->Fog.Enabled = state;
- ctx->_Enabled ^= ENABLE_FOG;
- ctx->NewState |= _NEW_FOG;
- }
- break;
- case GL_HISTOGRAM:
- if (ctx->Extensions.EXT_histogram) {
- ctx->Pixel.HistogramEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) {
- ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
- if (state) {
- insert_at_tail(&ctx->Light.EnabledList,
- &ctx->Light.Light[cap-GL_LIGHT0]);
- }
- else {
- remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
- }
- ctx->NewState |= _NEW_LIGHT;
+ if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
+ _math_matrix_analyse( &ctx->ProjectionMatrix );
}
- break;
- case GL_LIGHTING:
- if (ctx->Light.Enabled!=state) {
- ctx->Light.Enabled = state;
- ctx->_Enabled &= ~ENABLE_LIGHT;
- if (state)
- ctx->_Enabled |= ENABLE_LIGHT;
- ctx->NewState |= _NEW_LIGHT;
- }
- break;
- case GL_LINE_SMOOTH:
- if (ctx->Line.SmoothFlag!=state) {
- ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
- ctx->NewState |= _NEW_LINE;
- }
- break;
- case GL_LINE_STIPPLE:
- if (ctx->Line.StippleFlag!=state) {
- ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
- ctx->NewState |= _NEW_LINE;
- }
- break;
- case GL_INDEX_LOGIC_OP:
- if (ctx->Color.IndexLogicOpEnabled!=state) {
- ctx->Color.IndexLogicOpEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_COLOR_LOGIC_OP:
- if (ctx->Color.ColorLogicOpEnabled!=state) {
- ctx->Color.ColorLogicOpEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_MAP1_COLOR_4:
- ctx->Eval.Map1Color4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_INDEX:
- ctx->Eval.Map1Index = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_NORMAL:
- ctx->Eval.Map1Normal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- ctx->Eval.Map1TextureCoord1 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- ctx->Eval.Map1TextureCoord2 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- ctx->Eval.Map1TextureCoord3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- ctx->Eval.Map1TextureCoord4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_VERTEX_3:
- ctx->Eval.Map1Vertex3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_VERTEX_4:
- ctx->Eval.Map1Vertex4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_COLOR_4:
- ctx->Eval.Map2Color4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_INDEX:
- ctx->Eval.Map2Index = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_NORMAL:
- ctx->Eval.Map2Normal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- ctx->Eval.Map2TextureCoord1 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- ctx->Eval.Map2TextureCoord2 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- ctx->Eval.Map2TextureCoord3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- ctx->Eval.Map2TextureCoord4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_VERTEX_3:
- ctx->Eval.Map2Vertex3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_VERTEX_4:
- ctx->Eval.Map2Vertex4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MINMAX:
- ctx->Pixel.MinMaxEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- break;
- case GL_NORMALIZE:
- if (ctx->Transform.Normalize != state) {
- ctx->Transform.Normalize = state;
- ctx->NewState |= _NEW_TRANSFORM;
- ctx->_Enabled ^= ENABLE_NORMALIZE;
- }
- break;
- case GL_POINT_SMOOTH:
- if (ctx->Point.SmoothFlag!=state) {
- ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
- ctx->NewState |= _NEW_POINT;
- }
- break;
- case GL_POLYGON_SMOOTH:
- if (ctx->Polygon.SmoothFlag!=state) {
- ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_STIPPLE:
- if (ctx->Polygon.StippleFlag!=state) {
- ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_POINT:
- if (ctx->Polygon.OffsetPoint!=state) {
- ctx->Polygon.OffsetPoint = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_LINE:
- if (ctx->Polygon.OffsetLine!=state) {
- ctx->Polygon.OffsetLine = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_FILL:
+
+ /* This derived state also calculated in clip.c and
+ * from gl_update_state() on changes to EyeUserPlane
+ * and ctx->ProjectionMatrix respectively.
+ */
+ gl_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)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ColorMaterialEnabled = state;
+ if (state) {
+ FLUSH_CURRENT(ctx, 0);
+ gl_update_color_material( ctx, ctx->Current.Color );
+ }
+ break;
+ case GL_CULL_FACE:
+ if (ctx->Polygon.CullFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.CullFlag = state;
+ break;
+ case GL_DEPTH_TEST:
+ if (state && ctx->Visual.DepthBits==0) {
+ _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
+ return;
+ }
+ if (ctx->Depth.Test==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Test = state;
+ break;
+ case GL_DITHER:
+ if (ctx->NoDither) {
+ state = GL_FALSE; /* MESA_NO_DITHER env var */
+ }
+ if (ctx->Color.DitherFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.DitherFlag = state;
+ break;
+ case GL_FOG:
+ 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, "enable GL_HISTOGRAM");
+ return;
+ }
+ if (ctx->Pixel.HistogramEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.HistogramEnabled = state;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
+ if (state) {
+ insert_at_tail(&ctx->Light.EnabledList,
+ &ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ else {
+ remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ break;
+ case GL_LIGHTING:
+ if (ctx->Light.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Enabled = state;
+ ctx->_Enabled ^= ENABLE_LIGHT;
+ break;
+ case GL_LINE_SMOOTH:
+ 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)
+ 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)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.IndexLogicOpEnabled = state;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ if (ctx->Color.ColorLogicOpEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.ColorLogicOpEnabled = state;
+ break;
+ case GL_MAP1_COLOR_4:
+ if (ctx->Eval.Map1Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Color4 = state;
+ break;
+ case GL_MAP1_INDEX:
+ if (ctx->Eval.Map1Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Index = state;
+ break;
+ case GL_MAP1_NORMAL:
+ if (ctx->Eval.Map1Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Normal = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ if (ctx->Eval.Map1TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord1 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ if (ctx->Eval.Map1TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord2 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ if (ctx->Eval.Map1TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord3 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ if (ctx->Eval.Map1TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord4 = state;
+ break;
+ case GL_MAP1_VERTEX_3:
+ if (ctx->Eval.Map1Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex3 = state;
+ break;
+ case GL_MAP1_VERTEX_4:
+ if (ctx->Eval.Map1Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex4 = state;
+ break;
+ case GL_MAP2_COLOR_4:
+ if (ctx->Eval.Map2Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Color4 = state;
+ break;
+ case GL_MAP2_INDEX:
+ if (ctx->Eval.Map2Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Index = state;
+ break;
+ case GL_MAP2_NORMAL:
+ if (ctx->Eval.Map2Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Normal = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ if (ctx->Eval.Map2TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord1 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ if (ctx->Eval.Map2TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord2 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ if (ctx->Eval.Map2TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord3 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ if (ctx->Eval.Map2TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord4 = state;
+ break;
+ case GL_MAP2_VERTEX_3:
+ if (ctx->Eval.Map2Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex3 = state;
+ break;
+ case GL_MAP2_VERTEX_4:
+ if (ctx->Eval.Map2Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex4 = state;
+ break;
+ case GL_MINMAX:
+ if (ctx->Pixel.MinMaxEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.MinMaxEnabled = state;
+ break;
+ case GL_NORMALIZE:
+ 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)
+ 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)
+ 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)
+ 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)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetPoint = state;
+ break;
+ case GL_POLYGON_OFFSET_LINE:
+ 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) {
- ctx->Polygon.OffsetFill = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_RESCALE_NORMAL_EXT:
- if (ctx->Transform.RescaleNormals != state) {
- ctx->Transform.RescaleNormals = state;
- ctx->NewState |= _NEW_TRANSFORM;
- ctx->_Enabled ^= ENABLE_RESCALE;
- }
- break;
- case GL_SCISSOR_TEST:
- if (ctx->Scissor.Enabled!=state) {
- ctx->Scissor.Enabled = state;
- ctx->NewState |= _NEW_SCISSOR;
- }
- break;
- case GL_SHARED_TEXTURE_PALETTE_EXT:
- ctx->Texture.SharedPalette = state;
- ctx->NewState |= _NEW_TEXTURE;
- break;
- case GL_STENCIL_TEST:
- if (state && ctx->Visual.StencilBits==0) {
- _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
- return;
- }
- if (ctx->Stencil.Enabled!=state) {
- ctx->Stencil.Enabled = state;
- ctx->NewState |= _NEW_STENCIL;
- ctx->_TriangleCaps ^= DD_STENCIL;
- }
- break;
- case GL_TEXTURE_1D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_1D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_1D;
- }
- }
- break;
- case GL_TEXTURE_2D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_2D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_2D;
- }
- }
- break;
- case GL_TEXTURE_3D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_3D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_3D;
- }
- }
- break;
- case GL_TEXTURE_GEN_Q:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= Q_BIT;
- else
- texUnit->TexGenEnabled &= ~Q_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_R:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= R_BIT;
- else
- texUnit->TexGenEnabled &= ~R_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_S:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= S_BIT;
- else
- texUnit->TexGenEnabled &= ~S_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_T:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= T_BIT;
- else
- texUnit->TexGenEnabled &= ~T_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
-
- /*
- * CLIENT STATE!!!
- */
- case GL_VERTEX_ARRAY:
- ctx->Array.Vertex.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_NORMAL_ARRAY:
- ctx->Array.Normal.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_COLOR_ARRAY:
- ctx->Array.Color.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_INDEX_ARRAY:
- ctx->Array.Index.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_EDGE_FLAG_ARRAY:
- ctx->Array.EdgeFlag.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
+ 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)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.RescaleNormals = state;
+ ctx->_Enabled ^= ENABLE_RESCALE;
+ break;
+ case GL_SCISSOR_TEST:
+ if (ctx->Scissor.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+ ctx->Scissor.Enabled = state;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ if (ctx->Texture.SharedPalette == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.SharedPalette = state;
+ break;
+ case GL_STENCIL_TEST:
+ if (state && ctx->Visual.StencilBits==0) {
+ _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
+ return;
+ }
+ 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)
+ newenabled |= TEXTURE0_1D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_2D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D;
+ if (state)
+ newenabled |= TEXTURE0_2D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_3D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D;
+ if (state)
+ newenabled |= TEXTURE0_3D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_Q: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
+ if (state)
+ newenabled |= Q_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_R: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
+ if (state)
+ newenabled |= R_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+ case GL_TEXTURE_GEN_S: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
+ if (state)
+ newenabled |= S_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+ case GL_TEXTURE_GEN_T: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
+ if (state)
+ newenabled |= T_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+
+ /*
+ * CLIENT STATE!!!
+ */
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ client_state( ctx, cap, state );
+ return;
/* GL_HP_occlusion_test */
- case GL_OCCLUSION_TEST_HP:
- if (ctx->Extensions.HP_occlusion_test) {
- ctx->Depth.OcclusionTest = state;
- ctx->NewState |= _NEW_DEPTH;
- if (state)
- ctx->OcclusionResult = ctx->OcclusionResultSaved;
- else
- ctx->OcclusionResultSaved = ctx->OcclusionResult;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_OCCLUSION_TEST_HP:
+ if (!ctx->Extensions.HP_occlusion_test) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Depth.OcclusionTest == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.OcclusionTest = state;
+ if (state)
+ ctx->OcclusionResult = ctx->OcclusionResultSaved;
+ else
+ ctx->OcclusionResultSaved = ctx->OcclusionResult;
+ break;
/* GL_SGIS_pixel_texture */
- case GL_PIXEL_TEXTURE_SGIS:
- if (ctx->Extensions.SGIS_pixel_texture) {
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_PIXEL_TEXTURE_SGIS:
+ if (!ctx->Extensions.SGIS_pixel_texture) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
/* GL_SGIX_pixel_texture */
- case GL_PIXEL_TEX_GEN_SGIX:
- if (ctx->Extensions.SGIX_pixel_texture) {
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_PIXEL_TEX_GEN_SGIX:
+ if (!ctx->Extensions.SGIX_pixel_texture) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
/* GL_SGI_color_table */
- case GL_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.ColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_color_table) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ 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" );
+ return;
+ }
+ if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ 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" );
+ return;
+ }
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ break;
/* GL_EXT_convolution */
- case GL_CONVOLUTION_1D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Convolution1DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
- case GL_CONVOLUTION_2D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Convolution2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
- case GL_SEPARABLE_2D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Separable2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
+ case GL_CONVOLUTION_1D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Convolution1DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution1DEnabled = state;
+ break;
+ case GL_CONVOLUTION_2D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Convolution2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution2DEnabled = state;
+ break;
+ case GL_SEPARABLE_2D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Separable2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Separable2DEnabled = state;
+ break;
/* GL_ARB_texture_cube_map */
- case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->Extensions.ARB_texture_cube_map) {
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_CUBE;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_CUBE;
- }
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
-
+ case GL_TEXTURE_CUBE_MAP_ARB: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE;
+ if (state)
+ newenabled |= TEXTURE0_CUBE;
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
/* GL_EXT_secondary_color */
- case GL_COLOR_SUM_EXT:
- if (ctx->Extensions.EXT_secondary_color) {
- ctx->Fog.ColorSumEnabled = state;
- if (state)
- SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
- CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- ctx->NewState |= _NEW_FOG;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
+ case GL_COLOR_SUM_EXT:
+ if (!ctx->Extensions.EXT_secondary_color) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Fog.ColorSumEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.ColorSumEnabled = state;
+ ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR;
+ break;
/* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- if (ctx->Extensions.MESA_sprite_point) {
- ctx->Point.SpriteMode = state;
- ctx->NewState |= _NEW_POINT;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
-
- default:
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
+ case GL_SPRITE_POINT_MESA:
+ if (!ctx->Extensions.MESA_sprite_point) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Point.SpriteMode == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteMode = state;
+ break;
+
+ default:
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
}
if (ctx->Driver.Enable) {
@@ -895,61 +995,6 @@ _mesa_IsEnabled( GLenum cap )
-static void
-client_state( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx,
- (state
- ? "glEnableClientState"
- : "glDisableClientState") );
-
- switch (cap) {
- case GL_VERTEX_ARRAY:
- ctx->Array.Vertex.Enabled = state;
- break;
- case GL_NORMAL_ARRAY:
- ctx->Array.Normal.Enabled = state;
- break;
- case GL_COLOR_ARRAY:
- ctx->Array.Color.Enabled = state;
- break;
- case GL_INDEX_ARRAY:
- ctx->Array.Index.Enabled = state;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
- break;
- case GL_EDGE_FLAG_ARRAY:
- ctx->Array.EdgeFlag.Enabled = state;
- break;
- case GL_FOG_COORDINATE_ARRAY_EXT:
- ctx->Array.FogCoord.Enabled = state;
- break;
- case GL_SECONDARY_COLOR_ARRAY_EXT:
- ctx->Array.SecondaryColor.Enabled = state;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
- }
-
- ctx->NewState |= _NEW_ARRAY;
-}
-
-void
-_mesa_EnableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_TRUE );
-}
-
-
-
-void
-_mesa_DisableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_FALSE );
-}