meta: Don't stray outside the confines of the API specified in the context
[mesa.git] / src / mesa / main / enable.c
index 214f84d6f7073b5bc9453d8190cafc64cfa5d570..b713f5f2c448754aad4178c2436f22a125d7e47a 100644 (file)
@@ -38,6 +38,7 @@
 #include "enums.h"
 #include "api_arrayelt.h"
 #include "texstate.h"
+#include "drivers/common/meta.h"
 
 
 
@@ -764,8 +765,13 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
 
       /* GL_ARB_multisample */
       case GL_MULTISAMPLE_ARB:
-         if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+         /* Technically speaking, this should not be allowed for OpenGL ES 2.0
+          * or 3.0.  However, meta really needs it.
+          */
+         if (!_mesa_meta_in_progress(ctx) && !_mesa_is_desktop_gl(ctx)
+             && ctx->API != API_OPENGLES)
             goto invalid_enum_error;
+
          if (ctx->Multisample.Enabled == state)
             return;
          FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);