ARB prog lexer: Fix lexer to eat both DOS and Unix line endings
[mesa.git] / src / mesa / main / enable.c
index f432be183cb8bad6899e134b45b8100d1c284e61..4bc54771e970afd91ce038de84b0cdcaef947931 100644 (file)
@@ -119,6 +119,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state)
          CHECK_EXTENSION(NV_vertex_program, cap);
          {
             GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
+            ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
             var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled;
             flag = _NEW_ARRAY_ATTRIB(n);
          }
@@ -222,14 +223,16 @@ get_texcoord_unit(GLcontext *ctx)
 
 /**
  * Helper function to enable or disable a texture target.
+ * \param bit  one of the TEXTURE_x_BIT values
+ * \return GL_TRUE if state is changing or GL_FALSE if no change
  */
 static GLboolean
-enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit)
+enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit)
 {
    const GLuint curr = ctx->Texture.CurrentUnit;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
-   const GLuint newenabled = (!state)
-       ? (texUnit->Enabled & ~bit) :  (texUnit->Enabled | bit);
+   const GLbitfield newenabled = state
+      ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
 
    if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled)
        return GL_FALSE;
@@ -969,6 +972,11 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
          }
          break;
 
+      case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+        CHECK_EXTENSION(ARB_seamless_cube_map, cap);
+        ctx->Texture.CubeMapSeamless = state;
+        break;
+
       default:
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "%s(0x%x)", state ? "glEnable" : "glDisable", cap);
@@ -1314,6 +1322,7 @@ _mesa_IsEnabled( GLenum cap )
          CHECK_EXTENSION(NV_vertex_program);
          {
             GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
+            ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
             return (ctx->Array.ArrayObj->VertexAttrib[n].Enabled != 0);
          }
       case GL_MAP1_VERTEX_ATTRIB0_4_NV:
@@ -1391,6 +1400,11 @@ _mesa_IsEnabled( GLenum cap )
         CHECK_EXTENSION(ATI_fragment_shader);
         return ctx->ATIFragmentShader.Enabled;
 #endif /* FEATURE_ATI_fragment_shader */
+
+      case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+        CHECK_EXTENSION(ARB_seamless_cube_map);
+        return ctx->Texture.CubeMapSeamless;
+
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
         return GL_FALSE;