summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c85
1 files changed, 63 insertions, 22 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 7fcaa424583..a8ac19e40d7 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -243,28 +243,6 @@ _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
@@ -397,6 +375,69 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
n += 10;
}
}
+
+ /* 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."
+ *
+ * The ES and the desktop specs diverge here. In OpenGL ES, the COMPRESSED_TEXTURE_FORMATS
+ * query returns the set of supported specific compressed formats.
+ */
+ if (ctx->API == API_OPENGLES2 &&
+ ctx->Extensions.KHR_texture_compression_astc_ldr) {
+ if (formats) {
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
+ formats[n++] = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
+ formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
+ }
+ else {
+ n += 28;
+ }
+ }
+
return n;
}