intel: add support for ANGLE_texture_compression_dxt.
authorOliver McFadden <oliver.mcfadden@linux.intel.com>
Wed, 26 Sep 2012 17:59:50 +0000 (20:59 +0300)
committerOliver McFadden <oliver.mcfadden@linux.intel.com>
Mon, 1 Oct 2012 14:21:51 +0000 (17:21 +0300)
Signed-off-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mapi/glapi/gen/es_EXT.xml
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/main/APIspec.xml
src/mesa/main/extensions.c
src/mesa/main/glformats.c
src/mesa/main/mtypes.h
src/mesa/main/texformat.c
src/mesa/main/teximage.c

index c38e65a24f3b00191b9c0cff6599b17487e33f16..9e735834df65c0402882fa78f3bacdafb1bc121f 100644 (file)
     <enum name="RG8_EXT"                                  value="0x822B"/>
 </category>
 
+<!-- 111. GL_ANGLE_texture_compression_dxt -->
+<category name="ANGLE_texture_compression_dxt" number="111">
+    <enum name="COMPRESSED_RGBA_S3TC_DXT3_ANGLE"        value="0x83F2"/>
+    <enum name="COMPRESSED_RGBA_S3TC_DXT5_ANGLE"        value="0x83F3"/>
+</category>
+
 </OpenGLAPI>
index 89f6c1ec5c5d473ff8da809a345c092571b2acbb..8a4648816eb8a68659377909e4711c89ab2287be 100755 (executable)
@@ -182,6 +182,7 @@ intelInitExtensions(struct gl_context *ctx)
    }
 
    if (intel->ctx.Mesa_DXTn) {
+      ctx->Extensions.ANGLE_texture_compression_dxt = true;
       ctx->Extensions.EXT_texture_compression_s3tc = true;
       ctx->Extensions.S3_s3tc = true;
    }
index a65c5c5297fed521cd023f1dcf9acaa6fc5c74d2..c3969526f3a246598b351ed8d19c5a605f6e19b6 100644 (file)
        <category name="NV_draw_buffers"/>
        <category name="NV_read_buffer"/>
 
+       <!-- GL_ANGLE_texture_compression_dxt -->
+       <category name="ANGLE_texture_compression_dxt"/>
+
        <function name="DrawBuffersNV" template="DrawBuffers"/>
        <function name="ReadBufferNV" template="ReadBuffer"/> 
 
index bd7c7baf9120c9fbaf69d4d98c8d5c3c9535c97d..4971ebc930d3e94d00cfc78d6d2739ab8f538558 100644 (file)
@@ -195,6 +195,8 @@ static const struct extension extension_table[] = {
    { "GL_EXT_texture3D",                           o(EXT_texture3D),                           GLL,            1996 },
    { "GL_EXT_texture_array",                       o(EXT_texture_array),                       GL,             2006 },
    { "GL_EXT_texture_compression_dxt1",            o(EXT_texture_compression_s3tc),            GL | ES1 | ES2, 2004 },
+   { "GL_ANGLE_texture_compression_dxt3",          o(ANGLE_texture_compression_dxt),           ES2,            2011 },
+   { "GL_ANGLE_texture_compression_dxt5",          o(ANGLE_texture_compression_dxt),           ES2,            2011 },
    { "GL_EXT_texture_compression_latc",            o(EXT_texture_compression_latc),            GL,             2006 },
    { "GL_EXT_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL,             2004 },
    { "GL_EXT_texture_compression_s3tc",            o(EXT_texture_compression_s3tc),            GL,             2000 },
@@ -480,6 +482,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
    _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
    if (ctx->Mesa_DXTn) {
+      ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE;
       _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
       _mesa_enable_extension(ctx, "GL_S3_s3tc");
    }
index 04029c07c495d9524f89b0ec1e0408be8576f218..ccdf56b4f6eb7c5d22a6a2b9c5b4361956844b2e 100644 (file)
@@ -791,8 +791,10 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
       return ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-      return _mesa_is_desktop_gl(ctx)
-         && ctx->Extensions.EXT_texture_compression_s3tc;
+      return (_mesa_is_desktop_gl(ctx) &&
+             ctx->Extensions.EXT_texture_compression_s3tc) ||
+            (ctx->API == API_OPENGLES2 &&
+             ctx->Extensions.ANGLE_texture_compression_dxt);
    case GL_RGB_S3TC:
    case GL_RGB4_S3TC:
    case GL_RGBA_S3TC:
index ba43e574dc0c8734bbd7c133bf1454858bc67da2..e790e18c4a5d27105ac474707988126bcde287c6 100644 (file)
@@ -2946,6 +2946,7 @@ struct gl_extensions
    GLboolean dummy;  /* don't remove this! */
    GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
    GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
+   GLboolean ANGLE_texture_compression_dxt;
    GLboolean ARB_ES2_compatibility;
    GLboolean ARB_base_instance;
    GLboolean ARB_blend_func_extended;
index 17270ba9248c020df7a796fd43bacf22099a260e..f0bc7fdb93b9bc06dbd8f895fa317347ce162291 100644 (file)
@@ -302,7 +302,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       }
    }
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc) {
+   if (ctx->Extensions.EXT_texture_compression_s3tc ||
+       (ctx->API == API_OPENGLES2 &&
+       ctx->Extensions.ANGLE_texture_compression_dxt)) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
            RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
@@ -604,12 +606,16 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
            RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-            if (ctx->Extensions.EXT_texture_compression_s3tc)
+            if (ctx->Extensions.EXT_texture_compression_s3tc ||
+               (ctx->API == API_OPENGLES2 &&
+                ctx->Extensions.ANGLE_texture_compression_dxt))
               RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
            RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-            if (ctx->Extensions.EXT_texture_compression_s3tc)
+            if (ctx->Extensions.EXT_texture_compression_s3tc ||
+               (ctx->API == API_OPENGLES2 &&
+                ctx->Extensions.ANGLE_texture_compression_dxt))
               RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
            RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
index afda0eaafbf75a60154e17177888891089278148..8e1e601da7cb438e9011f4c0d912450bbbe94948 100644 (file)
@@ -203,6 +203,18 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
       }
    }
 
+   /* GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE && GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE */
+   if (ctx->API == API_OPENGLES2 &&
+       ctx->Extensions.ANGLE_texture_compression_dxt) {
+      switch (internalFormat) {
+         case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+         case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
    if (ctx->Extensions.S3_s3tc) {
       switch (internalFormat) {
          case GL_RGB_S3TC: