removed ctx->Texture.Enabled, use ctx->Texture.ReallyEnabled instead
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 28 Sep 2000 22:44:30 +0000 (22:44 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 28 Sep 2000 22:44:30 +0000 (22:44 +0000)
src/mesa/drivers/d3d/D3Dvbrender.c
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/windows/wmesa.c
src/mesa/drivers/windows/wmesa_stereo.c
src/mesa/drivers/x11/xm_line.c
src/mesa/drivers/x11/xm_tri.c
src/mesa/main/attrib.c
src/mesa/main/context.c
src/mesa/main/state.c

index 6ed8037902b8c2e4ec05ea8001d07f55618bd794..0ef32e26ceb42cea8757633241f044cdedf27d48 100644 (file)
@@ -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" : "--------" ));
    }   
 
index 11336e5cd9a313f19e5368cc0d8e359236c44ebd..55fe26181ed13f388fb567400231f214c5ccece0 100644 (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
@@ -1395,7 +1395,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
@@ -1581,7 +1581,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
index b372469288c46c3b7bfe9dba4e9c75d800639a4f..6b2b02bc357544789082ddcc2dc78e1075e65d41 100644 (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
@@ -651,7 +651,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;
         }
@@ -709,7 +709,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;
     }
@@ -2851,7 +2851,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
index 3408fe943c8887691c91b425b18dd384ea73a2b7..70251ae877e14f6a37d40a65fd42da51a9511ae2 100644 (file)
@@ -420,7 +420,7 @@ extern points_func choose_points_function( GLcontext* ctx )
 {\r
    STARTPROFILE\r
    if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0\r
-       && !ctx->Texture.Enabled  && ctx->Visual->RGBAflag) {\r
+       && !ctx->Texture.ReallyEnabled  && ctx->Visual->RGBAflag) {\r
    ENDPROFILE(choose_points_function)\r
       return fast_rgb_points;\r
    }\r
@@ -478,7 +478,7 @@ static line_func choose_line_function( GLcontext* ctx )
        STARTPROFILE\r
    if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag\r
        && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0\r
-       && !ctx->Texture.Enabled && Current->rgb_flag) {\r
+       && !ctx->Texture.ReallyEnabled && Current->rgb_flag) {\r
    ENDPROFILE(choose_line_function)\r
       return fast_flat_rgb_line;\r
    }\r
@@ -589,7 +589,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
 {\r
    if (ctx->Polygon.SmoothFlag)     return NULL;\r
    if (ctx->Polygon.StippleFlag)    return NULL;\r
-   if (ctx->Texture.Enabled)        return NULL;\r
+   if (ctx->Texture.ReallyEnabled)  return NULL;\r
 \r
    if (ctx->RasterMask==DEPTH_BIT\r
        && ctx->Depth.Func==GL_LESS\r
@@ -657,15 +657,15 @@ static void fast_flat_rgb_polygon( GLcontext* ctx, GLuint n, GLuint vlist[], GLu
 /* Return pointer to accerated polygon function */\r
 static polygon_func choose_polygon_function( GLcontext* ctx )\r
 {\r
-       STARTPROFILE\r
+   STARTPROFILE\r
    if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag\r
        && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0\r
-       && !ctx->Texture.Enabled && Current->rgb_flag==GL_TRUE) {\r
-   ENDPROFILE(choose_polygon_function)\r
+       && !ctx->Texture.ReallyEnabled && Current->rgb_flag==GL_TRUE) {\r
+      ENDPROFILE(choose_polygon_function)\r
       return fast_flat_rgb_polygon;\r
    }\r
    else {\r
-   ENDPROFILE(choose_polygon_function)\r
+      ENDPROFILE(choose_polygon_function)\r
       return NULL;\r
    }\r
 }\r
@@ -679,18 +679,18 @@ static polygon_func choose_polygon_function( GLcontext* ctx )
 \r
 /* Write a horizontal span of color-index pixels with a boolean mask. */\r
 static void write_index_span( GLcontext* ctx,\r
-                                                         GLuint n, GLint x, GLint y,\r
-                                                         const GLuint index[],\r
+                              GLuint n, GLint x, GLint y,\r
+                              const GLuint index[],\r
                               const GLubyte mask[] )\r
 {\r
-         STARTPROFILE\r
-         GLuint i;\r
-         char *Mem=Current->ScreenMem+y*Current->ScanWidth+x;\r
-         assert(Current->rgb_flag==GL_FALSE);\r
-         for (i=0; i<n; i++)\r
-               if (mask[i])\r
-                 Mem[i]=index[i];\r
-          ENDPROFILE(write_index_span)\r
+   STARTPROFILE\r
+   GLuint i;\r
+   char *Mem=Current->ScreenMem+y*Current->ScanWidth+x;\r
+   assert(Current->rgb_flag==GL_FALSE);\r
+   for (i=0; i<n; i++)\r
+      if (mask[i])\r
+         Mem[i]=index[i];\r
+   ENDPROFILE(write_index_span)\r
 }\r
 \r
 \r
index 03af57b3bffa180cfa17509d6f7360562649fb3d..7a51948212558fe64510d206d224268cb4359e9d 100644 (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
@@ -98,7 +98,7 @@ points_func xmesa_get_points_func( GLcontext *ctx )
    XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 
    if (ctx->Point.Size==1.0F && !ctx->Point.SmoothFlag && ctx->RasterMask==0
-       && !ctx->Texture.Enabled) {
+       && !ctx->Texture.ReallyEnabled) {
       if (xmesa->xm_buffer->buffer==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 */
 
    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;
    /* X line stippling doesn't match OpenGL stippling */
    if (ctx->Line.StippleFlag==GL_TRUE)    return (line_func)NULL;
index 29b97a03b0dba0fbd12f8ad13201ca431bb649b7..5392c0f3532c8637ab4159983312e8703fc1b5eb 100644 (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
@@ -1541,7 +1541,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx )
    (void) kernel1;
 
    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 (   ctx->Light.ShadeModel==GL_SMOOTH
index b3c36435134896f23ebfc02c67a09d0ee904a0b6..9cf1d3c5099932fe0c6edd27811bccb98972b497 100644 (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
@@ -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,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
  * of device driver functions to update device driver state.
@@ -495,116 +636,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:
index a66bb13972f85eb2a9fa11cb78b7fe37b637d8a9..018e709d900fed283ae1ae88447d46e1476794df 100644 (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
@@ -1178,7 +1178,6 @@ 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 );
index 3578d28f89943dcd95ff9373e908a14aafcb7474..f1cbf9814c4d08842e76fcd4be5bbb03563df6f3 100644 (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
@@ -671,7 +671,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;
@@ -818,7 +818,7 @@ 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) {
@@ -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);
    }
 
@@ -1072,7 +1071,7 @@ void gl_update_state( GLcontext *ctx )
         }
         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.NeedNormals)
            ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE;