[Mesa-dev] [PATCH 2/5] mesa/es: Validate glGenerateMipmap target in Mesa code rather than the ES wrapper

Ian Romanick idr at freedesktop.org
Fri Aug 24 08:46:10 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

v2: Add proper core-profile and GLES3 filtering.

v3: Fix a typo in GL_TEXTURE_2D_ARRAY checking.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/APIspec.xml |    7 -------
 src/mesa/main/fbobject.c  |   11 +++++++++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 9aa3818..2b06367 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -2061,13 +2061,6 @@
 		<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">
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index e6cfbc9..77e9910 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2527,16 +2527,23 @@ _mesa_GenerateMipmapEXT(GLenum target)
 
    switch (target) {
    case GL_TEXTURE_1D:
+      error = !_mesa_is_desktop_gl(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_desktop_gl(ctx) || !ctx->Extensions.EXT_texture_array;
+      break;
    case GL_TEXTURE_2D_ARRAY:
-      error = !ctx->Extensions.EXT_texture_array;
+      error = (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.EXT_texture_array)
+         && !_mesa_is_gles3(ctx);
       break;
    default:
       error = GL_TRUE;
-- 
1.7.6.5



More information about the mesa-dev mailing list