diff options
author | Juan Linietsky <reduzio@gmail.com> | 2023-01-25 12:17:11 +0100 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2023-01-30 15:53:23 +0100 |
commit | 28f51ba547722d1283882ec5dee9bcab070bc33e (patch) | |
tree | 81a2ef0bc8aa468876bf5edb65df16e2fcc9f4ee /modules/etcpak | |
parent | 17a85973559fae0cd2c33d13c4b53f16cf7419ba (diff) |
Refactor high quality texture import
* Only two texture import modes for low/high quality now:
* S3TC/BPTC
* ETC2/ASTC
* Makes sense given this is the general preferred and most compatible combination in most platforms.
* Removed lossy_quality from VRAM texture compression options. It was unused everywhere.
* Added a new "high_quality" option to texture import. When enabled, it uses BPTC/ASTC (BC7/ASTC4x4) instead of S3TC/ETC2 (DXT1-5/ETC2,ETCA).
* Changed MacOS export settings so required texture formats depend on the architecture selected.
This solves the following problems:
* Makes it simpler to import textures as high quality, without having to worry about the specific format used.
* As the editor can now run on platforms such as web, Mac OS with Apple Silicion and Android, it should no longer be assumed that S3TC/BPTC is available by default for it.
Diffstat (limited to 'modules/etcpak')
-rw-r--r-- | modules/etcpak/image_compress_etcpak.cpp | 16 | ||||
-rw-r--r-- | modules/etcpak/image_compress_etcpak.h | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/modules/etcpak/image_compress_etcpak.cpp b/modules/etcpak/image_compress_etcpak.cpp index a6aeec54cc..16a59d3880 100644 --- a/modules/etcpak/image_compress_etcpak.cpp +++ b/modules/etcpak/image_compress_etcpak.cpp @@ -74,25 +74,23 @@ EtcpakType _determine_dxt_type(Image::UsedChannels p_channels) { } } -void _compress_etc1(Image *r_img, float p_lossy_quality) { - _compress_etcpak(EtcpakType::ETCPAK_TYPE_ETC1, r_img, p_lossy_quality); +void _compress_etc1(Image *r_img) { + _compress_etcpak(EtcpakType::ETCPAK_TYPE_ETC1, r_img); } -void _compress_etc2(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels) { +void _compress_etc2(Image *r_img, Image::UsedChannels p_channels) { EtcpakType type = _determine_etc_type(p_channels); - _compress_etcpak(type, r_img, p_lossy_quality); + _compress_etcpak(type, r_img); } -void _compress_bc(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels) { +void _compress_bc(Image *r_img, Image::UsedChannels p_channels) { EtcpakType type = _determine_dxt_type(p_channels); - _compress_etcpak(type, r_img, p_lossy_quality); + _compress_etcpak(type, r_img); } -void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_quality) { +void _compress_etcpak(EtcpakType p_compresstype, Image *r_img) { uint64_t start_time = OS::get_singleton()->get_ticks_msec(); - // TODO: See how to handle lossy quality. - Image::Format img_format = r_img->get_format(); if (img_format >= Image::FORMAT_DXT1) { return; // Do not compress, already compressed. diff --git a/modules/etcpak/image_compress_etcpak.h b/modules/etcpak/image_compress_etcpak.h index 8cb17b1c8a..ff267631a6 100644 --- a/modules/etcpak/image_compress_etcpak.h +++ b/modules/etcpak/image_compress_etcpak.h @@ -43,10 +43,10 @@ enum class EtcpakType { ETCPAK_TYPE_DXT5_RA_AS_RG, }; -void _compress_etc1(Image *r_img, float p_lossy_quality); -void _compress_etc2(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels); -void _compress_bc(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels); +void _compress_etc1(Image *r_img); +void _compress_etc2(Image *r_img, Image::UsedChannels p_channels); +void _compress_bc(Image *r_img, Image::UsedChannels p_channels); -void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_quality); +void _compress_etcpak(EtcpakType p_compresstype, Image *r_img); #endif // IMAGE_COMPRESS_ETCPAK_H |