Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable S3TC_BPTC but not ETC2_ASTC by default #77105

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2606,11 +2606,11 @@
<member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false">
If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP.
</member>
<member name="rendering/textures/vram_compression/import_etc2_astc" type="bool" setter="" getter="">
<member name="rendering/textures/vram_compression/import_etc2_astc" type="bool" setter="" getter="" default="false">
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]).
</member>
<member name="rendering/textures/vram_compression/import_s3tc_bptc" type="bool" setter="" getter="">
<member name="rendering/textures/vram_compression/import_s3tc_bptc" type="bool" setter="" getter="" default="true">
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]).
</member>
Expand Down
1 change: 1 addition & 0 deletions platform/macos/os_macos.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class OS_MacOS : public OS_Unix {
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();

Expand Down
6 changes: 6 additions & 0 deletions platform/macos/os_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,12 @@
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;
Expand Down
4 changes: 2 additions & 2 deletions servers/rendering_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2870,8 +2870,8 @@ TypedArray<StringName> 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we change the preferred OS texture format on macOS instead? This will likely make it still look up ETC2/ASTC and thus not work on Intel Mac.

Also this might break the Android editor.

Copy link
Member Author

@aaronfranke aaronfranke Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should also do that. But not instead. To be clear, the project settings themselves must not change between platforms. The behavior can change, sure, but not the booleans themselves, or else you get diffs in project.godot when you switch between platforms.

Users of the Android editor will need this setting enabled to avoid .import file diffs compared to desktop platforms, however even with this setting disabled Android will still import what it needs, you'll just get diffs in the .import files. However the difference is that with this setting enabled you can enforce it being imported on all platforms, while in the current master Godot just automatically deletes the setting from project.godot, making it useless.

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);

Expand Down