Fix more enums defined not only by one extension when queried by glGet (GL_COLOR_SUM_...
authorRoland Scheidegger <rscheidegger@gmx.ch>
Thu, 2 Mar 2006 12:06:57 +0000 (12:06 +0000)
committerRoland Scheidegger <rscheidegger@gmx.ch>
Thu, 2 Mar 2006 12:06:57 +0000 (12:06 +0000)
src/mesa/main/enable.c
src/mesa/main/get.c
src/mesa/main/get_gen.py

index 5efbf46a7556e5523be93ac0743fadcc48a35cce..26cf9ec654fd6cc54560883203aa12da6e2ee828 100644 (file)
@@ -759,7 +759,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
 
       /* GL_EXT_secondary_color */
       case GL_COLOR_SUM_EXT:
-         CHECK_EXTENSION(EXT_secondary_color, cap);
+         CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, cap);
          if (ctx->Fog.ColorSumEnabled == state)
             return;
          FLUSH_VERTICES(ctx, _NEW_FOG);
@@ -1037,6 +1037,12 @@ _mesa_Disable( GLenum cap )
       return GL_FALSE;                                 \
    }
 
+#undef CHECK_EXTENSION2
+#define CHECK_EXTENSION2(EXT1, EXT2)                           \
+   if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) {       \
+      _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");                \
+      return GL_FALSE;                                         \
+   }
 
 /**
  * Test whether a capability is enabled.
@@ -1262,6 +1268,11 @@ _mesa_IsEnabled( GLenum cap )
             return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
          }
 
+      /* GL_EXT_secondary_color */
+      case GL_COLOR_SUM_EXT:
+         CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program);
+         return ctx->Fog.ColorSumEnabled;
+
       /* GL_ARB_multisample */
       case GL_MULTISAMPLE_ARB:
          CHECK_EXTENSION(ARB_multisample);
@@ -1286,17 +1297,18 @@ _mesa_IsEnabled( GLenum cap )
 
       /* GL_NV_point_sprite */
       case GL_POINT_SPRITE_NV:
+         CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite)
          return ctx->Point.PointSprite;
 
 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
-      case GL_VERTEX_PROGRAM_NV:
-         CHECK_EXTENSION(NV_vertex_program);
+      case GL_VERTEX_PROGRAM_ARB:
+         CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
          return ctx->VertexProgram.Enabled;
-      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
-         CHECK_EXTENSION(NV_vertex_program);
+      case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
+         CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
          return ctx->VertexProgram.PointSizeEnabled;
-      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
-         CHECK_EXTENSION(NV_vertex_program);
+      case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
+         CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
          return ctx->VertexProgram.TwoSideEnabled;
 #endif
 #if FEATURE_NV_vertex_program
index 36084952e15680ee7e59608490b3c51c5dcea477..e86310f189dc57ca8e01e3dfcb62a726eeea5c90 100644 (file)
@@ -1292,7 +1292,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;
          break;
       case GL_COLOR_SUM_EXT:
-         CHECK_EXT1(EXT_secondary_color, "GetBooleanv");
+         CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetBooleanv");
          params[0] = ctx->Fog.ColorSumEnabled;
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
@@ -1389,7 +1389,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = ctx->Transform.RasterPositionUnclipped;
          break;
       case GL_POINT_SPRITE_NV:
-         CHECK_EXT1(NV_point_sprite, "GetBooleanv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetBooleanv");
          params[0] = ctx->Point.PointSprite;
          break;
       case GL_POINT_SPRITE_R_MODE_NV:
@@ -1397,7 +1397,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode);
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
-         CHECK_EXT1(NV_point_sprite, "GetBooleanv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetBooleanv");
          params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin);
          break;
       case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -1686,12 +1686,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          CHECK_EXT1(ARB_vertex_program, "GetBooleanv");
          params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxAttribs);
          break;
-      case GL_FRAGMENT_PROGRAM_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetBooleanv");
-         params[0] = ctx->FragmentProgram.Enabled;
-         break;
       case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetBooleanv");
+         CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetBooleanv");
          {
          const GLfloat *matrix = ctx->CurrentStack->Top->m;
          params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
@@ -1712,6 +1708,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
          }
          break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXT1(ARB_fragment_program, "GetBooleanv");
+         params[0] = ctx->FragmentProgram.Enabled;
+         break;
       case GL_DEPTH_BOUNDS_TEST_EXT:
          CHECK_EXT1(EXT_depth_bounds_test, "GetBooleanv");
          params[0] = ctx->Depth.BoundsTest;
@@ -3110,7 +3110,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);
          break;
       case GL_COLOR_SUM_EXT:
-         CHECK_EXT1(EXT_secondary_color, "GetFloatv");
+         CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetFloatv");
          params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled);
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
@@ -3207,7 +3207,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped);
          break;
       case GL_POINT_SPRITE_NV:
-         CHECK_EXT1(NV_point_sprite, "GetFloatv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetFloatv");
          params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite);
          break;
       case GL_POINT_SPRITE_R_MODE_NV:
@@ -3215,7 +3215,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode);
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
-         CHECK_EXT1(NV_point_sprite, "GetFloatv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetFloatv");
          params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin);
          break;
       case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -3504,12 +3504,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          CHECK_EXT1(ARB_vertex_program, "GetFloatv");
          params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxAttribs);
          break;
-      case GL_FRAGMENT_PROGRAM_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetFloatv");
-         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);
-         break;
       case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetFloatv");
+         CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetFloatv");
          {
          const GLfloat *matrix = ctx->CurrentStack->Top->m;
          params[0] = matrix[0];
@@ -3530,6 +3526,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[15] = matrix[15];
          }
          break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXT1(ARB_fragment_program, "GetFloatv");
+         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);
+         break;
       case GL_DEPTH_BOUNDS_TEST_EXT:
          CHECK_EXT1(EXT_depth_bounds_test, "GetFloatv");
          params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest);
@@ -4928,7 +4928,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);
          break;
       case GL_COLOR_SUM_EXT:
-         CHECK_EXT1(EXT_secondary_color, "GetIntegerv");
+         CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetIntegerv");
          params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled);
          break;
       case GL_CURRENT_SECONDARY_COLOR_EXT:
@@ -5025,7 +5025,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped);
          break;
       case GL_POINT_SPRITE_NV:
-         CHECK_EXT1(NV_point_sprite, "GetIntegerv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetIntegerv");
          params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite);
          break;
       case GL_POINT_SPRITE_R_MODE_NV:
@@ -5033,7 +5033,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode);
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
-         CHECK_EXT1(NV_point_sprite, "GetIntegerv");
+         CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetIntegerv");
          params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin);
          break;
       case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -5322,12 +5322,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          CHECK_EXT1(ARB_vertex_program, "GetIntegerv");
          params[0] = ctx->Const.VertexProgram.MaxAttribs;
          break;
-      case GL_FRAGMENT_PROGRAM_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetIntegerv");
-         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);
-         break;
       case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
-         CHECK_EXT1(ARB_fragment_program, "GetIntegerv");
+         CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetIntegerv");
          {
          const GLfloat *matrix = ctx->CurrentStack->Top->m;
          params[0] = IROUND(matrix[0]);
@@ -5348,6 +5344,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[15] = IROUND(matrix[15]);
          }
          break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXT1(ARB_fragment_program, "GetIntegerv");
+         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);
+         break;
       case GL_DEPTH_BOUNDS_TEST_EXT:
          CHECK_EXT1(EXT_depth_bounds_test, "GetIntegerv");
          params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest);
index 76adcf87721b90fac11c8ef0c7d39230bdc080f3..7bdb20a8abf26f1667252bdff210ea8285ba6bde 100644 (file)
@@ -51,7 +51,7 @@ TypeStrings = {
 #  - 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
-#  - optional extension to check, or None  (XXX this should be a list!)
+#  - optional extensions to check, or None
 #
 StateVars = [
        ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
@@ -631,7 +631,8 @@ StateVars = [
 
        # GL_EXT_secondary_color
        ( "GL_COLOR_SUM_EXT", GLboolean,
-         ["ctx->Fog.ColorSumEnabled"], "", ["EXT_secondary_color"] ),
+         ["ctx->Fog.ColorSumEnabled"], "",
+         ["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]",
@@ -691,12 +692,12 @@ StateVars = [
          ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
 
        # GL_NV_point_sprite
-       ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"],
-         "", ["NV_point_sprite"] ), # OR ARB_point_sprite
+       ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
+         "", ["NV_point_sprite", "ARB_point_sprite"] ),
        ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
-         "", ["NV_point_sprite"] ), # OR ARB_point_sprite
+         "", ["NV_point_sprite"] ),
        ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
-         "", ["NV_point_sprite"] ), # OR ARB_point_sprite
+         "", ["NV_point_sprite", "ARB_point_sprite"] ),
 
        # GL_SGIS_generate_mipmap
        ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
@@ -872,17 +873,17 @@ StateVars = [
        # GL_ARB_vertex_program
        ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
          ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
-
-       # GL_ARB_fragment_program
-       ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
-         ["ctx->FragmentProgram.Enabled"], "", ["ARB_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;",
-         ["ARB_fragment_program"] ),
+         ["ARB_vertex_program", "ARB_fragment_program"] ),
+
+       # GL_ARB_fragment_program
+       ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
+         ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
 
        # GL_EXT_depth_bounds_test
        ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,