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 /platform/macos | |
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 'platform/macos')
-rw-r--r-- | platform/macos/export/export_plugin.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 5c20016aa5..bb96308a75 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -48,16 +48,18 @@ #endif void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const { - if (p_preset->get("texture_format/s3tc")) { + r_features->push_back(p_preset->get("binary_format/architecture")); + String architecture = p_preset->get("binary_format/architecture"); + + if (architecture == "universal" || architecture == "x86_64") { r_features->push_back("s3tc"); - } - if (p_preset->get("texture_format/etc")) { - r_features->push_back("etc"); - } - if (p_preset->get("texture_format/etc2")) { + r_features->push_back("bptc"); + } else if (architecture == "arm64") { r_features->push_back("etc2"); + r_features->push_back("astc"); + } else { + ERR_PRINT("Invalid architecture"); } - r_features->push_back(p_preset->get("binary_format/architecture")); } bool EditorExportPlatformMacOS::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option, const HashMap<StringName, Variant> &p_options) const { @@ -210,10 +212,6 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/removable_volumes_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need to use removable volumes"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "privacy/removable_volumes_usage_description_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary())); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); - String run_script = "#!/usr/bin/env bash\n" "unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"\n" "open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"; @@ -1766,6 +1764,24 @@ bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorE } } + String architecture = p_preset->get("binary_format/architecture"); + + if (architecture == "universal" || architecture == "x86_64") { + const String bc_error = test_bc(); + if (!bc_error.is_empty()) { + valid = false; + err += bc_error; + } + } else if (architecture == "arm64") { + const String etc_error = test_etc2(); + if (!etc_error.is_empty()) { + valid = false; + err += etc_error; + } + } else { + ERR_PRINT("Invalid architecture"); + } + // Look for export templates (official templates, check only is custom templates are not set). if (!dvalid || !rvalid) { dvalid = exists_export_template("macos.zip", &err); |