BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding

(cherry picked from commit 4d46ef8e8e)
This commit is contained in:
BlueCube3310 2025-03-07 15:26:03 +01:00 committed by Rémi Verschelde
parent 757173e0e2
commit 1a379d1805
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 9 additions and 1 deletions

View file

@ -421,6 +421,9 @@ bool Utilities::has_os_feature(const String &p_feature) const {
if (p_feature == "etc2") { if (p_feature == "etc2") {
return config->etc2_supported; return config->etc2_supported;
} }
if (p_feature == "astc_hdr") {
return config->astc_hdr_supported;
}
return false; return false;
} }

View file

@ -275,6 +275,7 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
bool rgtc_supported = RS::get_singleton()->has_os_feature("rgtc"); bool rgtc_supported = RS::get_singleton()->has_os_feature("rgtc");
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");
bool astc_hdr_supported = RS::get_singleton()->has_os_feature("astc_hdr");
bool needs_ra_rg_swap = false; bool needs_ra_rg_swap = false;
bool needs_rg_trim = false; bool needs_rg_trim = false;
@ -379,7 +380,7 @@ 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::cTFBC6H; basisu_format = basist::transcoder_texture_format::cTFBC6H;
image_format = Image::FORMAT_BPTC_RGBFU; image_format = Image::FORMAT_BPTC_RGBFU;
} else if (astc_supported) { } else if (astc_hdr_supported) {
basisu_format = basist::transcoder_texture_format::cTFASTC_HDR_4x4_RGBA; basisu_format = basist::transcoder_texture_format::cTFASTC_HDR_4x4_RGBA;
image_format = Image::FORMAT_ASTC_4x4_HDR; image_format = Image::FORMAT_ASTC_4x4_HDR;
} else { } else {

View file

@ -286,6 +286,10 @@ bool Utilities::has_os_feature(const String &p_feature) const {
return true; return true;
} }
if (p_feature == "astc_hdr" && RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_ASTC_4x4_SFLOAT_BLOCK, RD::TEXTURE_USAGE_SAMPLING_BIT)) {
return true;
}
return false; return false;
} }