Merge remote branch 'origin/7.8'
[mesa.git] / src / mesa / main / enable.c
index 6f9f57f5cb88a75d7445a714daa5f3e7a050fb39..f9decc31ab75e3b3ffa36d4413e623ef38d64054 100644 (file)
@@ -32,7 +32,6 @@
 #include "context.h"
 #include "enable.h"
 #include "light.h"
-#include "macros.h"
 #include "simple_list.h"
 #include "mtypes.h"
 #include "enums.h"
@@ -983,6 +982,16 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
         ctx->Texture.CubeMapSeamless = state;
         break;
 
+#if FEATURE_EXT_transform_feedback
+      case GL_RASTERIZER_DISCARD:
+        CHECK_EXTENSION(EXT_transform_feedback, cap);
+         if (ctx->TransformFeedback.RasterDiscard != state) {
+            ctx->TransformFeedback.RasterDiscard = state;
+            FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+         }
+         break;
+#endif
+
       default:
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "%s(0x%x)", state ? "glEnable" : "glDisable", cap);
@@ -1033,6 +1042,9 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
    ASSERT(state == 0 || state == 1);
    switch (cap) {
    case GL_BLEND:
+      if (!ctx->Extensions.EXT_draw_buffers2) {
+         goto bad_cap_error;
+      }
       if (index >= ctx->Const.MaxDrawBuffers) {
          _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
                      state ? "glEnableIndexed" : "glDisableIndexed", index);
@@ -1047,10 +1059,14 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
       }
       break;
    default:
-      _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
-                  state ? "glEnableIndexed" : "glDisableIndexed",
-                  _mesa_lookup_enum_by_nr(cap));
+      goto bad_cap_error;
    }
+   return;
+
+bad_cap_error:
+    _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
+                state ? "glEnablei" : "glDisablei",
+                _mesa_lookup_enum_by_nr(cap));
 }
 
 
@@ -1487,6 +1503,12 @@ _mesa_IsEnabled( GLenum cap )
         CHECK_EXTENSION(ARB_seamless_cube_map);
         return ctx->Texture.CubeMapSeamless;
 
+#if FEATURE_EXT_transform_feedback
+      case GL_RASTERIZER_DISCARD:
+        CHECK_EXTENSION(EXT_transform_feedback);
+         return ctx->TransformFeedback.RasterDiscard;
+#endif
+
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
         return GL_FALSE;