Merge pull request #88485 from BlueCube3310/basisu-astc-v2

Add ASTC support to BasisUniversal
This commit is contained in:
Rémi Verschelde 2024-02-22 11:23:11 +01:00
commit c3de771292
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -154,6 +154,7 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
// Get supported compression formats. // Get supported compression formats.
bool bptc_supported = RS::get_singleton()->has_os_feature("bptc"); 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 s3tc_supported = RS::get_singleton()->has_os_feature("s3tc");
bool etc2_supported = RS::get_singleton()->has_os_feature("etc2"); bool etc2_supported = RS::get_singleton()->has_os_feature("etc2");
@ -166,6 +167,9 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
if (bptc_supported) { if (bptc_supported) {
basisu_format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY; basisu_format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY;
image_format = Image::FORMAT_BPTC_RGBA; 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) { } else if (s3tc_supported) {
basisu_format = basist::transcoder_texture_format::cTFBC1; basisu_format = basist::transcoder_texture_format::cTFBC1;
image_format = Image::FORMAT_DXT1; image_format = Image::FORMAT_DXT1;
@ -183,6 +187,9 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
if (bptc_supported) { if (bptc_supported) {
basisu_format = basist::transcoder_texture_format::cTFBC7_M5; basisu_format = basist::transcoder_texture_format::cTFBC7_M5;
image_format = Image::FORMAT_BPTC_RGBA; 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) { } else if (s3tc_supported) {
basisu_format = basist::transcoder_texture_format::cTFBC3; basisu_format = basist::transcoder_texture_format::cTFBC3;
image_format = Image::FORMAT_DXT5; image_format = Image::FORMAT_DXT5;