mesa: Branch 'master' - 4 commits

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 14 22:21:20 UTC 2006


 src/egl/docs/EGL_MESA_screen_surface |   28 ++-------
 src/mesa/main/enable.c               |   91 ++++++++++--------------------
 src/mesa/main/extensions.c           |    4 +
 src/mesa/main/light.c                |   14 +---
 src/mesa/main/lines.c                |   23 +------
 src/mesa/main/points.c               |   14 ----
 src/mesa/main/polygon.c              |   38 ------------
 src/mesa/main/polygon.h              |    7 --
 src/mesa/main/state.c                |  104 +++++++++++++++++++++++++++--------
 src/mesa/shader/arbprogparse.c       |    2 
 10 files changed, 137 insertions(+), 188 deletions(-)

New commits:
diff-tree 0ae74048355497ebca4f606e01311a659db6c120 (from parents)
Merge: 5cc12925089ba705e4f0af9649bc30b546d900ff fde908444af5c826bce84203a9cb4273d8341ed0
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Dec 14 15:20:15 2006 -0700

    Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa

diff-tree 5cc12925089ba705e4f0af9649bc30b546d900ff (from b56a5261fe43e7afead076b43a29fd34cad65962)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Dec 14 14:27:05 2006 -0700

    Replace __extension__ with LONGSTRING.

diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 5a61f30..72d4909 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3703,7 +3703,7 @@ parse_instructions(GLcontext * ctx, cons
 
 
 /* XXX temporary */
-__extension__ static char core_grammar_text[] =
+LONGSTRING static char core_grammar_text[] =
 #include "grammar_syn.h"
 ;
 
diff-tree b56a5261fe43e7afead076b43a29fd34cad65962 (from 8dcfcad7a2598ba835930aac8f3fd6576e464c1c)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Dec 14 09:38:06 2006 -0700

    Check in a long-misplaced spec update.

diff --git a/src/egl/docs/EGL_MESA_screen_surface b/src/egl/docs/EGL_MESA_screen_surface
index 3a11da7..6beb4ce 100644
--- a/src/egl/docs/EGL_MESA_screen_surface
+++ b/src/egl/docs/EGL_MESA_screen_surface
@@ -18,7 +18,7 @@ Status
 
 Version
 
-    10 (10 August 2005)
+    11 (27 January 2006)
 
 Number
 
@@ -127,22 +127,8 @@ Issues
        isn't always reliable (consider video projectors) but can still be
        used to determine the pixel aspect ratio.
 
-       Arguments for:
-
-          X supports a similar query with DisplayWidthMM(), DisplayHeightMM().
-          If this information can be easily queried with EDID, why not
-          make it available to the user?
-
-       Arguments against:
-
-          Historically, these values aren't always accurate.  Also, they're
-          not always applicable to the display device.
-
-       Other options:
-
-          Perhaps just a pixel aspect ratio should be supported.  [M. Danzer]
-
-          Postpone for a future extension, if needed.  [A. Jackson]
+       Resolution: Omit.  The EGL 1.2 specification includes queries for
+       the display resolution and pixel aspect ratio.
 
 
     6. Should detailed mode timing information be exposed by this API?
@@ -222,7 +208,7 @@ Issues
     14. What if the physical screen size can't be determined?  Should
         a query of EGL_PHYSICAL_SIZE_MESA return [0,0]?
 
-        TBD.
+        Obsolete: EGL_PHYSICAL_SIZE_MESA not used.
 
 
     15. Suppose the device's number of RAMDACs is different from the
@@ -317,7 +303,6 @@ New Tokens
 
     EGL_SCREEN_COUNT_MESA      
     EGL_SCREEN_POSITION_MESA   
-    EGL_PHYSICAL_SIZE_MESA
     EGL_SCREEN_BIT_MESA        
     EGL_SCREEN_POSITION_GRANULARITY_MESA
 
@@ -488,8 +473,6 @@ Additions to Chapter X of the EGL 1.1 Sp
         EGL_SCREEN_POSITION_GRANULARITY_MESA
                                   Returns the granularity, in pixels, for
                                   which the screen position is constrained.
-        EGL_PHYSICAL_SIZE_MESA    Physical width and height of the screen
-                                  in millimeters
 
     Any other token will generate the error EGL_BAD_ATTRIBUTE.
 
@@ -576,3 +559,6 @@ Version History
     10. 10 August 2005 - BrianP
         Added EGL_SCREEN_POSITION_GRANULARITY_MESA.
 
+    11. 27 January 2006 - BrianP
+        EGL_PHYSICAL_SIZE_MESA removed since EGL 1.2 has a similar feature.
+
diff-tree 8dcfcad7a2598ba835930aac8f3fd6576e464c1c (from 6c305c083113075a1f11d5081b8c9dd1b98a7b1e)
Author: Brian <brian at yutani.localnet.net>
Date:   Wed Dec 13 15:31:14 2006 -0700

    Move all the code for computing ctx->_TriangleCaps into state.c.
    ctx->_TriangleCaps should probably go away altogether someday...

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 91268b5..076d873 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -49,8 +49,11 @@
    }
 
 
+/**
+ * Helper to enable/disable client-side state.
+ */
 static void
-client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+client_state(GLcontext *ctx, GLenum cap, GLboolean state)
 {
    GLuint flag;
    GLuint *var;
@@ -134,17 +137,14 @@ client_state( GLcontext *ctx, GLenum cap
       ctx->Array.ArrayObj->_Enabled &= ~flag;
 
    if (ctx->Driver.Enable) {
-      (*ctx->Driver.Enable)( ctx, cap, state );
+      ctx->Driver.Enable( ctx, cap, state );
    }
 }
 
 
 /**
  * Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
+ * \param cap  state to enable/disable.
  *
  * Get's the current context, assures that we're outside glBegin()/glEnd() and
  * calls client_state().
@@ -160,10 +160,7 @@ _mesa_EnableClientState( GLenum cap )
 
 /**
  * Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
+ * \param cap  state to enable/disable.
  *
  * Get's the current context, assures that we're outside glBegin()/glEnd() and
  * calls client_state().
@@ -195,10 +192,10 @@ _mesa_DisableClientState( GLenum cap )
 
 
 /**
- * Perform glEnable() and glDisable() calls.
+ * Helper function to enable or disable state.
  *
  * \param ctx GL context.
- * \param cap capability.
+ * \param cap  the state to enable/disable
  * \param state whether to enable or disable the specified capability.
  *
  * Updates the current context and flushes the vertices as needed. For
@@ -206,7 +203,8 @@ _mesa_DisableClientState( GLenum cap )
  * are effectivly present before updating. Notifies the driver via
  * dd_function_table::Enable.
  */
-void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+void
+_mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
 {
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "%s %s (newstate is %x)\n",
@@ -285,7 +283,6 @@ void _mesa_set_enable( GLcontext *ctx, G
          FLUSH_VERTICES(ctx, _NEW_POLYGON);
          ctx->Polygon.CullFlag = state;
          break;
-
       case GL_CULL_VERTEX_EXT:
          CHECK_EXTENSION(EXT_cull_vertex, cap);
          if (ctx->Transform.CullVertexFlag == state)
@@ -293,13 +290,12 @@ void _mesa_set_enable( GLcontext *ctx, G
          FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
          ctx->Transform.CullVertexFlag = state;
          break;
-
       case GL_DEPTH_TEST:
          if (state && ctx->DrawBuffer->Visual.depthBits == 0) {
             _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;
@@ -308,13 +304,13 @@ void _mesa_set_enable( GLcontext *ctx, G
          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;
@@ -351,26 +347,18 @@ void _mesa_set_enable( GLcontext *ctx, G
             return;
          FLUSH_VERTICES(ctx, _NEW_LIGHT);
          ctx->Light.Enabled = state;
-
-         if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
-   	   ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
-         else
- 	   ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
- 
          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)
@@ -505,41 +493,38 @@ void _mesa_set_enable( GLcontext *ctx, G
          ctx->Transform.Normalize = state;
          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;
@@ -551,7 +536,7 @@ void _mesa_set_enable( GLcontext *ctx, G
          ctx->Transform.RescaleNormals = state;
          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;
@@ -568,7 +553,7 @@ void _mesa_set_enable( GLcontext *ctx, G
                           "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;
@@ -916,11 +901,6 @@ void _mesa_set_enable( GLcontext *ctx, G
             return;
          FLUSH_VERTICES(ctx, _NEW_STENCIL);
          ctx->Stencil.TestTwoSide = state;
-         if (state) {
-            ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
-         } else {
-            ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL;
-         }
          break;
 
 #if FEATURE_ARB_fragment_program
@@ -973,20 +953,14 @@ void _mesa_set_enable( GLcontext *ctx, G
    }
 
    if (ctx->Driver.Enable) {
-      (*ctx->Driver.Enable)( ctx, cap, state );
+      ctx->Driver.Enable( ctx, cap, state );
    }
 }
 
 
 /**
- * Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Enable GL capability.  Called by glEnable()
+ * \param cap  state to enable.
  */
 void GLAPIENTRY
 _mesa_Enable( GLenum cap )
@@ -999,14 +973,8 @@ _mesa_Enable( GLenum cap )
 
 
 /**
- * Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Disable GL capability.  Called by glDisable()
+ * \param cap  state to disable.
  */
 void GLAPIENTRY
 _mesa_Disable( GLenum cap )
@@ -1032,10 +1000,11 @@ _mesa_Disable( GLenum cap )
       return GL_FALSE;						\
    }
 
+
 /**
- * Test whether a capability is enabled.
+ * Return simple enable/disable state.
  *
- * \param cap capability.
+ * \param cap  state variable to query.
  *
  * Returns the state of the specified capability from the current GL context.
  * For the capabilities associated with extensions verifies that those
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 135323f..7845ea0 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -409,7 +409,9 @@ _mesa_enable_2_1_extensions(GLcontext *c
 #if FEATURE_EXT_texture_sRGB
    ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
 #endif
-   /* plus: shading language extensions, non-square uniform matrices */
+#ifdef FEATURE_ARB_shading_language_120
+   ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
+#endif
 }
 
 
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 984f7b2..92d8a0a 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.3
  *
  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
@@ -44,7 +44,7 @@ _mesa_ShadeModel( GLenum mode )
       _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
 
    if (mode != GL_FLAT && mode != GL_SMOOTH) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+      _mesa_error(ctx, GL_INVALID_ENUM, "glShadeModel");
       return;
    }
 
@@ -53,9 +53,8 @@ _mesa_ShadeModel( GLenum mode )
 
    FLUSH_VERTICES(ctx, _NEW_LIGHT);
    ctx->Light.ShadeModel = mode;
-   ctx->_TriangleCaps ^= DD_FLATSHADE;
    if (ctx->Driver.ShadeModel)
-      (*ctx->Driver.ShadeModel)( ctx, mode );
+      ctx->Driver.ShadeModel( ctx, mode );
 }
 
 
@@ -442,11 +441,6 @@ _mesa_LightModelfv( GLenum pname, const 
 	    return;
 	 FLUSH_VERTICES(ctx, _NEW_LIGHT);
 	 ctx->Light.Model.TwoSide = newbool;
-
-	 if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
-	    ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
-	 else
-	    ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
          break;
       case GL_LIGHT_MODEL_COLOR_CONTROL:
          if (params[0] == (GLfloat) GL_SINGLE_COLOR)
@@ -728,7 +722,7 @@ _mesa_ColorMaterial( GLenum face, GLenum
    }
 
    if (ctx->Driver.ColorMaterial)
-      (*ctx->Driver.ColorMaterial)( ctx, face, mode );
+      ctx->Driver.ColorMaterial( ctx, face, mode );
 }
 
 
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index c30d9ac..dc7195d 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -1,13 +1,8 @@
-/**
- * \file lines.c
- * Line operations.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -43,12 +38,6 @@
  * \param width line width in pixels.
  *
  * \sa glLineWidth().
- *
- * Verifies the parameter and updates gl_line_attrib::Width. On a change,
- * flushes the vertices, updates the clamped line width and marks the
- * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the
- * width is different from one. Notifies the driver via the
- * dd_function_table::LineWidth callback.
  */
 void GLAPIENTRY
 _mesa_LineWidth( GLfloat width )
@@ -70,14 +59,8 @@ _mesa_LineWidth( GLfloat width )
 			    ctx->Const.MinLineWidth,
 			    ctx->Const.MaxLineWidth);
 
-
-   if (width != 1.0)
-      ctx->_TriangleCaps |= DD_LINE_WIDTH;
-   else
-      ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
-
    if (ctx->Driver.LineWidth)
-      (*ctx->Driver.LineWidth)(ctx, width);
+      ctx->Driver.LineWidth(ctx, width);
 }
 
 
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index aa36fb6..c6b0324 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -5,9 +5,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.1
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -244,19 +244,9 @@ _mesa_update_point(GLcontext *ctx)
 			    ctx->Point.MinSize,
 			    ctx->Point.MaxSize);
 
-   if (ctx->Point._Size == 1.0F)
-      ctx->_TriangleCaps &= ~DD_POINT_SIZE;
-   else
-      ctx->_TriangleCaps |= DD_POINT_SIZE;
-
    ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
                              ctx->Point.Params[1] != 0.0 ||
                              ctx->Point.Params[2] != 0.0);
-
-   if (ctx->Point._Attenuated)
-      ctx->_TriangleCaps |= DD_POINT_ATTEN;
-   else
-      ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
 }
 
 
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index b771408..814f7ec 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -5,9 +5,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.1
  *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -166,14 +166,6 @@ _mesa_PolygonMode( GLenum face, GLenum m
       _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
       return;
    }
-
-   ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
-   if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
-      ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-
-   if (ctx->Driver.PolygonMode) {
-      (*ctx->Driver.PolygonMode)( ctx, face, mode );
-   }
 }
 
 #if _HAVE_FULL_GL
@@ -321,32 +313,6 @@ _mesa_PolygonOffsetEXT( GLfloat factor, 
 
 
 /**********************************************************************/
-/** \name State Management */
-/*@{*/
-
-/*
- * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
- * in ctx->_TriangleCaps if needed.
- */
-void _mesa_update_polygon( GLcontext *ctx )
-{
-   ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
-
-   if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
-      ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
-
-   /* Any Polygon offsets enabled? */
-   if (ctx->Polygon.OffsetPoint ||
-       ctx->Polygon.OffsetLine ||
-       ctx->Polygon.OffsetFill) {
-      ctx->_TriangleCaps |= DD_TRI_OFFSET;
-   }
-}
-
-/*@}*/
-
-
-/**********************************************************************/
 /** \name Initialization */
 /*@{*/
 
diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h
index 2550ed1..78e8394 100644
--- a/src/mesa/main/polygon.h
+++ b/src/mesa/main/polygon.h
@@ -5,9 +5,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.1
  *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -60,9 +60,6 @@ _mesa_PolygonStipple( const GLubyte *mas
 extern void GLAPIENTRY
 _mesa_GetPolygonStipple( GLubyte *mask );
 
-extern void  
-_mesa_update_polygon( GLcontext *ctx );
-
 extern void 
 _mesa_init_polygon( GLcontext * ctx );
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index e62fbe4..4184aeb 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -821,16 +821,6 @@ _mesa_init_exec_table(struct _glapi_tabl
 /*@{*/
 
 
-static void
-update_separate_specular( GLcontext *ctx )
-{
-   if (NEED_SECONDARY_COLOR(ctx))
-      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
-   else
-      ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-}
-
-
 /**
  * Update state dependent on vertex arrays.
  */
@@ -1014,16 +1004,88 @@ update_color(GLcontext *ctx)
 
 
 /**
- * If __GLcontextRec::NewState is non-zero then this function \b must be called
- * before rendering any primitive.  Basically, function pointers and
- * miscellaneous flags are updated to reflect the current state of the state
- * machine.
+ * Update the ctx->_TriangleCaps bitfield.
+ * XXX that bitfield should really go away someday!
+ * This function must be called after other update_*() functions since
+ * there are dependencies on some other derived values.
+ */
+static void
+update_tricaps(GLcontext *ctx, GLbitfield new_state)
+{
+   ctx->_TriangleCaps = 0;
+
+   /*
+    * Points
+    */
+   if (new_state & _NEW_POINT) {
+      if (ctx->Point.SmoothFlag)
+         ctx->_TriangleCaps |= DD_POINT_SMOOTH;
+      if (ctx->Point._Size != 1.0F)
+         ctx->_TriangleCaps |= DD_POINT_SIZE;
+      if (ctx->Point._Attenuated)
+         ctx->_TriangleCaps |= DD_POINT_ATTEN;
+   }
+
+   /*
+    * Lines
+    */
+   if (new_state & _NEW_LINE) {
+      if (ctx->Line.SmoothFlag)
+         ctx->_TriangleCaps |= DD_LINE_SMOOTH;
+      if (ctx->Line.StippleFlag)
+         ctx->_TriangleCaps |= DD_LINE_STIPPLE;
+      if (ctx->Line._Width != 1.0)
+         ctx->_TriangleCaps |= DD_LINE_WIDTH;
+   }
+
+   /*
+    * Polygons
+    */
+   if (new_state & _NEW_POLYGON) {
+      if (ctx->Polygon.SmoothFlag)
+         ctx->_TriangleCaps |= DD_TRI_SMOOTH;
+      if (ctx->Polygon.StippleFlag)
+         ctx->_TriangleCaps |= DD_TRI_STIPPLE;
+      if (ctx->Polygon.FrontMode != GL_FILL
+          || ctx->Polygon.BackMode != GL_FILL)
+         ctx->_TriangleCaps |= DD_TRI_UNFILLED;
+      if (ctx->Polygon.CullFlag
+          && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
+         ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
+      if (ctx->Polygon.OffsetPoint ||
+          ctx->Polygon.OffsetLine ||
+          ctx->Polygon.OffsetFill)
+         ctx->_TriangleCaps |= DD_TRI_OFFSET;
+   }
+
+   /*
+    * Lighting and shading
+    */
+   if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+      ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+   if (ctx->Light.ShadeModel == GL_FLAT)
+      ctx->_TriangleCaps |= DD_FLATSHADE;
+   if (NEED_SECONDARY_COLOR(ctx))
+      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+
+   /*
+    * Stencil
+    */
+   if (ctx->Stencil._TestTwoSide)
+      ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
+}
+
+
+/**
+ * Compute derived GL state.
+ * If __GLcontextRec::NewState is non-zero then this function \b must
+ * be called before rendering anything.
  *
  * Calls dd_function_table::UpdateState to perform any internal state
  * management necessary.
  * 
  * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
- * _mesa_update_buffer_bounds(), _mesa_update_polygon(),
+ * _mesa_update_buffer_bounds(),
  * _mesa_update_lighting() and _mesa_update_tnl_spaces().
  */
 void
@@ -1052,9 +1114,6 @@ _mesa_update_state_locked( GLcontext *ct
    if (new_state & _NEW_POINT)
       _mesa_update_point( ctx );
 
-   if (new_state & _NEW_POLYGON)
-      _mesa_update_polygon( ctx );
-
    if (new_state & _NEW_LIGHT)
       _mesa_update_lighting( ctx );
 
@@ -1064,9 +1123,6 @@ _mesa_update_state_locked( GLcontext *ct
    if (new_state & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_pixel( ctx, new_state );
 
-   if (new_state & _DD_NEW_SEPARATE_SPECULAR)
-      update_separate_specular( ctx );
-
    if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
       update_arrays( ctx );
 
@@ -1076,6 +1132,10 @@ _mesa_update_state_locked( GLcontext *ct
    if (new_state & _NEW_COLOR)
       update_color( ctx );
 
+   if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
+                    | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
+      update_tricaps( ctx, new_state );
+
    if (ctx->_MaintainTexEnvProgram) {
       if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
 	 _mesa_UpdateTexEnvProgram(ctx);
@@ -1122,3 +1182,5 @@ _mesa_update_state( GLcontext *ctx )
 
 
 /*@}*/
+
+



More information about the mesa-commit mailing list