Merge pull request #104590 from bruvzg/tex_decomp_load

Load decompressable texture format if no supported one is found.
This commit is contained in:
Rémi Verschelde 2025-03-28 17:30:28 +01:00
commit e3063f5675
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 45 additions and 18 deletions

View file

@ -2694,6 +2694,19 @@ Error Image::decompress() {
return OK;
}
bool Image::can_decompress(const String &p_format_tag) {
if (p_format_tag == "astc") {
return _image_decompress_astc != nullptr;
} else if (p_format_tag == "bptc") {
return _image_decompress_bptc != nullptr;
} else if (p_format_tag == "etc2") {
return _image_decompress_etc2 != nullptr;
} else if (p_format_tag == "s3tc") {
return _image_decompress_bc != nullptr;
}
return false;
}
Error Image::compress(CompressMode p_mode, CompressSource p_source, ASTCFormat p_astc_format) {
ERR_FAIL_INDEX_V_MSG(p_mode, COMPRESS_MAX, ERR_INVALID_PARAMETER, "Invalid compress mode.");
ERR_FAIL_INDEX_V_MSG(p_source, COMPRESS_SOURCE_MAX, ERR_INVALID_PARAMETER, "Invalid compress source.");