Reviewed-by: Charmaine Lee <charmai...@vmware.com>
________________________________________
From: Brian Paul <bri...@vmware.com>
Sent: Monday, May 23, 2016 1:35 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; mesa-sta...@lists.freedesktop.org
Subject: [PATCH] mesa: raise error for glEnable(GL_VERTEX_ARRAY), etc. in core 
profile

Otherwise, if the call executes normally we'll hit an assertion later
in the VBO code when we draw something.  Note that these cases were
already handled correctly for the glIsEnabled() function (and the API
checks were copied from there).

Tested with new piglit gl-3.1-enable-vertex-array test.

Cc: <mesa-sta...@lists.freedesktop.org>
---
 src/mesa/main/enable.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d283077..0e10961 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -741,12 +741,18 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
       case GL_VERTEX_ARRAY:
       case GL_NORMAL_ARRAY:
       case GL_COLOR_ARRAY:
-      case GL_INDEX_ARRAY:
       case GL_TEXTURE_COORD_ARRAY:
+         if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
+            goto invalid_enum_error;
+         client_state( ctx, cap, state );
+         return;
       case GL_EDGE_FLAG_ARRAY:
+      case GL_INDEX_ARRAY:
       case GL_FOG_COORDINATE_ARRAY_EXT:
       case GL_SECONDARY_COLOR_ARRAY_EXT:
       case GL_POINT_SIZE_ARRAY_OES:
+         if (ctx->API != API_OPENGLES)
+            goto invalid_enum_error;
          client_state( ctx, cap, state );
          return;

--
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to