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

v3: Fix a typo in GL_TEXTURE_2D_ARRAY checking.

v4: Change !_mesa_is_desktop_gl tests to _mesa_is_gles test.  The test
around GL_TEXTURE_2D_ARRAY got some other changes because that enum is
also available with GLES3 (which uses API_OPENGLES2).  Based on review
feedback from Eric Anholt.

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

index 9aa38187e598dd5e5d255875c1f5bf3cdaf87cd8..2b06367282ba5310c74b8c4d5cbca50e961b2754 100644 (file)
                <return type="void"/>
                <param name="target" type="GLenum"/>
        </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
 </template>
 
 <template name="BindFramebuffer">
index 5fba3a16387ae23c649155e7147997f52af66873..27bc39e6b3d7d12275b94c7f5594513d08443251 100644 (file)
@@ -2526,16 +2526,23 @@ _mesa_GenerateMipmapEXT(GLenum target)
 
    switch (target) {
    case GL_TEXTURE_1D:
+      error = _mesa_is_gles(ctx);
+      break;
    case GL_TEXTURE_2D:
-   case GL_TEXTURE_3D:
       error = GL_FALSE;
       break;
+   case GL_TEXTURE_3D:
+      error = ctx->API == API_OPENGLES;
+      break;
    case GL_TEXTURE_CUBE_MAP:
       error = !ctx->Extensions.ARB_texture_cube_map;
       break;
    case GL_TEXTURE_1D_ARRAY:
+      error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array;
+      break;
    case GL_TEXTURE_2D_ARRAY:
-      error = !ctx->Extensions.EXT_texture_array;
+      error = (_mesa_is_gles(ctx) && ctx->Version < 30)
+         || !ctx->Extensions.EXT_texture_array;
       break;
    default:
       error = GL_TRUE;