From 0afee63712cef54b108ff5a5176df5783a10b13f Mon Sep 17 00:00:00 2001 From: BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com> Date: Sun, 18 Feb 2024 10:24:35 +0100 Subject: [PATCH] Add ASTC support to BasisUniversal --- modules/basis_universal/image_compress_basisu.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/basis_universal/image_compress_basisu.cpp b/modules/basis_universal/image_compress_basisu.cpp index 41de62b20bf..12856f33c1c 100644 --- a/modules/basis_universal/image_compress_basisu.cpp +++ b/modules/basis_universal/image_compress_basisu.cpp @@ -154,6 +154,7 @@ Ref basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) { // Get supported compression formats. bool bptc_supported = RS::get_singleton()->has_os_feature("bptc"); + bool astc_supported = RS::get_singleton()->has_os_feature("astc"); bool s3tc_supported = RS::get_singleton()->has_os_feature("s3tc"); bool etc2_supported = RS::get_singleton()->has_os_feature("etc2"); @@ -166,6 +167,9 @@ Ref basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) { if (bptc_supported) { basisu_format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY; image_format = Image::FORMAT_BPTC_RGBA; + } else if (astc_supported) { + basisu_format = basist::transcoder_texture_format::cTFASTC_4x4_RGBA; + image_format = Image::FORMAT_ASTC_4x4; } else if (s3tc_supported) { basisu_format = basist::transcoder_texture_format::cTFBC1; image_format = Image::FORMAT_DXT1; @@ -183,6 +187,9 @@ Ref basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) { if (bptc_supported) { basisu_format = basist::transcoder_texture_format::cTFBC7_M5; image_format = Image::FORMAT_BPTC_RGBA; + } else if (astc_supported) { + basisu_format = basist::transcoder_texture_format::cTFASTC_4x4_RGBA; + image_format = Image::FORMAT_ASTC_4x4; } else if (s3tc_supported) { basisu_format = basist::transcoder_texture_format::cTFBC3; image_format = Image::FORMAT_DXT5;