From 944fbce347db29f24af07a709aa238986ade509a Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 15 May 2023 11:04:49 -0500 Subject: [PATCH] Enable S3TC_BPTC but not ETC2_ASTC by default --- doc/classes/ProjectSettings.xml | 4 ++-- platform/macos/os_macos.h | 1 + platform/macos/os_macos.mm | 6 ++++++ servers/rendering_server.cpp | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 8aebf5f637e..1a79146f96a 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2606,11 +2606,11 @@ If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP. - + If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm for lower quality textures and normal maps and Adaptable Scalable Texture Compression algorithm for high quality textures (in 4x4 block size). [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). - + If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm (DXT1-5) for lower quality textures and the BPTC algorithm (BC6H and BC7) for high quality textures. This algorithm is only supported on PC desktop platforms and consoles. [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h index 69aab800f3b..ab61649d19d 100644 --- a/platform/macos/os_macos.h +++ b/platform/macos/os_macos.h @@ -121,6 +121,7 @@ public: virtual Error move_to_trash(const String &p_path) override; virtual String get_system_ca_certificates() override; + virtual OS::PreferredTextureFormat get_preferred_texture_format() const override; void run(); diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index 5c6cef65c0f..fe6d8d9fb06 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -700,6 +700,12 @@ String OS_MacOS::get_system_ca_certificates() { return certs; } +OS::PreferredTextureFormat OS_MacOS::get_preferred_texture_format() const { + // macOS supports both formats on ARM. Prefer S3TC/BPTC + // for better compatibility with x86 platforms. + return PREFERRED_TEXTURE_FORMAT_S3TC_BPTC; +} + void OS_MacOS::run() { if (!main_loop) { return; diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 4d41343ff85..8152f5679fb 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2870,8 +2870,8 @@ TypedArray RenderingServer::_global_shader_parameter_get_list() cons } void RenderingServer::init() { - GLOBAL_DEF_RST_NOVAL_BASIC("rendering/textures/vram_compression/import_s3tc_bptc", OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_S3TC_BPTC); - GLOBAL_DEF_RST_NOVAL_BASIC("rendering/textures/vram_compression/import_etc2_astc", OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_ETC2_ASTC); + GLOBAL_DEF_RST("rendering/textures/vram_compression/import_s3tc_bptc", true); + GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2_astc", false); GLOBAL_DEF("rendering/textures/lossless_compression/force_png", false);