mesa/es: Validate ColorPointer types in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 25 Jul 2012 21:53:01 +0000 (14:53 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 25 Aug 2012 02:13:17 +0000 (19:13 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/APIspec.xml
src/mesa/main/varray.c

index 6d4ae0d56e8562b57fe533747988b9517382c734..5201647ffedc73df1175f54e51e9151a37ade682 100644 (file)
        <desc name="size" error="GL_INVALID_VALUE">
                <value name="4"/>
        </desc>
-
-       <desc name="type">
-               <value name="GL_UNSIGNED_BYTE"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-       </desc>
 </template>
 
 <template name="DisableClientState">
index b1d65ed6b90a9a41791e73cd4ab24c7cde63ea7d..e64c3c5b0ec28fdfeb63d1ba7471b6b6ebfbf277 100644 (file)
@@ -285,14 +285,15 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
 void GLAPIENTRY
 _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 {
-   const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
-                                  SHORT_BIT | UNSIGNED_SHORT_BIT |
-                                  INT_BIT | UNSIGNED_INT_BIT |
-                                  HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
-                                  FIXED_ES_BIT |
-                                  UNSIGNED_INT_2_10_10_10_REV_BIT |
-                                  INT_2_10_10_10_REV_BIT);
    GET_CURRENT_CONTEXT(ctx);
+   const GLbitfield legalTypes = (ctx->API == API_OPENGLES)
+      ? (UNSIGNED_BYTE_BIT | HALF_BIT | FLOAT_BIT | FIXED_ES_BIT)
+      : (BYTE_BIT | UNSIGNED_BYTE_BIT |
+         SHORT_BIT | UNSIGNED_SHORT_BIT |
+         INT_BIT | UNSIGNED_INT_BIT |
+         HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
+         UNSIGNED_INT_2_10_10_10_REV_BIT |
+         INT_2_10_10_10_REV_BIT);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,