[Mesa-dev] [RFC 03/10] mesa: disable online compression for ASTC formats

Nanley Chery nanleychery at gmail.com
Tue May 19 17:48:11 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/mesa/main/texcompress.c | 22 ++++++++++++++++++++++
 src/mesa/main/teximage.c    | 28 ++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 0fd1a36..1654fc6 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -229,6 +229,28 @@ _mesa_gl_compressed_format_base_format(GLenum format)
  *        what GL_NUM_COMPRESSED_TEXTURE_FORMATS and
  *        GL_COMPRESSED_TEXTURE_FORMATS return."
  *
+ * The KHR_texture_compression_astc_hdr spec says:
+ *
+ *    "Interactions with OpenGL 4.2
+ *
+ *        OpenGL 4.2 supports the feature that compressed textures can be
+ *        compressed online, by passing the compressed texture format enum as
+ *        the internal format when uploading a texture using TexImage1D,
+ *        TexImage2D or TexImage3D (see Section 3.9.3, Texture Image
+ *        Specification, subsection Encoding of Special Internal Formats).
+ *
+ *        Due to the complexity of the ASTC compression algorithm, it is not
+ *        usually suitable for online use, and therefore ASTC support will be
+ *        limited to pre-compressed textures only. Where on-device compression
+ *        is required, a domain-specific limited compressor will typically
+ *        be used, and this is therefore not suitable for implementation in
+ *        the driver.
+ *
+ *        In particular, the ASTC format specifiers will not be added to
+ *        Table 3.14, and thus will not be accepted by the TexImage*D
+ *        functions, and will not be returned by the (already deprecated)
+ *        COMPRESSED_TEXTURE_FORMATS query."
+ *
  * There is no formal spec for GL_ATI_texture_compression_3dc.  Since the
  * formats added by this extension are luminance-alpha formats, it is
  * reasonable to expect them to follow the same rules as
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7616fd7..9207580 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1778,6 +1778,34 @@ compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
    case GL_PALETTE8_R5_G6_B5_OES:
    case GL_PALETTE8_RGBA4_OES:
    case GL_PALETTE8_RGB5_A1_OES:
+   case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+   case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
       return GL_TRUE;
    default:
       return GL_FALSE;
-- 
2.4.1



More information about the mesa-dev mailing list