diff options
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/SCsub | 4 | ||||
-rw-r--r-- | platform/macos/crash_handler_macos.h | 2 | ||||
-rw-r--r-- | platform/macos/detect.py | 9 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 75 | ||||
-rw-r--r-- | platform/macos/export/export_plugin.cpp | 5 | ||||
-rw-r--r-- | platform/macos/export/export_plugin.h | 2 | ||||
-rw-r--r-- | platform/macos/os_macos.h | 2 | ||||
-rw-r--r-- | platform/macos/os_macos.mm | 9 |
8 files changed, 69 insertions, 39 deletions
diff --git a/platform/macos/SCsub b/platform/macos/SCsub index 3924e79fb6..598444ae24 100644 --- a/platform/macos/SCsub +++ b/platform/macos/SCsub @@ -27,7 +27,9 @@ def generate_bundle(target, source, env): target_bin = lipo(bin_dir + "/" + prefix, env.extra_suffix + env.module_version_string) # Assemble .app bundle and update version info. - app_dir = Dir("#bin/" + (prefix + env.extra_suffix + env.module_version_string).replace(".", "_") + ".app").abspath + app_dir = Dir( + "#bin/" + (prefix + env.extra_suffix + env.module_version_string).replace(".", "_") + ".app" + ).abspath templ = Dir("#misc/dist/macos_tools.app").abspath if os.path.exists(app_dir): shutil.rmtree(app_dir) diff --git a/platform/macos/crash_handler_macos.h b/platform/macos/crash_handler_macos.h index f821283167..d52cb7234a 100644 --- a/platform/macos/crash_handler_macos.h +++ b/platform/macos/crash_handler_macos.h @@ -38,7 +38,7 @@ public: void initialize(); void disable(); - bool is_disabled() const { return disabled; }; + bool is_disabled() const { return disabled; } CrashHandler(); ~CrashHandler(); diff --git a/platform/macos/detect.py b/platform/macos/detect.py index a8968b592e..cab91fd33c 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -3,7 +3,7 @@ import sys from typing import TYPE_CHECKING from methods import detect_darwin_sdk_path, get_compiler_version, is_vanilla_clang, print_error, print_warning -from platform_methods import detect_arch, detect_mvk +from platform_methods import detect_arch, detect_mvk, validate_arch if TYPE_CHECKING: from SCons.Script.SConscript import SConsEnvironment @@ -68,12 +68,7 @@ def get_flags(): def configure(env: "SConsEnvironment"): # Validate arch. supported_arches = ["x86_64", "arm64"] - if env["arch"] not in supported_arches: - print_error( - 'Unsupported CPU architecture "%s" for macOS. Supported architectures are: %s.' - % (env["arch"], ", ".join(supported_arches)) - ) - sys.exit(255) + validate_arch(env["arch"], get_name(), supported_arches) ## Build type diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 48cc7bbba3..f1078d9868 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -752,6 +752,7 @@ bool DisplayServerMacOS::has_feature(Feature p_feature) const { case FEATURE_NATIVE_DIALOG: case FEATURE_NATIVE_DIALOG_INPUT: case FEATURE_NATIVE_DIALOG_FILE: + case FEATURE_NATIVE_DIALOG_FILE_EXTRA: case FEATURE_IME: case FEATURE_WINDOW_TRANSPARENCY: case FEATURE_HIDPI: @@ -2676,6 +2677,18 @@ int64_t DisplayServerMacOS::window_get_native_handle(HandleType p_handle_type, W } return 0; } + case EGL_DISPLAY: { + if (gl_manager_angle) { + return (int64_t)gl_manager_angle->get_display(p_window); + } + return 0; + } + case EGL_CONFIG: { + if (gl_manager_angle) { + return (int64_t)gl_manager_angle->get_config(p_window); + } + return 0; + } #endif default: { return 0; @@ -3611,6 +3624,39 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM //TODO - do Vulkan and OpenGL support checks, driver selection and fallback rendering_driver = p_rendering_driver; +#if defined(RD_ENABLED) +#if defined(VULKAN_ENABLED) + if (rendering_driver == "vulkan") { + rendering_context = memnew(RenderingContextDriverVulkanMacOS); + } +#endif +#if defined(METAL_ENABLED) + if (rendering_driver == "metal") { + rendering_context = memnew(RenderingContextDriverMetal); + } +#endif + + if (rendering_context) { + if (rendering_context->initialize() != OK) { + memdelete(rendering_context); + rendering_context = nullptr; +#if defined(GLES3_ENABLED) + bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3"); + if (fallback_to_opengl3 && rendering_driver != "opengl3") { + WARN_PRINT("Your device seem not to support MoltenVK or Metal, switching to OpenGL 3."); + rendering_driver = "opengl3"; + OS::get_singleton()->set_current_rendering_method("gl_compatibility"); + OS::get_singleton()->set_current_rendering_driver_name(rendering_driver); + } else +#endif + { + r_error = ERR_CANT_CREATE; + ERR_FAIL_MSG("Could not initialize " + rendering_driver); + } + } + } +#endif + #if defined(GLES3_ENABLED) if (rendering_driver == "opengl3_angle") { gl_manager_angle = memnew(GLManagerANGLE_MacOS); @@ -3643,35 +3689,6 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM } } #endif -#if defined(RD_ENABLED) -#if defined(VULKAN_ENABLED) - if (rendering_driver == "vulkan") { - rendering_context = memnew(RenderingContextDriverVulkanMacOS); - } -#endif -#if defined(METAL_ENABLED) - if (rendering_driver == "metal") { - rendering_context = memnew(RenderingContextDriverMetal); - } -#endif - - if (rendering_context) { - if (rendering_context->initialize() != OK) { - memdelete(rendering_context); - rendering_context = nullptr; - bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3"); - if (fallback_to_opengl3 && rendering_driver != "opengl3") { - WARN_PRINT("Your device seem not to support MoltenVK or Metal, switching to OpenGL 3."); - rendering_driver = "opengl3"; - OS::get_singleton()->set_current_rendering_method("gl_compatibility"); - OS::get_singleton()->set_current_rendering_driver_name(rendering_driver); - } else { - r_error = ERR_CANT_CREATE; - ERR_FAIL_MSG("Could not initialize " + rendering_driver); - } - } - } -#endif Point2i window_position; if (p_position != nullptr) { diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 7887e5d0ab..bf5645d9a6 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -65,6 +65,11 @@ void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset } else { ERR_PRINT("Invalid architecture"); } + + if (architecture == "universal") { + r_features->push_back("x86_64"); + r_features->push_back("arm64"); + } } String EditorExportPlatformMacOS::get_export_option_warning(const EditorExportPreset *p_preset, const StringName &p_name) const { diff --git a/platform/macos/export/export_plugin.h b/platform/macos/export/export_plugin.h index 4ded2f3301..ef8d1bb8ab 100644 --- a/platform/macos/export/export_plugin.h +++ b/platform/macos/export/export_plugin.h @@ -76,7 +76,7 @@ class EditorExportPlatformMacOS : public EditorExportPlatform { ssh_args = p_ssh_arg; cmd_args = p_cmd_args; wait = p_wait; - }; + } }; Ref<ImageTexture> run_icon; diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h index 303fc112bf..4fb4507837 100644 --- a/platform/macos/os_macos.h +++ b/platform/macos/os_macos.h @@ -114,6 +114,8 @@ public: virtual String get_unique_id() const override; virtual String get_processor_name() const override; + virtual String get_model_name() const override; + virtual bool is_sandboxed() const override; virtual Vector<String> get_granted_permissions() const override; virtual void revoke_granted_permissions() override; diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index d9086b8c38..08ff391aab 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -67,6 +67,15 @@ void OS_MacOS::initialize() { initialize_core(); } +String OS_MacOS::get_model_name() const { + char buffer[256]; + size_t buffer_len = 256; + if (sysctlbyname("hw.model", &buffer, &buffer_len, nullptr, 0) == 0 && buffer_len != 0) { + return String::utf8(buffer, buffer_len); + } + return OS_Unix::get_model_name(); +} + String OS_MacOS::get_processor_name() const { char buffer[256]; size_t buffer_len = 256; |