mesa: only call _mesa_update_state() when necessary in glGet functions
authorBrian Paul <brianp@vmware.com>
Fri, 26 Mar 2010 16:08:52 +0000 (10:08 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 26 Mar 2010 16:14:00 +0000 (10:14 -0600)
Only a few state vars require state validation before querying them.
This potentially speeds up state queries.
Encode that info into the state tuple table.

Also, use the new tuple field to indicate when FLUSH_CURRENT() must
be called to validate other state vars.

Based on a patch submitted by Robert Bragg on Feb 12, 2010.

src/mesa/main/get.c
src/mesa/main/get_gen.py

index 523dc2e4f7e1c1d7cd9f159a3bc96043b294443f..266fda40ec51668c78eebf02a75212a463be5e35 100644 (file)
@@ -77,9 +77,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    if (ctx->Driver.GetBooleanv &&
        ctx->Driver.GetBooleanv(ctx, pname, params))
       return;
@@ -107,6 +104,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias);
          break;
       case GL_ALPHA_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits);
          break;
       case GL_ALPHA_SCALE:
@@ -167,6 +166,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias);
          break;
       case GL_BLUE_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits);
          break;
       case GL_BLUE_SCALE:
@@ -221,27 +222,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode);
          break;
       case GL_CURRENT_COLOR:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
          params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
          params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
          params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
-         }
          break;
       case GL_CURRENT_INDEX:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
-         }
          break;
       case GL_CURRENT_NORMAL:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
          params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
          params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
-         }
          break;
       case GL_CURRENT_RASTER_COLOR:
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]);
@@ -334,10 +329,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]);
          break;
       case GL_EDGE_FLAG:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0);
-         }
          break;
       case GL_FEEDBACK_BUFFER_SIZE:
          params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize);
@@ -379,12 +372,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias);
          break;
       case GL_GREEN_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits);
          break;
       case GL_GREEN_SCALE:
          params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale);
          break;
       case GL_INDEX_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits);
          break;
       case GL_INDEX_CLEAR_VALUE:
@@ -815,6 +812,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias);
          break;
       case GL_RED_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits);
          break;
       case GL_RED_SCALE:
@@ -1345,13 +1344,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetBooleanv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
          params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
          params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
          params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
-         }
          break;
       case GL_SECONDARY_COLOR_ARRAY_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetBooleanv");
@@ -1371,10 +1368,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          break;
       case GL_CURRENT_FOG_COORDINATE_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetBooleanv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
-         }
          break;
       case GL_FOG_COORDINATE_ARRAY_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetBooleanv");
@@ -1953,9 +1948,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    if (ctx->Driver.GetFloatv &&
        ctx->Driver.GetFloatv(ctx, pname, params))
       return;
@@ -1983,6 +1975,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Pixel.AlphaBias;
          break;
       case GL_ALPHA_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits);
          break;
       case GL_ALPHA_SCALE:
@@ -2043,6 +2037,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Pixel.BlueBias;
          break;
       case GL_BLUE_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits);
          break;
       case GL_BLUE_SCALE:
@@ -2097,27 +2093,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
          break;
       case GL_CURRENT_COLOR:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
          params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
          params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
          params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
-         }
          break;
       case GL_CURRENT_INDEX:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
-         }
          break;
       case GL_CURRENT_NORMAL:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
          params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
          params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
-         }
          break;
       case GL_CURRENT_RASTER_COLOR:
          params[0] = ctx->Current.RasterColor[0];
@@ -2210,10 +2200,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]);
          break;
       case GL_EDGE_FLAG:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
-         }
          break;
       case GL_FEEDBACK_BUFFER_SIZE:
          params[0] = (GLfloat)(ctx->Feedback.BufferSize);
@@ -2255,12 +2243,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Pixel.GreenBias;
          break;
       case GL_GREEN_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits);
          break;
       case GL_GREEN_SCALE:
          params[0] = ctx->Pixel.GreenScale;
          break;
       case GL_INDEX_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits);
          break;
       case GL_INDEX_CLEAR_VALUE:
@@ -2691,6 +2683,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Pixel.RedBias;
          break;
       case GL_RED_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits);
          break;
       case GL_RED_SCALE:
@@ -3221,13 +3215,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetFloatv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];
          params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];
          params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];
          params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];
-         }
          break;
       case GL_SECONDARY_COLOR_ARRAY_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetFloatv");
@@ -3247,10 +3239,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          break;
       case GL_CURRENT_FOG_COORDINATE_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetFloatv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
-         }
          break;
       case GL_FOG_COORDINATE_ARRAY_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetFloatv");
@@ -3829,9 +3819,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    if (ctx->Driver.GetIntegerv &&
        ctx->Driver.GetIntegerv(ctx, pname, params))
       return;
@@ -3859,6 +3846,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Pixel.AlphaBias);
          break;
       case GL_ALPHA_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = ctx->DrawBuffer->Visual.alphaBits;
          break;
       case GL_ALPHA_SCALE:
@@ -3919,6 +3908,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Pixel.BlueBias);
          break;
       case GL_BLUE_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = ctx->DrawBuffer->Visual.blueBits;
          break;
       case GL_BLUE_SCALE:
@@ -3973,27 +3964,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode);
          break;
       case GL_CURRENT_COLOR:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
          params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
          params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
          params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
-         }
          break;
       case GL_CURRENT_INDEX:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
-         }
          break;
       case GL_CURRENT_NORMAL:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
          params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
          params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
-         }
          break;
       case GL_CURRENT_RASTER_COLOR:
          params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]);
@@ -4086,10 +4071,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]);
          break;
       case GL_EDGE_FLAG:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
-         }
          break;
       case GL_FEEDBACK_BUFFER_SIZE:
          params[0] = ctx->Feedback.BufferSize;
@@ -4131,12 +4114,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Pixel.GreenBias);
          break;
       case GL_GREEN_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = ctx->DrawBuffer->Visual.greenBits;
          break;
       case GL_GREEN_SCALE:
          params[0] = IROUND(ctx->Pixel.GreenScale);
          break;
       case GL_INDEX_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = ctx->DrawBuffer->Visual.indexBits;
          break;
       case GL_INDEX_CLEAR_VALUE:
@@ -4567,6 +4554,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Pixel.RedBias);
          break;
       case GL_RED_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = ctx->DrawBuffer->Visual.redBits;
          break;
       case GL_RED_SCALE:
@@ -5097,13 +5086,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetIntegerv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
          params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
          params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
          params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
-         }
          break;
       case GL_SECONDARY_COLOR_ARRAY_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetIntegerv");
@@ -5123,10 +5110,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          break;
       case GL_CURRENT_FOG_COORDINATE_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetIntegerv");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
-         }
          break;
       case GL_FOG_COORDINATE_ARRAY_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetIntegerv");
@@ -5706,9 +5691,6 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    if (ctx->Driver.GetInteger64v &&
        ctx->Driver.GetInteger64v(ctx, pname, params))
       return;
@@ -5736,6 +5718,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = IROUND64(ctx->Pixel.AlphaBias);
          break;
       case GL_ALPHA_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits);
          break;
       case GL_ALPHA_SCALE:
@@ -5796,6 +5780,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = IROUND64(ctx->Pixel.BlueBias);
          break;
       case GL_BLUE_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits);
          break;
       case GL_BLUE_SCALE:
@@ -5850,27 +5836,21 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = ENUM_TO_INT64(ctx->Polygon.CullFaceMode);
          break;
       case GL_CURRENT_COLOR:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
          params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
          params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
          params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
-         }
          break;
       case GL_CURRENT_INDEX:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
-         }
          break;
       case GL_CURRENT_NORMAL:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
          params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
          params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
-         }
          break;
       case GL_CURRENT_RASTER_COLOR:
          params[0] = FLOAT_TO_INT64(ctx->Current.RasterColor[0]);
@@ -5963,10 +5943,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]);
          break;
       case GL_EDGE_FLAG:
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = BOOLEAN_TO_INT64((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
-         }
          break;
       case GL_FEEDBACK_BUFFER_SIZE:
          params[0] = (GLint64)(ctx->Feedback.BufferSize);
@@ -6008,12 +5986,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = IROUND64(ctx->Pixel.GreenBias);
          break;
       case GL_GREEN_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits);
          break;
       case GL_GREEN_SCALE:
          params[0] = IROUND64(ctx->Pixel.GreenScale);
          break;
       case GL_INDEX_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits);
          break;
       case GL_INDEX_CLEAR_VALUE:
@@ -6444,6 +6426,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = IROUND64(ctx->Pixel.RedBias);
          break;
       case GL_RED_BITS:
+         if (ctx->NewState & _NEW_BUFFERS)
+            _mesa_update_state(ctx);
          params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits);
          break;
       case GL_RED_SCALE:
@@ -6974,13 +6958,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetInteger64v");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
          params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
          params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
          params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
-         }
          break;
       case GL_SECONDARY_COLOR_ARRAY_EXT:
          CHECK_EXT1(EXT_secondary_color, "GetInteger64v");
@@ -7000,10 +6982,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          break;
       case GL_CURRENT_FOG_COORDINATE_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetInteger64v");
-         {
          FLUSH_CURRENT(ctx, 0);
          params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
-         }
          break;
       case GL_FOG_COORDINATE_ARRAY_EXT:
          CHECK_EXT1(EXT_fog_coord, "GetInteger64v");
@@ -7606,14 +7586,12 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    switch (pname) {
       case GL_BLEND:
          CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+            return;
          }
          params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1));
          break;
@@ -7621,6 +7599,7 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
          CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+            return;
          }
          params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0);
          params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0);
@@ -7641,14 +7620,12 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    switch (pname) {
       case GL_BLEND:
          CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+            return;
          }
          params[0] = ((ctx->Color.BlendEnabled >> index) & 1);
          break;
@@ -7656,6 +7633,7 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
          CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+            return;
          }
          params[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0;
          params[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0;
@@ -7677,14 +7655,12 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
    if (!params)
       return;
 
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
    switch (pname) {
       case GL_BLEND:
          CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+            return;
          }
          params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1));
          break;
@@ -7692,6 +7668,7 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
          CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
          if (index >= ctx->Const.MaxDrawBuffers) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+            return;
          }
          params[0] = (GLint64)(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0);
          params[1] = (GLint64)(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0);
index 0ef9d8fe94ede14416fe14e3f5afbd3d7a2b2f69..cecb86d76a164f47ac27cb57ae0b77a48141b140 100644 (file)
@@ -49,123 +49,132 @@ TypeStrings = {
 }
 
 
+NoState = None
+NoExt = None
+FlushCurrent = 1
+
+
 # Each entry is a tuple of:
 #  - the GL state name, such as GL_CURRENT_COLOR
 #  - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
 #  - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
 #  - optional extra code or empty string.  If present, "CONVERSION" will be
 #    replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc.
-#  - optional extensions to check, or None
+#  - state flags: either NoExt, FlushCurrent or "_NEW_xxx"
+#    if NoExt, do nothing special
+#    if FlushCurrent, emit FLUSH_CURRENT() call
+#    if "_NEW_xxx", call _mesa_update_state() if that dirty state flag is set
+#  - optional extensions to check, or NoExt
 #
 StateVars = [
        ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_ACCUM_CLEAR_VALUE", GLfloatN,
          [ "ctx->Accum.ClearColor[0]",
                "ctx->Accum.ClearColor[1]",
                "ctx->Accum.ClearColor[2]",
                "ctx->Accum.ClearColor[3]" ],
-         "", None ),
-       ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ),
+         "", NoState, NoExt ),
+       ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", NoState, NoExt ),
        ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
-         "", None ),
-       ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ),
-       ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
-       ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
-       ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
-       ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ),
-       ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ),
+         "", "_NEW_BUFFERS", NoExt ),
+       ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", NoState, NoExt ),
+       ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", NoState, NoExt ),
+       ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", NoState, NoExt ),
+       ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", NoState, NoExt ),
+       ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", NoState, NoExt ),
+       ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", NoState, NoExt ),
        ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"],
-         "", None ),
-       ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", None ),
-       ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
-       ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
-       ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
-       ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
-       ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ),
-       ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ),
-       ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
+         "", NoState, NoExt ),
+       ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", NoState, NoExt ),
+       ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ),
+       ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ),
+       ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ),
+       ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ),
+       ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", NoState, NoExt ),
+       ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", NoState, NoExt ),
+       ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", NoState, NoExt),
        ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_BLEND_COLOR_EXT", GLfloatN,
          [ "ctx->Color.BlendColor[0]",
                "ctx->Color.BlendColor[1]",
                "ctx->Color.BlendColor[2]",
-               "ctx->Color.BlendColor[3]"], "", None ),
-       ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ),
-       ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
-       ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ),
+               "ctx->Color.BlendColor[3]"], "", NoState, NoExt ),
+       ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", NoState, NoExt ),
+       ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", "_NEW_BUFFERS", NoExt ),
+       ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", NoState, NoExt ),
        ( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint,
-         ["ctx->ClientAttribStackDepth"], "", None ),
+         ["ctx->ClientAttribStackDepth"], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE0", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE1", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE2", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE3", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE4", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", NoState, NoExt ),
        ( "GL_CLIP_PLANE5", GLboolean,
-         [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
+         [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", NoState, NoExt ),
        ( "GL_COLOR_CLEAR_VALUE", GLfloatN,
          [ "ctx->Color.ClearColor[0]",
                "ctx->Color.ClearColor[1]",
                "ctx->Color.ClearColor[2]",
-               "ctx->Color.ClearColor[3]" ], "", None ),
+               "ctx->Color.ClearColor[3]" ], "", NoState, NoExt ),
        ( "GL_COLOR_MATERIAL", GLboolean,
-         ["ctx->Light.ColorMaterialEnabled"], "", None ),
+         ["ctx->Light.ColorMaterialEnabled"], "", NoState, NoExt ),
        ( "GL_COLOR_MATERIAL_FACE", GLenum,
-         ["ctx->Light.ColorMaterialFace"], "", None ),
+         ["ctx->Light.ColorMaterialFace"], "", NoState, NoExt ),
        ( "GL_COLOR_MATERIAL_PARAMETER", GLenum,
-         ["ctx->Light.ColorMaterialMode"], "", None ),
+         ["ctx->Light.ColorMaterialMode"], "", NoState, NoExt ),
        ( "GL_COLOR_WRITEMASK", GLint,
          [ "ctx->Color.ColorMask[0][RCOMP] ? 1 : 0",
                "ctx->Color.ColorMask[0][GCOMP] ? 1 : 0",
                "ctx->Color.ColorMask[0][BCOMP] ? 1 : 0",
-               "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", None ),
-       ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
-       ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
+               "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", NoState, NoExt ),
+       ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", NoState, NoExt ),
+       ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", NoState, NoExt ),
        ( "GL_CURRENT_COLOR", GLfloatN,
          [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
                "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
                "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
                "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
-         "FLUSH_CURRENT(ctx, 0);", None ),
+         "", FlushCurrent, NoExt ),
        ( "GL_CURRENT_INDEX", GLfloat,
          [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
-         "FLUSH_CURRENT(ctx, 0);", None ),
+         "", FlushCurrent, NoExt ),
        ( "GL_CURRENT_NORMAL", GLfloatN,
          [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
                "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
                "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
-         "FLUSH_CURRENT(ctx, 0);", None ),
+         "", FlushCurrent, NoExt ),
        ( "GL_CURRENT_RASTER_COLOR", GLfloatN,
          ["ctx->Current.RasterColor[0]",
           "ctx->Current.RasterColor[1]",
           "ctx->Current.RasterColor[2]",
-          "ctx->Current.RasterColor[3]"], "", None ),
+          "ctx->Current.RasterColor[3]"], "", NoState, NoExt ),
        ( "GL_CURRENT_RASTER_DISTANCE", GLfloat,
-         ["ctx->Current.RasterDistance"], "", None ),
+         ["ctx->Current.RasterDistance"], "", NoState, NoExt ),
        ( "GL_CURRENT_RASTER_INDEX", GLfloat,
-         ["1.0"], "", None ),
+         ["1.0"], "", NoState, NoExt ),
        ( "GL_CURRENT_RASTER_POSITION", GLfloat,
          ["ctx->Current.RasterPos[0]",
           "ctx->Current.RasterPos[1]",
           "ctx->Current.RasterPos[2]",
-          "ctx->Current.RasterPos[3]"], "", None ),
+          "ctx->Current.RasterPos[3]"], "", NoState, NoExt ),
        ( "GL_CURRENT_RASTER_SECONDARY_COLOR", GLfloatN,
          ["ctx->Current.RasterSecondaryColor[0]",
           "ctx->Current.RasterSecondaryColor[1]",
           "ctx->Current.RasterSecondaryColor[2]",
-          "ctx->Current.RasterSecondaryColor[3]"], "", None ),
+          "ctx->Current.RasterSecondaryColor[3]"], "", NoState, NoExt ),
        ( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat,
          ["ctx->Current.RasterTexCoords[unit][0]",
           "ctx->Current.RasterTexCoords[unit][1]",
@@ -177,9 +186,9 @@ StateVars = [
                         "glGet(raster tex coords, unit %u)", unit);
             return;
          }""",
-         None ),
+         NoState, NoExt ),
        ( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean,
-         ["ctx->Current.RasterPosValid"], "", None ),
+         ["ctx->Current.RasterPosValid"], "", NoState, NoExt ),
        ( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
          ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]",
           "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]",
@@ -192,85 +201,85 @@ StateVars = [
             return;
          }
          FLUSH_CURRENT(ctx, 0);""",
-         None ),
-       ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
+         NoState, NoExt ),
+       ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", NoState, NoExt ),
        ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
-         "", None ),
-       ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", None ),
-       ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
+         "", NoState, NoExt ),
+       ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", NoState, NoExt ),
+       ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", NoState, NoExt ),
        ( "GL_DEPTH_RANGE", GLfloatN,
-         [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
-       ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ),
-       ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
-       ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
-       ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
+         [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", NoState, NoExt ),
+       ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", NoState, NoExt ),
+       ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", NoState, NoExt ),
+       ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", NoState, NoExt ),
+       ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", NoState, NoExt ),
        ( "GL_DOUBLEBUFFER", GLboolean,
-         ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
-       ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
+         ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", NoState, NoExt ),
+       ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ),
        ( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
-         "FLUSH_CURRENT(ctx, 0);", None ),
-       ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
-       ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
-       ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
+         "", FlushCurrent, NoExt ),
+       ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", NoState, NoExt ),
+       ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", NoState, NoExt ),
+       ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", NoState, NoExt ),
        ( "GL_FOG_COLOR", GLfloatN,
          [ "ctx->Fog.Color[0]",
                "ctx->Fog.Color[1]",
                "ctx->Fog.Color[2]",
-               "ctx->Fog.Color[3]" ], "", None ),
-       ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
-       ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
-       ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
-       ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ),
-       ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
-       ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
-       ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
-       ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ),
+               "ctx->Fog.Color[3]" ], "", NoState, NoExt ),
+       ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", NoState, NoExt ),
+       ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", NoState, NoExt ),
+       ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", NoState, NoExt ),
+       ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", NoState, NoExt ),
+       ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", NoState, NoExt ),
+       ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", NoState, NoExt ),
+       ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", NoState, NoExt ),
+       ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", NoState, NoExt ),
        ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
-         "", None ),
-       ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ),
+         "", "_NEW_BUFFERS", NoExt ),
+       ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", NoState, NoExt ),
        ( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"],
-         "", None ),
-       ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ),
+         "", "_NEW_BUFFERS", NoExt ),
+       ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", NoState, NoExt ),
        ( "GL_INDEX_MODE", GLboolean, ["GL_FALSE"],
-         "", None ),
-       ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ),
-       ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ),
-       ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ),
-       ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
-       ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
-       ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
-       ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
-       ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
-       ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
-       ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
-       ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
-       ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
+         "", NoState, NoExt ),
+       ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", NoState, NoExt ),
+       ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", NoState, NoExt ),
+       ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", NoState, NoExt ),
+       ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", NoState, NoExt ),
+       ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", NoState, NoExt ),
        ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
          ["ctx->Light.Model.Ambient[0]",
           "ctx->Light.Model.Ambient[1]",
           "ctx->Light.Model.Ambient[2]",
-          "ctx->Light.Model.Ambient[3]"], "", None ),
+          "ctx->Light.Model.Ambient[3]"], "", NoState, NoExt ),
        ( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum,
-         ["ctx->Light.Model.ColorControl"], "", None ),
+         ["ctx->Light.Model.ColorControl"], "", NoState, NoExt ),
        ( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean,
-         ["ctx->Light.Model.LocalViewer"], "", None ),
-       ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
-       ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
-       ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
-       ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ),
-       ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ),
-       ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ),
-       ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
+         ["ctx->Light.Model.LocalViewer"], "", NoState, NoExt ),
+       ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", NoState, NoExt ),
+       ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", NoState, NoExt ),
+       ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", NoState, NoExt ),
+       ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", NoState, NoExt ),
+       ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", NoState, NoExt ),
+       ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", NoState, NoExt ),
+       ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", NoState, NoExt ),
        ( "GL_LINE_WIDTH_GRANULARITY", GLfloat,
-         ["ctx->Const.LineWidthGranularity"], "", None ),
+         ["ctx->Const.LineWidthGranularity"], "", NoState, NoExt ),
        ( "GL_LINE_WIDTH_RANGE", GLfloat,
          ["ctx->Const.MinLineWidthAA",
-          "ctx->Const.MaxLineWidthAA"], "", None ),
+          "ctx->Const.MaxLineWidthAA"], "", NoState, NoExt ),
        ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
          ["ctx->Const.MinLineWidth",
-          "ctx->Const.MaxLineWidth"], "", None ),
-       ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ),
-       ( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", None ),
+          "ctx->Const.MaxLineWidth"], "", NoState, NoExt ),
+       ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", NoState, NoExt ),
+       ( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", NoState, NoExt ),
        ( "GL_LIST_MODE", GLenum, ["mode"],
          """GLenum mode;
          if (!ctx->CompileFlag)
@@ -278,195 +287,195 @@ StateVars = [
          else if (ctx->ExecuteFlag)
             mode = GL_COMPILE_AND_EXECUTE;
          else
-            mode = GL_COMPILE;""", None ),
-       ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ),
-       ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
-       ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
-       ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ),
+            mode = GL_COMPILE;""", NoState, NoExt ),
+       ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", NoState, NoExt ),
+       ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", NoState, NoExt ),
+       ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", NoState, NoExt ),
+       ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", NoState, NoExt ),
        ( "GL_MAP1_GRID_DOMAIN", GLfloat,
          ["ctx->Eval.MapGrid1u1",
-          "ctx->Eval.MapGrid1u2"], "", None ),
-       ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ),
-       ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ),
-       ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ),
-       ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ),
-       ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ),
-       ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ),
-       ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ),
-       ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ),
-       ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ),
-       ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ),
+          "ctx->Eval.MapGrid1u2"], "", NoState, NoExt ),
+       ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", NoState, NoExt ),
+       ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", NoState, NoExt ),
+       ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", NoState, NoExt ),
+       ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", NoState, NoExt ),
+       ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", NoState, NoExt ),
+       ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", NoState, NoExt ),
+       ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", NoState, NoExt ),
+       ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", NoState, NoExt ),
+       ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", NoState, NoExt ),
+       ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", NoState, NoExt ),
        ( "GL_MAP2_GRID_DOMAIN", GLfloat,
          ["ctx->Eval.MapGrid2u1",
           "ctx->Eval.MapGrid2u2",
           "ctx->Eval.MapGrid2v1",
-          "ctx->Eval.MapGrid2v2"], "", None ),
+          "ctx->Eval.MapGrid2v2"], "", NoState, NoExt ),
        ( "GL_MAP2_GRID_SEGMENTS", GLint,
          ["ctx->Eval.MapGrid2un",
-          "ctx->Eval.MapGrid2vn"], "", None ),
-       ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ),
-       ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ),
-       ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ),
-       ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ),
-       ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ),
-       ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ),
-       ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ),
-       ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ),
-       ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ),
-       ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ),
-       ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
-
-       ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ),
-       ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ),
-       ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
-       ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
-       ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
-       ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ),
-       ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
-       ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ),
-       ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
-       ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ),
-       ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ),
-       ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
-       ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
-       ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ),
-       ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
+          "ctx->Eval.MapGrid2vn"], "", NoState, NoExt ),
+       ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", NoState, NoExt ),
+       ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", NoState, NoExt ),
+       ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", NoState, NoExt ),
+       ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", NoState, NoExt ),
+       ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", NoState, NoExt ),
+       ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", NoState, NoExt ),
+       ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", NoState, NoExt ),
+       ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", NoState, NoExt ),
+       ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", NoState, NoExt ),
+       ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", NoState, NoExt ),
+       ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", NoState, NoExt ),
+
+       ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ),
+       ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ),
+       ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", NoState, NoExt ),
+       ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ),
+       ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ),
+       ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", NoState, NoExt ),
+       ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", NoState, NoExt ),
+       ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", NoState, NoExt ),
+       ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", NoState, NoExt ),
+       ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", NoState, NoExt ),
+       ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", NoState, NoExt ),
+       ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", NoState, NoExt ),
+       ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", NoState, NoExt ),
+       ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", NoState, NoExt ),
+       ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", NoState, NoExt ),
        ( "GL_MAX_VIEWPORT_DIMS", GLint,
          ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_MODELVIEW_MATRIX", GLfloat,
          [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
                "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
                "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
                "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-         "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
-       ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
-       ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ),
-       ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
-       ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
-       ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ),
-       ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ),
-       ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ),
-       ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ),
-       ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ),
-       ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
-       ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ),
-       ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
+         "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", NoState, NoExt ),
+       ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", NoState, NoExt ),
+       ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", NoState, NoExt ),
+       ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", NoState, NoExt ),
+       ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", NoState, NoExt ),
+       ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", NoState, NoExt ),
+       ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", NoState, NoExt ),
+       ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", NoState, NoExt ),
+       ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", NoState, NoExt ),
+       ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", NoState, NoExt ),
+       ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", NoState, NoExt ),
+       ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", NoState, NoExt ),
+       ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", NoState, NoExt ),
        ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
-         ["ctx->Hint.PerspectiveCorrection"], "", None ),
-       ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
-       ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
-       ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
-       ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
-       ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
-       ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
-       ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
-       ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
-       ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
-       ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
-       ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
+         ["ctx->Hint.PerspectiveCorrection"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", NoState, NoExt ),
+       ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", NoState, NoExt ),
+       ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", NoState, NoExt ),
        ( "GL_POINT_SIZE_GRANULARITY", GLfloat,
-         ["ctx->Const.PointSizeGranularity"], "", None ),
+         ["ctx->Const.PointSizeGranularity"], "", NoState, NoExt ),
        ( "GL_POINT_SIZE_RANGE", GLfloat,
          ["ctx->Const.MinPointSizeAA",
-          "ctx->Const.MaxPointSizeAA"], "", None ),
+          "ctx->Const.MaxPointSizeAA"], "", NoState, NoExt ),
        ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
          ["ctx->Const.MinPointSize",
-          "ctx->Const.MaxPointSize"], "", None ),
-       ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
-       ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
-       ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
-       ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
+          "ctx->Const.MaxPointSize"], "", NoState, NoExt ),
+       ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", NoState, NoExt ),
+       ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", NoState, NoExt ),
+       ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", NoState, NoExt ),
+       ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", NoState, NoExt ),
        ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
-         ["ctx->Point.Threshold"], "", None ),
+         ["ctx->Point.Threshold"], "", NoState, NoExt ),
        ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
          ["ctx->Point.Params[0]",
           "ctx->Point.Params[1]",
-          "ctx->Point.Params[2]"], "", None ),
+          "ctx->Point.Params[2]"], "", NoState, NoExt ),
        ( "GL_POLYGON_MODE", GLenum,
          ["ctx->Polygon.FrontMode",
-          "ctx->Polygon.BackMode"], "", None ),
-       ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
-       ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
-       ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
-       ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", None ),
-       ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", None ),
-       ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ),
-       ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
-       ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
-       ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
+          "ctx->Polygon.BackMode"], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", NoState, NoExt ),
+       ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", NoState, NoExt ),
+       ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", NoState, NoExt ),
+       ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", NoState, NoExt ),
+       ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", NoState, NoExt ),
        ( "GL_PROJECTION_MATRIX", GLfloat,
          [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
                "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
                "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
                "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-         "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+         "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", NoState, NoExt ),
        ( "GL_PROJECTION_STACK_DEPTH", GLint,
-         ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
-       ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", None ),
-       ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ),
-       ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ),
-       ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ),
-       ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ),
+         ["ctx->ProjectionMatrixStack.Depth + 1"], "", NoState, NoExt ),
+       ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", NoState, NoExt ),
+       ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", NoState, NoExt ),
+       ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", "_NEW_BUFFERS", NoExt ),
+       ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", NoState, NoExt ),
+       ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", NoState, NoExt ),
        ( "GL_RESCALE_NORMAL", GLboolean,
-         ["ctx->Transform.RescaleNormals"], "", None ),
+         ["ctx->Transform.RescaleNormals"], "", NoState, NoExt ),
        ( "GL_RGBA_MODE", GLboolean, ["GL_TRUE"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_SCISSOR_BOX", GLint,
          ["ctx->Scissor.X",
           "ctx->Scissor.Y",
           "ctx->Scissor.Width",
-          "ctx->Scissor.Height"], "", None ),
-       ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
-       ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ),
-       ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
+          "ctx->Scissor.Height"], "", NoState, NoExt ),
+       ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", NoState, NoExt ),
+       ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", NoState, NoExt ),
+       ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", NoState, NoExt ),
        ( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean,
-         ["ctx->Texture.SharedPalette"], "", None ),
-       ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
-       ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
+         ["ctx->Texture.SharedPalette"], "", NoState, NoExt ),
+       ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", NoState, NoExt ),
+       ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", NoState, NoExt ),
        ( "GL_STENCIL_FAIL", GLenum,
-         ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STENCIL_FUNC", GLenum,
-         ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
-         ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
-         ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STENCIL_REF", GLint,
-         ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
-       ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
+         ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
+       ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", NoState, NoExt ),
        ( "GL_STENCIL_VALUE_MASK", GLint,
-         ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STENCIL_WRITEMASK", GLint,
-         ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
+         ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
        ( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"],
-         "", None ),
-       ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
-       ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ),
-       ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
-       ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ),
-       ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
-       ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
+         "", NoState, NoExt ),
+       ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", NoState, NoExt ),
+       ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", NoState, NoExt ),
+       ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", NoState, NoExt ),
+       ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", NoState, NoExt ),
+       ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ),
+       ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ),
        ( "GL_TEXTURE_BINDING_1D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", NoState, NoExt ),
        ( "GL_TEXTURE_BINDING_2D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", NoState, NoExt ),
        ( "GL_TEXTURE_BINDING_3D", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", NoState, NoExt ),
        ( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ),
        ( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint,
-         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
+         ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ),
        ( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT", GLint,
-         ["ctx->Const.MaxArrayTextureLayers"], "", ["MESA_texture_array"] ),
+         ["ctx->Const.MaxArrayTextureLayers"], "", NoState, ["MESA_texture_array"] ),
        ( "GL_TEXTURE_GEN_S", GLboolean,
-         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
+         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", NoState, NoExt ),
        ( "GL_TEXTURE_GEN_T", GLboolean,
-         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ),
+         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", NoState, NoExt ),
        ( "GL_TEXTURE_GEN_R", GLboolean,
-         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ),
+         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", NoState, NoExt ),
        ( "GL_TEXTURE_GEN_Q", GLboolean,
-         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ),
+         ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", NoState, NoExt ),
        ( "GL_TEXTURE_MATRIX", GLfloat,
          ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
           "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
@@ -480,7 +489,7 @@ StateVars = [
             return;
          }
          matrix = ctx->TextureMatrixStack[unit].Top->m;""",
-         None ),
+         NoState, NoExt ),
        ( "GL_TEXTURE_STACK_DEPTH", GLint,
          ["ctx->TextureMatrixStack[unit].Depth + 1"],
          """const GLuint unit = ctx->Texture.CurrentUnit;
@@ -489,77 +498,77 @@ StateVars = [
                         "glGet(texture stack depth, unit %u)", unit);
             return;
          }""",
-         None ),
-       ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
-       ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ),
-       ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ),
-       ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ),
-       ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ),
-       ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ),
-       ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ),
-       ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ),
-       ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ),
+         NoState, NoExt ),
+       ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", NoState, NoExt ),
+       ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", NoState, NoExt ),
+       ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", NoState, NoExt ),
+       ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", NoState, NoExt ),
+       ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", NoState, NoExt ),
+       ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", NoState, NoExt ),
+       ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", NoState, NoExt ),
+       ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", NoState, NoExt ),
+       ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", NoState, NoExt ),
        ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
-         "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
-       ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ),
-       ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ),
+         "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", NoState, NoExt ),
+       ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", NoState, NoExt ),
+       ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", NoState, NoExt ),
 
        # Vertex arrays
-       ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ),
-       ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ),
-       ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ),
-       ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ),
-       ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-       ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ),
-       ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ),
-       ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ),
-       ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-       ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ),
-       ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ),
-       ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ),
-       ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ),
-       ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-       ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", None ),
-       ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", None ),
-       ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", None ),
-       ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+       ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", NoState, NoExt ),
+       ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", NoState, NoExt ),
+       ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", NoState, NoExt ),
+       ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", NoState, NoExt ),
+       ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+       ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", NoState, NoExt ),
+       ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", NoState, NoExt ),
+       ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", NoState, NoExt ),
+       ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+       ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", NoState, NoExt ),
+       ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", NoState, NoExt ),
+       ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", NoState, NoExt ),
+       ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", NoState, NoExt ),
+       ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+       ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", NoState, NoExt ),
+       ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", NoState, NoExt ),
+       ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", NoState, NoExt ),
+       ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
        ( "GL_TEXTURE_COORD_ARRAY", GLboolean,
-         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
+         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", NoState, NoExt ),
        ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
-         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
+         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", NoState, NoExt ),
        ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
-         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
+         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", NoState, NoExt ),
        ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
-         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
-       ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-       ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", None ),
-       ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", None ),
-       ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+         ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", NoState, NoExt ),
+       ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+       ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", NoState, NoExt ),
+       ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", NoState, NoExt ),
+       ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
 
        # GL_ARB_multitexture
        ( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
-         ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
+         ["ctx->Const.MaxTextureUnits"], "", NoState, ["ARB_multitexture"] ),
        ( "GL_ACTIVE_TEXTURE_ARB", GLint,
-         [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
+         [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", NoState, ["ARB_multitexture"] ),
        ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
-         ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
+         ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", NoState, ["ARB_multitexture"] ),
 
        # GL_ARB_texture_cube_map
        ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
-         ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
+         ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", NoState, ["ARB_texture_cube_map"] ),
        ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
          ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"],
-         "", ["ARB_texture_cube_map"] ),
+         "", NoState, ["ARB_texture_cube_map"] ),
        ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
          ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
-         "", ["ARB_texture_cube_map"]),
+         "", NoState, ["ARB_texture_cube_map"]),
 
        # GL_ARB_texture_compression */
        ( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint,
-         ["ctx->Hint.TextureCompression"], "", None ),
+         ["ctx->Hint.TextureCompression"], "", NoState, NoExt ),
        ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
          ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
          [],
          """GLint formats[100];
@@ -567,13 +576,13 @@ StateVars = [
          ASSERT(n <= 100);
          for (i = 0; i < n; i++)
             params[i] = CONVERSION(formats[i]);""",
-         None ),
+         NoState, NoExt ),
 
        # GL_EXT_compiled_vertex_array
        ( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"],
-         "", ["EXT_compiled_vertex_array"] ),
+         "", NoState, ["EXT_compiled_vertex_array"] ),
        ( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"],
-         "", ["EXT_compiled_vertex_array"] ),
+         "", NoState, ["EXT_compiled_vertex_array"] ),
 
        # GL_ARB_transpose_matrix
        ( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat,
@@ -581,25 +590,29 @@ StateVars = [
           "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
           "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
           "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-         "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+         "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;",
+         NoState, NoExt ),
        ( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat,
          ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
           "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
           "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
           "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-         "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
+         "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;",
+         NoState, NoExt ),
        ( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat,
          ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
           "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
           "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
           "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-         "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+         "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;",
+         NoState, NoExt ),
        ( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat,
          ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
           "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
           "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
           "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-         "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
+         "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;",
+         NoState, NoExt ),
 
        # GL_SGI_color_matrix (also in 1.2 imaging)
        ( "GL_COLOR_MATRIX_SGI", GLfloat,
@@ -607,343 +620,373 @@ StateVars = [
           "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
           "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
           "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-         "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+         "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;",
+         NoState, NoExt ),
        ( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
-         ["ctx->ColorMatrixStack.Depth + 1"], "", None ),
+         ["ctx->ColorMatrixStack.Depth + 1"], "", NoState, NoExt ),
        ( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
-         ["MAX_COLOR_STACK_DEPTH"], "", None ),
+         ["MAX_COLOR_STACK_DEPTH"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixScale[0]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixScale[1]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixScale[2]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixScale[3]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixBias[0]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixBias[1]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixBias[2]"], "", NoState, NoExt ),
        ( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat,
-         ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ),
+         ["ctx->Pixel.PostColorMatrixBias[3]"], "", NoState, NoExt ),
 
        # GL_EXT_convolution (also in 1.2 imaging)
        ( "GL_CONVOLUTION_1D_EXT", GLboolean,
-         ["ctx->Pixel.Convolution1DEnabled"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.Convolution1DEnabled"], "", NoState, ["EXT_convolution"] ),
        ( "GL_CONVOLUTION_2D_EXT", GLboolean,
-         ["ctx->Pixel.Convolution2DEnabled"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.Convolution2DEnabled"], "", NoState, ["EXT_convolution"] ),
        ( "GL_SEPARABLE_2D_EXT", GLboolean,
-         ["ctx->Pixel.Separable2DEnabled"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.Separable2DEnabled"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionScale[0]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionScale[0]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionScale[1]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionScale[1]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionScale[2]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionScale[2]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionScale[3]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionScale[3]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionBias[0]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionBias[0]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionBias[1]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionBias[1]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionBias[2]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionBias[2]"], "", NoState, ["EXT_convolution"] ),
        ( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat,
-         ["ctx->Pixel.PostConvolutionBias[3]"], "", ["EXT_convolution"] ),
+         ["ctx->Pixel.PostConvolutionBias[3]"], "", NoState, ["EXT_convolution"] ),
 
        # GL_EXT_histogram / GL_ARB_imaging
        ( "GL_HISTOGRAM", GLboolean,
-         [ "ctx->Pixel.HistogramEnabled" ], "", ["EXT_histogram"] ),
+         [ "ctx->Pixel.HistogramEnabled" ], "", NoState, ["EXT_histogram"] ),
        ( "GL_MINMAX", GLboolean,
-         [ "ctx->Pixel.MinMaxEnabled" ], "", ["EXT_histogram"] ),
+         [ "ctx->Pixel.MinMaxEnabled" ], "", NoState, ["EXT_histogram"] ),
 
        # GL_SGI_color_table / GL_ARB_imaging
        ( "GL_COLOR_TABLE_SGI", GLboolean,
-         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
+         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "",
+         NoState, ["SGI_color_table"] ),
        ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
-         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
+         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "",
+         NoState, ["SGI_color_table"] ),
        ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
-         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
+         ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "",
+         NoState, ["SGI_color_table"] ),
 
        # GL_SGI_texture_color_table
        ( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
          ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"],
-         "", ["SGI_texture_color_table"] ),
+         "", NoState, ["SGI_texture_color_table"] ),
 
        # GL_EXT_secondary_color
        ( "GL_COLOR_SUM_EXT", GLboolean,
-         ["ctx->Fog.ColorSumEnabled"], "",
+         ["ctx->Fog.ColorSumEnabled"], "", NoState,
          ["EXT_secondary_color", "ARB_vertex_program"] ),
        ( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN,
          ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]",
           "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]",
           "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]",
           "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"],
-         "FLUSH_CURRENT(ctx, 0);", ["EXT_secondary_color"] ),
+         "", FlushCurrent, ["EXT_secondary_color"] ),
        ( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean,
-         ["ctx->Array.ArrayObj->SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
+         ["ctx->Array.ArrayObj->SecondaryColor.Enabled"],
+         "", NoState, ["EXT_secondary_color"] ),
        ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
-         ["ctx->Array.ArrayObj->SecondaryColor.Type"], "",  ["EXT_secondary_color"] ),
+         ["ctx->Array.ArrayObj->SecondaryColor.Type"],
+         "", NoState,  ["EXT_secondary_color"] ),
        ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
-         ["ctx->Array.ArrayObj->SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
+         ["ctx->Array.ArrayObj->SecondaryColor.Stride"],
+         "", NoState, ["EXT_secondary_color"] ),
        ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
-         ["ctx->Array.ArrayObj->SecondaryColor.Size"], "", ["EXT_secondary_color"] ),
+         ["ctx->Array.ArrayObj->SecondaryColor.Size"],
+         "", NoState, ["EXT_secondary_color"] ),
 
        # GL_EXT_fog_coord
        ( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat,
          ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"],
-         "FLUSH_CURRENT(ctx, 0);", ["EXT_fog_coord"] ),
-       ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.ArrayObj->FogCoord.Enabled"],
-         "",  ["EXT_fog_coord"] ),
-       ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.ArrayObj->FogCoord.Type"],
-         "", ["EXT_fog_coord"] ),
-       ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.ArrayObj->FogCoord.Stride"],
-         "", ["EXT_fog_coord"] ),
-       ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"],
-         "", ["EXT_fog_coord"] ),
+         "", FlushCurrent, ["EXT_fog_coord"] ),
+       ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean,
+         ["ctx->Array.ArrayObj->FogCoord.Enabled"],
+         "", NoState,  ["EXT_fog_coord"] ),
+       ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum,
+         ["ctx->Array.ArrayObj->FogCoord.Type"],
+         "", NoState, ["EXT_fog_coord"] ),
+       ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint,
+         ["ctx->Array.ArrayObj->FogCoord.Stride"],
+         "", NoState, ["EXT_fog_coord"] ),
+       ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum,
+         ["ctx->Fog.FogCoordinateSource"],
+         "", NoState, ["EXT_fog_coord"] ),
 
        # GL_EXT_texture_lod_bias
        ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
-         ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
+         ["ctx->Const.MaxTextureLodBias"], "", NoState, ["EXT_texture_lod_bias"]),
 
        # GL_EXT_texture_filter_anisotropic
        ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
-         ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
+         ["ctx->Const.MaxTextureMaxAnisotropy"],
+         "", NoState, ["EXT_texture_filter_anisotropic"]),
 
        # GL_ARB_multisample
        ( "GL_MULTISAMPLE_ARB", GLboolean,
-         ["ctx->Multisample.Enabled"], "", None ),
+         ["ctx->Multisample.Enabled"], "", NoState, NoExt ),
        ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
-         ["ctx->Multisample.SampleAlphaToCoverage"], "", None ),
+         ["ctx->Multisample.SampleAlphaToCoverage"], "", NoState, NoExt ),
        ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
-         ["ctx->Multisample.SampleAlphaToOne"], "", None ),
+         ["ctx->Multisample.SampleAlphaToOne"], "", NoState, NoExt ),
        ( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
-         ["ctx->Multisample.SampleCoverage"], "", None ),
+         ["ctx->Multisample.SampleCoverage"], "", NoState, NoExt ),
        ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
-         ["ctx->Multisample.SampleCoverageValue"], "", None ),
+         ["ctx->Multisample.SampleCoverageValue"], "", NoState, NoExt ),
        ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
-         ["ctx->Multisample.SampleCoverageInvert"], "", None ),
+         ["ctx->Multisample.SampleCoverageInvert"], "", NoState, NoExt ),
        ( "GL_SAMPLE_BUFFERS_ARB", GLint,
-         ["ctx->DrawBuffer->Visual.sampleBuffers"], "", None ),
+         ["ctx->DrawBuffer->Visual.sampleBuffers"], "", NoState, NoExt ),
        ( "GL_SAMPLES_ARB", GLint,
-         ["ctx->DrawBuffer->Visual.samples"], "", None ),
+         ["ctx->DrawBuffer->Visual.samples"], "", NoState, NoExt ),
 
        # GL_IBM_rasterpos_clip
        ( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean,
-         ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
+         ["ctx->Transform.RasterPositionUnclipped"],
+         "", NoState, ["IBM_rasterpos_clip"] ),
 
        # GL_NV_point_sprite
        ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
-         "", ["NV_point_sprite", "ARB_point_sprite"] ),
+         "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ),
        ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
-         "", ["NV_point_sprite"] ),
+         "", NoState, ["NV_point_sprite"] ),
        ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
-         "", ["NV_point_sprite", "ARB_point_sprite"] ),
+         "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ),
 
        # GL_SGIS_generate_mipmap
        ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
-         "", ["SGIS_generate_mipmap"] ),
+         "", NoState, ["SGIS_generate_mipmap"] ),
 
        # GL_NV_vertex_program
        ( "GL_VERTEX_PROGRAM_BINDING_NV", GLint,
          ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"],
-         "", ["NV_vertex_program"] ),
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
-         ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"], "", ["NV_vertex_program"] ),
+         ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"],
+         "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[0]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[0]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[1]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[1]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[2]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[2]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[3]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[3]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[4]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[4]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[5]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[5]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[6]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[6]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[7]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[7]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[8]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[8]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[9]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[9]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[10]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[10]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[11]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[11]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[12]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[12]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[13]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[13]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[14]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[14]"], "", NoState, ["NV_vertex_program"] ),
        ( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean,
-         ["ctx->Eval.Map1Attrib[15]"], "", ["NV_vertex_program"] ),
+         ["ctx->Eval.Map1Attrib[15]"], "", NoState, ["NV_vertex_program"] ),
 
        # GL_NV_fragment_program
        ( "GL_FRAGMENT_PROGRAM_NV", GLboolean,
-         ["ctx->FragmentProgram.Enabled"], "", ["NV_fragment_program"] ),
+         ["ctx->FragmentProgram.Enabled"], "", NoState, ["NV_fragment_program"] ),
        ( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint,
          ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"],
-         "", ["NV_fragment_program"] ),
+         "", NoState, ["NV_fragment_program"] ),
        ( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint,
-         ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", ["NV_fragment_program"] ),
+         ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", NoState, ["NV_fragment_program"] ),
 
        # GL_NV_texture_rectangle
        ( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
-         ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
+         ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", NoState, ["NV_texture_rectangle"] ),
        ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
          ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"],
-         "", ["NV_texture_rectangle"] ),
+         "", NoState, ["NV_texture_rectangle"] ),
        ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
-         ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
+         ["ctx->Const.MaxTextureRectSize"], "", NoState, ["NV_texture_rectangle"] ),
 
        # GL_EXT_stencil_two_side
        ( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean,
-         ["ctx->Stencil.TestTwoSide"], "", ["EXT_stencil_two_side"] ),
+         ["ctx->Stencil.TestTwoSide"], "", NoState, ["EXT_stencil_two_side"] ),
        ( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum,
          ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"],
-         "", ["EXT_stencil_two_side"] ),
+         "", NoState, ["EXT_stencil_two_side"] ),
 
        # GL_NV_light_max_exponent
        ( "GL_MAX_SHININESS_NV", GLfloat,
-         ["ctx->Const.MaxShininess"], "", ["NV_light_max_exponent"] ),
+         ["ctx->Const.MaxShininess"], "", NoState, ["NV_light_max_exponent"] ),
        ( "GL_MAX_SPOT_EXPONENT_NV", GLfloat,
-         ["ctx->Const.MaxSpotExponent"], "", ["NV_light_max_exponent"] ),
+         ["ctx->Const.MaxSpotExponent"], "", NoState, ["NV_light_max_exponent"] ),
 
        # GL_ARB_vertex_buffer_object
        ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayBufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayBufferObj->Name"], "", NoState, NoExt ),
        ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", NoState, NoExt ),
        ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", NoState, NoExt ),
        ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", NoState, NoExt ),
        ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", NoState, NoExt ),
        ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
          ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
-         ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", None ),
+         ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", NoState, NoExt ),
        ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
          ["ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name"],
-         "", None ),
+         "", NoState, NoExt ),
        ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
          ["ctx->Array.ArrayObj->FogCoord.BufferObj->Name"],
-         "", None ),
+         "", NoState, NoExt ),
        # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
        ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
          ["ctx->Array.ElementArrayBufferObj->Name"],
-         "", None ),
+         "", NoState, NoExt ),
 
        # GL_EXT_pixel_buffer_object
        ( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint,
-         ["ctx->Pack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+         ["ctx->Pack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ),
        ( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint,
-         ["ctx->Unpack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+         ["ctx->Unpack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ),
 
        # GL_ARB_vertex_program
        ( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV
-         ["ctx->VertexProgram.Enabled"], "",
+         ["ctx->VertexProgram.Enabled"], "", NoState,
          ["ARB_vertex_program", "NV_vertex_program"] ),
        ( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV
-         ["ctx->VertexProgram.PointSizeEnabled"], "",
+         ["ctx->VertexProgram.PointSizeEnabled"], "", NoState,
          ["ARB_vertex_program", "NV_vertex_program"] ),
        ( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV
-         ["ctx->VertexProgram.TwoSideEnabled"], "",
+         ["ctx->VertexProgram.TwoSideEnabled"], "", NoState,
          ["ARB_vertex_program", "NV_vertex_program"] ),
        ( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
-         ["ctx->Const.MaxProgramMatrixStackDepth"], "",
+         ["ctx->Const.MaxProgramMatrixStackDepth"], "", NoState,
          ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
        ( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV
-         ["ctx->Const.MaxProgramMatrices"], "",
+         ["ctx->Const.MaxProgramMatrices"], "", NoState,
          ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
        ( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV
-         ["ctx->CurrentStack->Depth + 1"], "",
+         ["ctx->CurrentStack->Depth + 1"], "", NoState,
          ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
        ( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV
          ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
           "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
           "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
           "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-         "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+         "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState,
          ["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ),
        ( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat,
          ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
           "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
           "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
           "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-         "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+         "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState,
          ["ARB_vertex_program", "ARB_fragment_program"] ),
        ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
-         ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
+         ["ctx->Const.VertexProgram.MaxAttribs"], "", NoState, ["ARB_vertex_program"] ),
        ( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV
-         ["ctx->Program.ErrorPos"], "", ["NV_vertex_program",
+         ["ctx->Program.ErrorPos"], "", NoState, ["NV_vertex_program",
           "ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ),
 
        # GL_ARB_fragment_program
        ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
-         ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
+         ["ctx->FragmentProgram.Enabled"], "", NoState, ["ARB_fragment_program"] ),
        ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
-         ["ctx->Const.MaxTextureCoordUnits"], "",
+         ["ctx->Const.MaxTextureCoordUnits"], "", NoState,
          ["ARB_fragment_program", "NV_fragment_program"] ),
        ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV
-         ["ctx->Const.MaxTextureImageUnits"], "",
+         ["ctx->Const.MaxTextureImageUnits"], "", NoState,
          ["ARB_fragment_program", "NV_fragment_program"] ),
 
        # GL_EXT_depth_bounds_test
        ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,
-         ["ctx->Depth.BoundsTest"], "", ["EXT_depth_bounds_test"] ),
+         ["ctx->Depth.BoundsTest"], "", NoState, ["EXT_depth_bounds_test"] ),
        ( "GL_DEPTH_BOUNDS_EXT", GLfloat,
          ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
-         "", ["EXT_depth_bounds_test"] ),
+         "", NoState, ["EXT_depth_bounds_test"] ),
 
        # GL_ARB_depth_clamp
        ( "GL_DEPTH_CLAMP", GLboolean, ["ctx->Transform.DepthClamp"], "",
-         ["ARB_depth_clamp"] ),
+         NoState, ["ARB_depth_clamp"] ),
 
        # GL_ARB_draw_buffers
        ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
-         ["ctx->Const.MaxDrawBuffers"], "", None ),
+         ["ctx->Const.MaxDrawBuffers"], "", NoState, NoExt ),
        ( "GL_DRAW_BUFFER0_ARB", GLenum,
-         ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
+         ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ),
        ( "GL_DRAW_BUFFER1_ARB", GLenum,
          ["buffer"],
          """GLenum buffer;
@@ -951,7 +994,7 @@ StateVars = [
             _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
             return;
          }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", None ),
+         buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", NoState, NoExt ),
        ( "GL_DRAW_BUFFER2_ARB", GLenum,
          ["buffer"],
          """GLenum buffer;
@@ -959,7 +1002,7 @@ StateVars = [
             _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
             return;
          }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", None ),
+         buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", NoState, NoExt ),
        ( "GL_DRAW_BUFFER3_ARB", GLenum,
          ["buffer"],
          """GLenum buffer;
@@ -967,118 +1010,138 @@ StateVars = [
             _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
             return;
          }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", None ),
+         buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", NoState, NoExt ),
        # XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
 
        # GL_OES_read_format
        ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
-         ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ),
+         ["_mesa_get_color_read_type(ctx)"], "", NoState, ["OES_read_format"] ),
        ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
-         ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ),
+         ["_mesa_get_color_read_format(ctx)"], "", NoState, ["OES_read_format"] ),
 
        # GL_ATI_fragment_shader
-       ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_PASSES_ATI", GLint, ["2"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", ["ATI_fragment_shader"] ),
-       ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
-       ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
+       ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_PASSES_ATI", GLint, ["2"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"],
+         "", NoState, ["ATI_fragment_shader"] ),
+       ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"],
+         "", NoState, ["ATI_fragment_shader"] ),
 
        # OpenGL 2.0
-       ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
-       ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
-       ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ),
-       ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
-       ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
-       ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
-       ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
+       ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"],
+         "", NoState, NoExt ),
+       ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"],
+         "", NoState, NoExt ),
 
        # GL_EXT_framebuffer_object
        ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
-         ["EXT_framebuffer_object"] ),
+         NoState, ["EXT_framebuffer_object"] ),
        ( "GL_RENDERBUFFER_BINDING_EXT", GLint,
          ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
-         ["EXT_framebuffer_object"] ),
+         NoState, ["EXT_framebuffer_object"] ),
        ( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint,
          ["ctx->Const.MaxColorAttachments"], "",
-         ["EXT_framebuffer_object"] ),
+         NoState, ["EXT_framebuffer_object"] ),
        ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
          ["ctx->Const.MaxRenderbufferSize"], "",
-         ["EXT_framebuffer_object"] ),
+         NoState, ["EXT_framebuffer_object"] ),
 
        # GL_EXT_framebuffer_blit
        # NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
        ( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "",
-         ["EXT_framebuffer_blit"] ),
+         NoState, ["EXT_framebuffer_blit"] ),
 
        # GL_EXT_provoking_vertex
        ( "GL_PROVOKING_VERTEX_EXT", GLboolean,
-         ["ctx->Light.ProvokingVertex"], "", ["EXT_provoking_vertex"] ),
+         ["ctx->Light.ProvokingVertex"], "", NoState, ["EXT_provoking_vertex"] ),
        ( "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", GLboolean,
          ["ctx->Const.QuadsFollowProvokingVertexConvention"], "",
-         ["EXT_provoking_vertex"] ),
+         NoState, ["EXT_provoking_vertex"] ),
 
        # GL_ARB_fragment_shader
        ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
          ["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
-         ["ARB_fragment_shader"] ),
+         NoState, ["ARB_fragment_shader"] ),
        ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
-         ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
+         ["ctx->Hint.FragmentShaderDerivative"],
+         "", NoState, ["ARB_fragment_shader"] ),
 
        # GL_ARB_vertex_shader
        ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
          ["ctx->Const.VertexProgram.MaxUniformComponents"], "",
-         ["ARB_vertex_shader"] ),
+         NoState, ["ARB_vertex_shader"] ),
        ( "GL_MAX_VARYING_FLOATS_ARB", GLint,
-         ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ),
+         ["ctx->Const.MaxVarying * 4"], "", NoState, ["ARB_vertex_shader"] ),
        ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
-         ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
+         ["ctx->Const.MaxVertexTextureImageUnits"],
+         "", NoState, ["ARB_vertex_shader"] ),
        ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
-         ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ),
+         ["ctx->Const.MaxCombinedTextureImageUnits"],
+         "", NoState, ["ARB_vertex_shader"] ),
 
        # GL_ARB_shader_objects
        # Actually, this token isn't part of GL_ARB_shader_objects, but is
        # close enough for now.
        ( "GL_CURRENT_PROGRAM", GLint,
          ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
-         "", ["ARB_shader_objects"] ),
+         "", NoState, ["ARB_shader_objects"] ),
 
        # GL_ARB_framebuffer_object
        ( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "",
-         ["ARB_framebuffer_object"] ),
+         NoState, ["ARB_framebuffer_object"] ),
 
        # GL_APPLE_vertex_array_object
        ( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "",
-         ["APPLE_vertex_array_object"] ),
+         NoState, ["APPLE_vertex_array_object"] ),
 
        # GL_ARB_seamless_cube_map
        ( "GL_TEXTURE_CUBE_MAP_SEAMLESS", GLboolean, ["ctx->Texture.CubeMapSeamless"], "",
-         ["ARB_seamless_cube_map"] ),
+         NoState, ["ARB_seamless_cube_map"] ),
 
        # GL_ARB_sync
        ( "GL_MAX_SERVER_WAIT_TIMEOUT", GLint64, ["ctx->Const.MaxServerWaitTimeout"], "",
-         ["ARB_sync"] ),
+         NoState, ["ARB_sync"] ),
 
        # GL3
-       ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", None ),
-       ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", None ),
-       ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", None ),
-       ( "GL_CONTEXT_FLAGS", GLint, ["ctx->Const.ContextFlags"], "", None )
+       ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", NoState, NoExt ),
+       ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", NoState, NoExt ),
+       ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", NoState, NoExt ),
+       ( "GL_CONTEXT_FLAGS", GLint, ["ctx->Const.ContextFlags"], "", NoState, NoExt )
 ]
 
 
 # These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v()
+# The tuples are the same as above, with one exception: the "optional"
+# code field is instead the max legal index value.
 IndexedStateVars = [
        ( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"],
-         "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
+         "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ),
        ( "GL_COLOR_WRITEMASK", GLint,
          [ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0",
                "ctx->Color.ColorMask[index][GCOMP] ? 1 : 0",
                "ctx->Color.ColorMask[index][BCOMP] ? 1 : 0",
                "ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ],
-         "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
+         "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ),
        # XXX more to come...
 ]
 
@@ -1155,9 +1218,6 @@ def EmitGetFunction(stateVars, returnType, indexed):
        print "   if (!params)"
        print "      return;"
        print ""
-       print "   if (ctx->NewState)"
-       print "      _mesa_update_state(ctx);"
-       print ""
        if indexed == 0:
                print "   if (ctx->Driver.%s &&" % function
                print "       ctx->Driver.%s(ctx, pname, params))" % function
@@ -1167,12 +1227,14 @@ def EmitGetFunction(stateVars, returnType, indexed):
 
        for state in stateVars:
                if indexed:
-                       (name, varType, state, indexMax, extensions) = state
+                       (name, varType, state, indexMax, dirtyFlags, extensions) = state
                        optionalCode = 0
                else:
-                       (name, varType, state, optionalCode, extensions) = state
+                       (name, varType, state, optionalCode, dirtyFlags, extensions) = state
                        indexMax = 0
                print "      case " + name + ":"
+
+               # Do extension check
                if extensions:
                        if len(extensions) == 1:
                                print ('         CHECK_EXT1(%s, "%s");' %
@@ -1187,9 +1249,20 @@ def EmitGetFunction(stateVars, returnType, indexed):
                                assert len(extensions) == 4
                                print ('         CHECK_EXT4(%s, %s, %s, %s, "%s");' %
                                           (extensions[0], extensions[1], extensions[2], extensions[3], function))
+
+               # Do dirty state check
+               if dirtyFlags:
+                       if dirtyFlags == FlushCurrent:
+                               print ('         FLUSH_CURRENT(ctx, 0);')
+                       else:
+                               print ('         if (ctx->NewState & %s)' % dirtyFlags)
+                               print ('            _mesa_update_state(ctx);')
+
+               # Do index validation for glGet*Indexed() calls
                if indexMax:
                        print ('         if (index >= %s) {' % indexMax)
                        print ('            _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function)
+                       print ('            return;')
                        print ('         }')
 
                conversion = ConversionFunc(varType, returnType)