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 /core/os | |
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 'core/os')
-rw-r--r-- | core/os/os.cpp | 10 | ||||
-rw-r--r-- | core/os/os.h | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp index 86469852e3..ef7d860d19 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -553,6 +553,16 @@ void OS::add_frame_delay(bool p_can_draw) { } } +OS::PreferredTextureFormat OS::get_preferred_texture_format() const { +#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) + return PREFERRED_TEXTURE_FORMAT_ETC2_ASTC; // By rule, ARM hardware uses ETC texture compression. +#elif defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) + return PREFERRED_TEXTURE_FORMAT_S3TC_BPTC; // By rule, X86 hardware prefers S3TC and derivatives. +#else + return PREFERRED_TEXTURE_FORMAT_S3TC_BPTC; // Override in platform if needed. +#endif +} + OS::OS() { singleton = this; diff --git a/core/os/os.h b/core/os/os.h index 436a83eae3..d77890d89d 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -290,6 +290,14 @@ public: virtual Vector<String> get_granted_permissions() const { return Vector<String>(); } virtual void process_and_drop_events() {} + + enum PreferredTextureFormat { + PREFERRED_TEXTURE_FORMAT_S3TC_BPTC, + PREFERRED_TEXTURE_FORMAT_ETC2_ASTC + }; + + virtual PreferredTextureFormat get_preferred_texture_format() const; + OS(); virtual ~OS(); }; |