Module: Mesa
Branch: master
Commit: dd0eb004874645135b9aaac3ebbd0aaf274079ea
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd0eb004874645135b9aaac3ebbd0aaf274079ea

Author: Ian Romanick <ian.d.roman...@intel.com>
Date:   Fri Jul 27 07:09:30 2012 -0700

mesa/es: Validate glCompressedTexImage internalFormat in Mesa code rather than 
the ES wrapper

v2: Add proper core-profile filtering.

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

---

 src/mesa/main/APIspec.xml |   18 ------------------
 src/mesa/main/glformats.c |   24 ++++++++++++++++--------
 2 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index b9332ab..1ae7212 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -1633,24 +1633,6 @@
                <param name="imageSize" type="GLsizei"/>
                <param name="data" type="const GLvoid *"/>
        </proto>
-
-       <desc name="internalFormat">
-               <value name="GL_ETC1_RGB8_OES" 
category="OES_compressed_ETC1_RGB8_texture"/>
-
-               <value name="GL_PALETTE4_RGB8_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGBA8_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_R5_G6_B5_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGBA4_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGB5_A1_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGB8_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGBA8_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_R5_G6_B5_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGBA4_OES" 
category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGB5_A1_OES" 
category="OES_compressed_paletted_texture"/>
-
-               <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" 
category="EXT_texture_compression_dxt1"/>
-               <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" 
category="EXT_texture_compression_dxt1"/>
-       </desc>
 </template>
 
 <template name="CompressedTexSubImage2D">
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index daf1b76..b6f9e94 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -790,37 +790,45 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum 
format)
    switch (format) {
    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
    case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+      return ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-      return ctx->Extensions.EXT_texture_compression_s3tc;
+      return _mesa_is_desktop_gl(ctx)
+         && ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_RGB_S3TC:
    case GL_RGB4_S3TC:
    case GL_RGBA_S3TC:
    case GL_RGBA4_S3TC:
-      return ctx->Extensions.S3_s3tc;
+      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.S3_s3tc;
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-      return ctx->Extensions.EXT_texture_sRGB
+      return _mesa_is_desktop_gl(ctx)
+         && ctx->Extensions.EXT_texture_sRGB
          && ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_COMPRESSED_RGB_FXT1_3DFX:
    case GL_COMPRESSED_RGBA_FXT1_3DFX:
-      return ctx->Extensions.TDFX_texture_compression_FXT1;
+      return _mesa_is_desktop_gl(ctx)
+         && ctx->Extensions.TDFX_texture_compression_FXT1;
    case GL_COMPRESSED_RED_RGTC1:
    case GL_COMPRESSED_SIGNED_RED_RGTC1:
    case GL_COMPRESSED_RG_RGTC2:
    case GL_COMPRESSED_SIGNED_RG_RGTC2:
-      return ctx->Extensions.ARB_texture_compression_rgtc;
+      return _mesa_is_desktop_gl(ctx)
+         && ctx->Extensions.ARB_texture_compression_rgtc;
    case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
    case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
    case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
    case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
-      return ctx->Extensions.EXT_texture_compression_latc;
+      return ctx->API == API_OPENGL
+         && ctx->Extensions.EXT_texture_compression_latc;
    case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
-      return ctx->Extensions.ATI_texture_compression_3dc;
+      return ctx->API == API_OPENGL
+         && ctx->Extensions.ATI_texture_compression_3dc;
    case GL_ETC1_RGB8_OES:
-      return ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
+      return _mesa_is_gles(ctx)
+         && ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
 #if FEATURE_ES
    case GL_PALETTE4_RGB8_OES:
    case GL_PALETTE4_RGBA8_OES:

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to