Skip to content

Commit 4d46ef8

Browse files
committed
BasisUniversal: Ensure ASTC's HDR variant is supported when transcoding
1 parent f2cc3f1 commit 4d46ef8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/gles3/storage/utilities.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ bool Utilities::has_os_feature(const String &p_feature) const {
421421
if (p_feature == "etc2") {
422422
return config->etc2_supported;
423423
}
424+
if (p_feature == "astc_hdr") {
425+
return config->astc_hdr_supported;
426+
}
424427

425428
return false;
426429
}

modules/basis_universal/image_compress_basisu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
275275
bool rgtc_supported = RS::get_singleton()->has_os_feature("rgtc");
276276
bool s3tc_supported = RS::get_singleton()->has_os_feature("s3tc");
277277
bool etc2_supported = RS::get_singleton()->has_os_feature("etc2");
278+
bool astc_hdr_supported = RS::get_singleton()->has_os_feature("astc_hdr");
278279

279280
bool needs_ra_rg_swap = false;
280281
bool needs_rg_trim = false;
@@ -379,7 +380,7 @@ Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) {
379380
if (bptc_supported) {
380381
basisu_format = basist::transcoder_texture_format::cTFBC6H;
381382
image_format = Image::FORMAT_BPTC_RGBFU;
382-
} else if (astc_supported) {
383+
} else if (astc_hdr_supported) {
383384
basisu_format = basist::transcoder_texture_format::cTFASTC_HDR_4x4_RGBA;
384385
image_format = Image::FORMAT_ASTC_4x4_HDR;
385386
} else {

servers/rendering/renderer_rd/storage_rd/utilities.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ bool Utilities::has_os_feature(const String &p_feature) const {
286286
return true;
287287
}
288288

289+
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)) {
290+
return true;
291+
}
292+
289293
return false;
290294
}
291295

0 commit comments

Comments
 (0)