summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-28 22:39:41 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-28 22:39:41 +0000
commitde636538352484c0018ddd68b56d825874187c61 (patch)
tree9a9fe2b2a1eac4894593107536fb6731ce3cd67b
parent2f095b9b0945ce9982ddef2d622fc8d70fa91bd7 (diff)
removed ctx->Texture.Enabled, use ctx->Texture.ReallyEnabled instead
-rw-r--r--src/mesa/drivers/d3d/D3Dvbrender.c6
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c6
-rw-r--r--src/mesa/drivers/windows/wmesa.c8
-rw-r--r--src/mesa/drivers/windows/wmesa_stereo.c8
-rw-r--r--src/mesa/main/attrib.c259
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/state.c12
7 files changed, 170 insertions, 135 deletions
diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c
index 6ed8037902b..0ef32e26ceb 100644
--- a/src/mesa/drivers/d3d/D3Dvbrender.c
+++ b/src/mesa/drivers/d3d/D3Dvbrender.c
@@ -1511,7 +1511,7 @@ static void SetRenderStates( GLcontext *ctx )
/*================================================*/
/* 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 )
{
@@ -1871,9 +1871,9 @@ static void DebugRenderStates( GLcontext *ctx, BOOL bForce )
/*================================================*/
/* 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" : "--------" ));
}
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 56059607118..74f86ea376d 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.19 2000/06/27 21:42:14 brianp Exp $ */
+/* $Id: osmesa.c,v 1.19.4.1 2000/09/28 22:39:42 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1357,7 +1357,7 @@ static line_func choose_line_function( GLcontext *ctx )
OSMesaContext osmesa = (OSMesaContext) ctx;
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->Line.Width==1.0F
@@ -1543,7 +1543,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
if (ctx->Polygon.SmoothFlag) 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
&& ctx->Depth.Func==GL_LESS
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index 6b254b5c466..41d9b04974d 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.3.4.2 2000/09/12 15:46:39 brianp Exp $ */
+/* $Id: wmesa.c,v 1.3.4.3 2000/09/28 22:39:43 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
@@ -670,7 +670,7 @@ extern points_func choose_points_function( GLcontext* ctx )
{
STARTPROFILE
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)
return fast_rgb_points;
}
@@ -728,7 +728,7 @@ static line_func choose_line_function( GLcontext* ctx )
STARTPROFILE
if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0
- && !ctx->Texture.Enabled && Current->rgb_flag) {
+ && !ctx->Texture.ReallyEnabled && Current->rgb_flag) {
ENDPROFILE(choose_line_function)
return fast_flat_rgb_line;
}
@@ -2872,7 +2872,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
int depth = wmesa->cColorBits;
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->xm_buffer->buffer==XIMAGE)*/ {
if ( ctx->Light.ShadeModel==GL_SMOOTH
diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c
index ea721a13b66..3113d60314e 100644
--- a/src/mesa/drivers/windows/wmesa_stereo.c
+++ b/src/mesa/drivers/windows/wmesa_stereo.c
@@ -458,7 +458,7 @@ extern points_func choose_points_function( GLcontext* ctx )
{
STARTPROFILE
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)
return fast_rgb_points;
}
@@ -516,7 +516,7 @@ static line_func choose_line_function( GLcontext* ctx )
STARTPROFILE
if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0
- && !ctx->Texture.Enabled && Current->rgb_flag) {
+ && !ctx->Texture.ReallyEnabled && Current->rgb_flag) {
ENDPROFILE(choose_line_function)
return fast_flat_rgb_line;
}
@@ -627,7 +627,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
{
if (ctx->Polygon.SmoothFlag) 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
&& ctx->Depth.Func==GL_LESS
@@ -698,7 +698,7 @@ static polygon_func choose_polygon_function( GLcontext* ctx )
STARTPROFILE
if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag
&& 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)
return fast_flat_rgb_polygon;
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index be0a644ce1d..3486b9fdf0e 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,8 +1,8 @@
-/* $Id: attrib.c,v 1.25 2000/07/19 18:34:00 brianp Exp $ */
+/* $Id: attrib.c,v 1.25.2.1 2000/09/28 22:39:41 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -213,8 +213,8 @@ _mesa_PushAttrib(GLbitfield mask)
attr->RescaleNormals = ctx->Transform.RescaleNormals;
attr->Scissor = ctx->Scissor.Enabled;
attr->Stencil = ctx->Stencil.Enabled;
- attr->Texture = ctx->Texture.Enabled;
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
+ attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
}
newnode = new_attrib_node( GL_ENABLE_BIT );
@@ -393,6 +393,148 @@ _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
* of device driver functions to update device driver state.
@@ -495,116 +637,7 @@ _mesa_PopAttrib(void)
{
const struct gl_enable_attrib *enable;
enable = (const struct gl_enable_attrib *) attr->data;
-
-#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 );
- }
+ pop_enable_group(ctx, enable);
}
break;
case GL_EVAL_BIT:
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 793151f1fb1..8efef71934a 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,3 @@
-/* $Id: context.c,v 1.79.2.2 2000/09/12 21:08:11 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -594,6 +593,8 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
{
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ texUnit->Enabled = 0;
+ texUnit->ReallyEnabled = 0;
texUnit->EnvMode = GL_MODULATE;
texUnit->CombineModeRGB = GL_MODULATE;
texUnit->CombineModeA = GL_MODULATE;
@@ -1150,9 +1151,10 @@ init_attrib_groups( GLcontext *ctx )
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
ctx->Texture.CurrentTransformUnit = 0; /* multitexture */
- ctx->Texture.Enabled = 0;
+ ctx->Texture.ReallyEnabled = 0;
for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i );
+ ctx->Texture.SharedPalette = GL_FALSE;
_mesa_init_colortable(&ctx->Texture.Palette);
/* Transformation group */
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 8f52c9fe43a..982a26b7cd1 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,3 @@
-/* $Id: state.c,v 1.21 2000/06/30 14:14:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -778,7 +777,7 @@ static void update_fog_mode( GLcontext *ctx )
int old_mode = ctx->FogMode;
if (ctx->Fog.Enabled) {
- if (ctx->Texture.Enabled)
+ if (ctx->Texture.ReallyEnabled)
ctx->FogMode = FOG_FRAGMENT;
else if (ctx->Hint.Fog == GL_NICEST)
ctx->FogMode = FOG_FRAGMENT;
@@ -922,8 +921,9 @@ void gl_update_state( GLcontext *ctx )
gl_update_client_state( ctx );
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;
+ }
if (ctx->NewState & NEW_TEXTURE_ENV) {
if (ctx->Texture.Unit[0].EnvMode == ctx->Texture.Unit[0].LastEnvMode &&
@@ -976,7 +976,6 @@ void gl_update_state( GLcontext *ctx )
}
}
- ctx->Texture.Enabled = ctx->Enabled & ENABLE_TEX_ANY;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
}
@@ -1187,8 +1186,9 @@ void gl_update_state( GLcontext *ctx )
}
ctx->NeedEyeNormals = ctx->NeedEyeCoords;
}
- if (ctx->Texture.Enabled || ctx->RenderMode==GL_FEEDBACK) {
- if (ctx->Texture.NeedEyeCoords) ctx->NeedEyeCoords = GL_TRUE;
+ if (ctx->Texture.ReallyEnabled || ctx->RenderMode==GL_FEEDBACK) {
+ if (ctx->Texture.NeedEyeCoords)
+ ctx->NeedEyeCoords = GL_TRUE;
if (ctx->Texture.NeedNormals)
ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE;
}