removed ctx->Texture.Enabled, use ctx->Texture.ReallyEnabled instead

This commit is contained in:
Brian Paul
2000-09-28 22:44:30 +00:00
parent 37a6211795
commit eb6c6439ae
9 changed files with 181 additions and 151 deletions

View File

@@ -1511,7 +1511,7 @@ static void SetRenderStates( GLcontext *ctx )
/*================================================*/ /*================================================*/
/* Check too see if there are new TEXTURE states. */ /* Check too see if there are new TEXTURE states. */
/*================================================*/ /*================================================*/
if ( ctx->Texture.Enabled ) if ( ctx->Texture.ReallyEnabled )
{ {
switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode ) switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
{ {
@@ -1871,9 +1871,9 @@ static void DebugRenderStates( GLcontext *ctx, BOOL bForce )
/*================================================*/ /*================================================*/
/* Check too see if there are new TEXTURE states. */ /* Check too see if there are new TEXTURE states. */
/*================================================*/ /*================================================*/
if ( texture != ctx->Texture.Enabled ) if ( texture != ctx->Texture.ReallyEnabled )
{ {
texture = ctx->Texture.Enabled; texture = ctx->Texture.ReallyEnabled;
DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" )); DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" ));
} }

View File

@@ -1,4 +1,4 @@
/* $Id: osmesa.c,v 1.21 2000/09/26 20:54:12 brianp Exp $ */ /* $Id: osmesa.c,v 1.22 2000/09/28 22:44:31 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -1395,7 +1395,7 @@ static line_func choose_line_function( GLcontext *ctx )
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = (OSMesaContext) ctx;
if (ctx->Line.SmoothFlag) return NULL; if (ctx->Line.SmoothFlag) return NULL;
if (ctx->Texture.Enabled) return NULL; if (ctx->Texture.ReallyEnabled) return NULL;
if (ctx->Light.ShadeModel!=GL_FLAT) return NULL; if (ctx->Light.ShadeModel!=GL_FLAT) return NULL;
if (ctx->Line.Width==1.0F if (ctx->Line.Width==1.0F
@@ -1581,7 +1581,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
if (ctx->Polygon.SmoothFlag) return NULL; if (ctx->Polygon.SmoothFlag) return NULL;
if (ctx->Polygon.StippleFlag) return NULL; if (ctx->Polygon.StippleFlag) return NULL;
if (ctx->Texture.Enabled) return NULL; if (ctx->Texture.ReallyEnabled) return NULL;
if (ctx->RasterMask==DEPTH_BIT if (ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS

View File

@@ -1,4 +1,4 @@
/* $Id: wmesa.c,v 1.8 2000/09/26 20:54:13 brianp Exp $ */ /* $Id: wmesa.c,v 1.9 2000/09/28 22:44:32 brianp Exp $ */
/* /*
* Windows (Win32) device driver for Mesa 3.4 * Windows (Win32) device driver for Mesa 3.4
@@ -651,7 +651,7 @@ extern points_func choose_points_function( GLcontext* ctx )
{ {
STARTPROFILE STARTPROFILE
if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0
&& !ctx->Texture.Enabled && ctx->Visual->RGBAflag) { && !ctx->Texture.ReallyEnabled && ctx->Visual->RGBAflag) {
ENDPROFILE(choose_points_function) ENDPROFILE(choose_points_function)
return fast_rgb_points; return fast_rgb_points;
} }
@@ -709,7 +709,7 @@ static line_func choose_line_function( GLcontext* ctx )
STARTPROFILE STARTPROFILE
if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0
&& !ctx->Texture.Enabled && Current->rgb_flag) { && !ctx->Texture.ReallyEnabled && Current->rgb_flag) {
ENDPROFILE(choose_line_function) ENDPROFILE(choose_line_function)
return fast_flat_rgb_line; return fast_flat_rgb_line;
} }
@@ -2851,7 +2851,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
int depth = wmesa->cColorBits; int depth = wmesa->cColorBits;
if (ctx->Polygon.SmoothFlag) return NULL; if (ctx->Polygon.SmoothFlag) return NULL;
if (ctx->Texture.Enabled) return NULL; if (ctx->Texture.ReallyEnabled) return NULL;
if (!wmesa->db_flag) return NULL; if (!wmesa->db_flag) return NULL;
/*if (wmesa->xm_buffer->buffer==XIMAGE)*/ { /*if (wmesa->xm_buffer->buffer==XIMAGE)*/ {
if ( ctx->Light.ShadeModel==GL_SMOOTH if ( ctx->Light.ShadeModel==GL_SMOOTH

View File

@@ -420,7 +420,7 @@ extern points_func choose_points_function( GLcontext* ctx )
{ {
STARTPROFILE STARTPROFILE
if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0
&& !ctx->Texture.Enabled && ctx->Visual->RGBAflag) { && !ctx->Texture.ReallyEnabled && ctx->Visual->RGBAflag) {
ENDPROFILE(choose_points_function) ENDPROFILE(choose_points_function)
return fast_rgb_points; return fast_rgb_points;
} }
@@ -478,7 +478,7 @@ static line_func choose_line_function( GLcontext* ctx )
STARTPROFILE STARTPROFILE
if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0
&& !ctx->Texture.Enabled && Current->rgb_flag) { && !ctx->Texture.ReallyEnabled && Current->rgb_flag) {
ENDPROFILE(choose_line_function) ENDPROFILE(choose_line_function)
return fast_flat_rgb_line; return fast_flat_rgb_line;
} }
@@ -589,7 +589,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
{ {
if (ctx->Polygon.SmoothFlag) return NULL; if (ctx->Polygon.SmoothFlag) return NULL;
if (ctx->Polygon.StippleFlag) return NULL; if (ctx->Polygon.StippleFlag) return NULL;
if (ctx->Texture.Enabled) return NULL; if (ctx->Texture.ReallyEnabled) return NULL;
if (ctx->RasterMask==DEPTH_BIT if (ctx->RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS && ctx->Depth.Func==GL_LESS
@@ -660,7 +660,7 @@ static polygon_func choose_polygon_function( GLcontext* ctx )
STARTPROFILE STARTPROFILE
if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0
&& !ctx->Texture.Enabled && Current->rgb_flag==GL_TRUE) { && !ctx->Texture.ReallyEnabled && Current->rgb_flag==GL_TRUE) {
ENDPROFILE(choose_polygon_function) ENDPROFILE(choose_polygon_function)
return fast_flat_rgb_polygon; return fast_flat_rgb_polygon;
} }

View File

@@ -1,4 +1,4 @@
/* $Id: xm_line.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */ /* $Id: xm_line.c,v 1.4 2000/09/28 22:44:32 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -98,7 +98,7 @@ points_func xmesa_get_points_func( GLcontext *ctx )
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
if (ctx->Point.Size==1.0F && !ctx->Point.SmoothFlag && ctx->RasterMask==0 if (ctx->Point.Size==1.0F && !ctx->Point.SmoothFlag && ctx->RasterMask==0
&& !ctx->Texture.Enabled) { && !ctx->Texture.ReallyEnabled) {
if (xmesa->xm_buffer->buffer==XIMAGE) { if (xmesa->xm_buffer->buffer==XIMAGE) {
return (points_func) NULL; /*draw_points_ximage;*/ return (points_func) NULL; /*draw_points_ximage;*/
} }
@@ -674,7 +674,7 @@ line_func xmesa_get_line_func( GLcontext *ctx )
(void) kernel1; /* silence unused var warning */ (void) kernel1; /* silence unused var warning */
if (ctx->Line.SmoothFlag) return (line_func)NULL; if (ctx->Line.SmoothFlag) return (line_func)NULL;
if (ctx->Texture.Enabled) return (line_func)NULL; if (ctx->Texture.ReallyEnabled) return (line_func)NULL;
if (ctx->Light.ShadeModel!=GL_FLAT) return (line_func)NULL; if (ctx->Light.ShadeModel!=GL_FLAT) return (line_func)NULL;
/* X line stippling doesn't match OpenGL stippling */ /* X line stippling doesn't match OpenGL stippling */
if (ctx->Line.StippleFlag==GL_TRUE) return (line_func)NULL; if (ctx->Line.StippleFlag==GL_TRUE) return (line_func)NULL;

View File

@@ -1,4 +1,4 @@
/* $Id: xm_tri.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */ /* $Id: xm_tri.c,v 1.4 2000/09/28 22:44:32 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -1541,7 +1541,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx )
(void) kernel1; (void) kernel1;
if (ctx->Polygon.SmoothFlag) return (triangle_func)NULL; if (ctx->Polygon.SmoothFlag) return (triangle_func)NULL;
if (ctx->Texture.Enabled) return (triangle_func)NULL; if (ctx->Texture.ReallyEnabled) return (triangle_func)NULL;
if (xmesa->xm_buffer->buffer==XIMAGE) { if (xmesa->xm_buffer->buffer==XIMAGE) {
if ( ctx->Light.ShadeModel==GL_SMOOTH if ( ctx->Light.ShadeModel==GL_SMOOTH

View File

@@ -1,4 +1,4 @@
/* $Id: attrib.c,v 1.27 2000/09/26 20:53:53 brianp Exp $ */ /* $Id: attrib.c,v 1.28 2000/09/28 22:44:30 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -213,8 +213,8 @@ _mesa_PushAttrib(GLbitfield mask)
attr->RescaleNormals = ctx->Transform.RescaleNormals; attr->RescaleNormals = ctx->Transform.RescaleNormals;
attr->Scissor = ctx->Scissor.Enabled; attr->Scissor = ctx->Scissor.Enabled;
attr->Stencil = ctx->Stencil.Enabled; attr->Stencil = ctx->Stencil.Enabled;
attr->Texture = ctx->Texture.Enabled;
for (i=0; i<MAX_TEXTURE_UNITS; i++) { for (i=0; i<MAX_TEXTURE_UNITS; i++) {
attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
} }
newnode = new_attrib_node( GL_ENABLE_BIT ); newnode = new_attrib_node( GL_ENABLE_BIT );
@@ -393,6 +393,147 @@ _mesa_PushAttrib(GLbitfield mask)
static void
pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
{
GLuint i;
#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
if ((VALUE) != (NEWVALUE)) { \
_mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
}
TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->AutoNormal, GL_NORMALIZE);
TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND);
for (i=0;i<MAX_CLIP_PLANES;i++) {
if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i])
_mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
enable->ClipPlane[i]);
}
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
GL_COLOR_MATERIAL);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D,
GL_CONVOLUTION_1D);
TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D,
GL_CONVOLUTION_2D);
TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D,
GL_SEPARABLE_2D);
TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING);
TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH);
TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple,
GL_LINE_STIPPLE);
TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp,
GL_INDEX_LOGIC_OP);
TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp,
GL_COLOR_LOGIC_OP);
TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4);
TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX);
TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1,
GL_MAP1_TEXTURE_COORD_1);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2,
GL_MAP1_TEXTURE_COORD_2);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3,
GL_MAP1_TEXTURE_COORD_3);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4,
GL_MAP1_TEXTURE_COORD_4);
TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3,
GL_MAP1_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4,
GL_MAP1_VERTEX_4);
TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4);
TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX);
TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1,
GL_MAP2_TEXTURE_COORD_1);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2,
GL_MAP2_TEXTURE_COORD_2);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3,
GL_MAP2_TEXTURE_COORD_3);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4,
GL_MAP2_TEXTURE_COORD_4);
TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3,
GL_MAP2_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4,
GL_MAP2_VERTEX_4);
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE);
TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals,
GL_RESCALE_NORMAL_EXT);
TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture,
GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint,
GL_POLYGON_OFFSET_POINT);
TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine,
GL_POLYGON_OFFSET_LINE);
TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill,
GL_POLYGON_OFFSET_FILL);
TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth,
GL_POLYGON_SMOOTH);
TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple,
GL_POLYGON_STIPPLE);
TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST);
TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST);
#undef TEST_AND_UPDATE
/* texture unit enables */
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) {
ctx->Texture.Unit[i].Enabled = enable->Texture[i];
if (ctx->Driver.Enable) {
if (ctx->Driver.ActiveTexture) {
(*ctx->Driver.ActiveTexture)(ctx, i);
}
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D,
(GLboolean) (enable->Texture[i] & TEXTURE0_1D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D,
(GLboolean) (enable->Texture[i] & TEXTURE0_2D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D,
(GLboolean) (enable->Texture[i] & TEXTURE0_3D) );
}
}
if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) {
ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i];
if (ctx->Driver.Enable) {
if (ctx->Driver.ActiveTexture) {
(*ctx->Driver.ActiveTexture)(ctx, i);
}
if (enable->TexGen[i] & S_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE);
if (enable->TexGen[i] & T_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE);
if (enable->TexGen[i] & R_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE);
if (enable->TexGen[i] & Q_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
}
}
}
if (ctx->Driver.ActiveTexture) {
(*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit);
}
}
/* /*
* This function is kind of long just because we have to call a lot * This function is kind of long just because we have to call a lot
* of device driver functions to update device driver state. * of device driver functions to update device driver state.
@@ -495,116 +636,7 @@ _mesa_PopAttrib(void)
{ {
const struct gl_enable_attrib *enable; const struct gl_enable_attrib *enable;
enable = (const struct gl_enable_attrib *) attr->data; enable = (const struct gl_enable_attrib *) attr->data;
pop_enable_group(ctx, enable);
#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
if ((VALUE) != (NEWVALUE)) { \
_mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
}
TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->AutoNormal, GL_NORMALIZE);
TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND);
{
GLuint i;
for (i=0;i<MAX_CLIP_PLANES;i++) {
if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i])
_mesa_set_enable( ctx, (GLenum) (GL_CLIP_PLANE0 + i), enable->ClipPlane[i] );
}
}
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, GL_CONVOLUTION_1D);
TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, GL_CONVOLUTION_2D);
TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, GL_SEPARABLE_2D);
TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING);
TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH);
TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple, GL_LINE_STIPPLE);
TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp, GL_INDEX_LOGIC_OP);
TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp, GL_COLOR_LOGIC_OP);
TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4);
TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX);
TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1, GL_MAP1_TEXTURE_COORD_1);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2, GL_MAP1_TEXTURE_COORD_2);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3, GL_MAP1_TEXTURE_COORD_3);
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4, GL_MAP1_TEXTURE_COORD_4);
TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3, GL_MAP1_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4, GL_MAP1_VERTEX_4);
TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4);
TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX);
TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1, GL_MAP2_TEXTURE_COORD_1);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2, GL_MAP2_TEXTURE_COORD_2);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3, GL_MAP2_TEXTURE_COORD_3);
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4, GL_MAP2_TEXTURE_COORD_4);
TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3, GL_MAP2_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4);
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE);
TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT);
TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT);
TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE);
TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill, GL_POLYGON_OFFSET_FILL);
TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth, GL_POLYGON_SMOOTH);
TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, GL_POLYGON_STIPPLE);
TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST);
TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST);
if (ctx->Texture.Enabled != enable->Texture) {
ctx->Texture.Enabled = enable->Texture;
if (ctx->Driver.Enable) {
if (ctx->Driver.ActiveTexture)
(*ctx->Driver.ActiveTexture)( ctx, 0 );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, (GLboolean) (enable->Texture & TEXTURE0_1D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, (GLboolean) (enable->Texture & TEXTURE0_2D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, (GLboolean) (enable->Texture & TEXTURE0_3D) );
if (ctx->Driver.ActiveTexture)
(*ctx->Driver.ActiveTexture)( ctx, 1 );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, (GLboolean) (enable->Texture & TEXTURE1_1D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, (GLboolean) (enable->Texture & TEXTURE1_2D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, (GLboolean) (enable->Texture & TEXTURE1_3D) );
if (ctx->Driver.ActiveTexture)
(*ctx->Driver.ActiveTexture)( ctx, ctx->Texture.CurrentUnit );
}
}
#undef TEST_AND_UPDATE
{
GLuint i;
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) {
ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i];
/* ctx->Enabled recalculated in state change
processing */
if (ctx->Driver.Enable) {
if (ctx->Driver.ActiveTexture)
(*ctx->Driver.ActiveTexture)( ctx, i );
if (enable->TexGen[i] & S_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE);
if (enable->TexGen[i] & T_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE);
if (enable->TexGen[i] & R_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE);
if (enable->TexGen[i] & Q_BIT)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE);
else
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
}
}
}
if (ctx->Driver.ActiveTexture)
(*ctx->Driver.ActiveTexture)( ctx, ctx->Texture.CurrentUnit );
}
} }
break; break;
case GL_EVAL_BIT: case GL_EVAL_BIT:

View File

@@ -1,4 +1,4 @@
/* $Id: context.c,v 1.90 2000/09/26 20:53:53 brianp Exp $ */ /* $Id: context.c,v 1.91 2000/09/28 22:44:30 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -1178,7 +1178,6 @@ init_attrib_groups( GLcontext *ctx )
/* Texture group */ /* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture.CurrentUnit = 0; /* multitexture */
ctx->Texture.CurrentTransformUnit = 0; /* multitexture */ ctx->Texture.CurrentTransformUnit = 0; /* multitexture */
ctx->Texture.Enabled = 0;
ctx->Texture.ReallyEnabled = 0; ctx->Texture.ReallyEnabled = 0;
for (i=0; i<MAX_TEXTURE_UNITS; i++) for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i ); init_texture_unit( ctx, i );

View File

@@ -1,4 +1,4 @@
/* $Id: state.c,v 1.28 2000/09/26 20:53:53 brianp Exp $ */ /* $Id: state.c,v 1.29 2000/09/28 22:44:30 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -671,7 +671,7 @@ static void update_fog_mode( GLcontext *ctx )
int old_mode = ctx->FogMode; int old_mode = ctx->FogMode;
if (ctx->Fog.Enabled) { if (ctx->Fog.Enabled) {
if (ctx->Texture.Enabled) if (ctx->Texture.ReallyEnabled)
ctx->FogMode = FOG_FRAGMENT; ctx->FogMode = FOG_FRAGMENT;
else if (ctx->Hint.Fog == GL_NICEST) else if (ctx->Hint.Fog == GL_NICEST)
ctx->FogMode = FOG_FRAGMENT; ctx->FogMode = FOG_FRAGMENT;
@@ -818,7 +818,7 @@ void gl_update_state( GLcontext *ctx )
gl_update_client_state( ctx ); gl_update_client_state( ctx );
if ((ctx->NewState & NEW_TEXTURE_ENABLE) && if ((ctx->NewState & NEW_TEXTURE_ENABLE) &&
(ctx->Enabled & ENABLE_TEX_ANY) != ctx->Texture.Enabled) (ctx->Enabled & ENABLE_TEX_ANY) != ctx->Texture.ReallyEnabled)
ctx->NewState |= NEW_TEXTURING | NEW_RASTER_OPS; ctx->NewState |= NEW_TEXTURING | NEW_RASTER_OPS;
if (ctx->NewState & NEW_TEXTURE_ENV) { if (ctx->NewState & NEW_TEXTURE_ENV) {
@@ -872,7 +872,6 @@ void gl_update_state( GLcontext *ctx )
} }
} }
ctx->Texture.Enabled = ctx->Enabled & ENABLE_TEX_ANY;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
} }
@@ -1072,7 +1071,7 @@ void gl_update_state( GLcontext *ctx )
} }
ctx->NeedEyeNormals = ctx->NeedEyeCoords; ctx->NeedEyeNormals = ctx->NeedEyeCoords;
} }
if (ctx->Texture.Enabled || ctx->RenderMode==GL_FEEDBACK) { if (ctx->Texture.ReallyEnabled || ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Texture.NeedEyeCoords) ctx->NeedEyeCoords = GL_TRUE; if (ctx->Texture.NeedEyeCoords) ctx->NeedEyeCoords = GL_TRUE;
if (ctx->Texture.NeedNormals) if (ctx->Texture.NeedNormals)
ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE; ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE;