From 71d21c7ccb9a78f573d674e717906012c7a5eb39 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 5 Sep 2022 21:11:34 +0200 Subject: Implement basic ASTC support Implements basic ASTC support: * Only 4x4 and 8x8 block sizes. * Other block sizes are too complex to handle for Godot image compression handling. May be implemented sometime in the future. The need for ASTC is mostly for the following use cases: * Implement a high quality compression option for textures on mobile and M1 Apple hardware. * For this, the 4x4 is sufficient, since it uses the same size as BPTC. ASTC supports a lot of block sizes, but the benefit of supporting most of them is slim, while the implementation complexity in Godot is very high. Supporting only 4x4 (and 8x8) solves the real problem, which is lack of a BPTC alternative on hardware where it's missing. Note: This does not yet support encoding on import, an ASTC encoder will need to be added. --- doc/classes/Image.xml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index b138a55ea3..8cb0557a40 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -76,8 +76,12 @@ + - Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. See [enum CompressMode] and [enum CompressSource] constants. + Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. + The [param mode] parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression. + The [param lossy_quality] parameter is optional for compressors that support it. + For ASTC compression, the [param astc_format] parameter must be supplied. @@ -85,7 +89,12 @@ + + Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. + This is an alternative to [method compress] that lets the user supply the channels used in order for the compressor to pick the best DXT and ETC2 formats. For other formats (non DXT or ETC2), this argument is ignored. + The [param lossy_quality] parameter is optional for compressors that support it. + For ASTC compression, the [param astc_format] parameter must be supplied. @@ -646,7 +655,19 @@ - + + [url=https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression]Adaptive Scalable Texutre Compression[/url]. This implements the 4x4 (high quality) mode. + + + Same format as [constant FORMAT_ASTC_4x4], but with the hint to let the GPU know it is used for HDR. + + + [url=https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression]Adaptive Scalable Texutre Compression[/url]. This implements the 8x8 (low quality) mode. + + + Same format as [constant FORMAT_ASTC_8x8], but with the hint to let the GPU know it is used for HDR. + + Represents the size of the [enum Format] enum. @@ -710,5 +731,11 @@ Source texture (before compression) is a normal texture (e.g. it can be compressed into two channels). + + Hint to indicate that the high quality 4x4 ASTC compression format should be used. + + + Hint to indicate that the low quality 8x8 ASTC compression format should be used. + -- cgit v1.2.3