mesa/es: Validate primitive modes in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 25 Jul 2012 14:15:29 +0000 (07:15 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 29 Aug 2012 22:09:34 +0000 (15:09 -0700)
v2: Add proper core-profile filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/APIspec.xml
src/mesa/main/api_validate.c

index 34e41b49e17670e26d8787383ac8e88e511742a2..6df4b921d00a84dd54aa1bb651e18a2fae00b2a9 100644 (file)
                <param name="first" type="GLint"/>
                <param name="count" type="GLsizei"/>
        </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
 </template>
 
 <template name="DrawElements">
                <param name="type" type="GLenum"/>
                <param name="indices" type="const GLvoid *"/>
        </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
 </template>
 
 <template name="EnableClientState">
                <param name="count" type="const GLsizei *"/>
                <param name="primcount" type="GLsizei"/>
        </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
 </template>
 
 <template name="MultiDrawElements">
                <param name="indices" type="const GLvoid **"/>
                <param name="primcount" type="GLsizei"/>
        </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
 </template>
 
 <template name="EGLImageTargetTexture2D">
index 362cdf50e7e0eee276c65f137dcd23f7d32dce8f..d0d2ca4d4516e9449ebc3708f73beb40cf1f3c92 100644 (file)
@@ -220,16 +220,19 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
    case GL_TRIANGLES:
    case GL_TRIANGLE_STRIP:
    case GL_TRIANGLE_FAN:
+      valid_enum = true;
+      break;
    case GL_QUADS:
    case GL_QUAD_STRIP:
    case GL_POLYGON:
-      valid_enum = true;
+      valid_enum = (ctx->API == API_OPENGL);
       break;
    case GL_LINES_ADJACENCY:
    case GL_LINE_STRIP_ADJACENCY:
    case GL_TRIANGLES_ADJACENCY:
    case GL_TRIANGLE_STRIP_ADJACENCY:
-      valid_enum = (ctx->Extensions.ARB_geometry_shader4);
+      valid_enum = _mesa_is_desktop_gl(ctx)
+         && ctx->Extensions.ARB_geometry_shader4;
       break;
    default:
       valid_enum = false;