-/* $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"),
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;
flag = _NEW_ARRAY_SECONDARYCOLOR;
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
return;
}
ctx->Array.NewState |= flag;
*var = state;
- if (state)
+ if (state)
ctx->Array._Enabled |= flag;
else
ctx->Array._Enabled &= ~flag;
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;
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:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5: {
GLuint p = cap-GL_CLIP_PLANE0;
-
+
if (ctx->Transform.ClipEnabled[p] == state)
return;
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;
_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;
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)
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;
}
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;
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;
_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;
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;
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;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->TexGenEnabled = newenabled;
break;
- }
+ }
break;
case GL_TEXTURE_GEN_S: {
GLuint unit = ctx->Texture.CurrentUnit;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->TexGenEnabled = newenabled;
break;
- }
+ }
break;
case GL_TEXTURE_GEN_T: {
GLuint unit = ctx->Texture.CurrentUnit;
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:
/* 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)
/* 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)
/* 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)
/* 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)
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)
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)
/* 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)
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)
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)
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)
/* 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)
break;
default:
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
}
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:
return ctx->Depth.OcclusionTest;
}
else {
- gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
}
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;
}
return ctx->Point.SpriteMode;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
}
}
-
-
-
-
-
-
-