diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 268d30283..ab13c5cb8 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -322,6 +322,8 @@ static Frontend::WindowSystemType GetWindowSystemType() { return Frontend::WindowSystemType::X11; else if (platform_name == QStringLiteral("wayland")) return Frontend::WindowSystemType::Wayland; + else if (platform_name == QStringLiteral("cocoa")) + return Frontend::WindowSystemType::MacOS; LOG_CRITICAL(Frontend, "Unknown Qt platform!"); return Frontend::WindowSystemType::Windows; diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index 98b7dd79d..61846a8a5 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h @@ -18,7 +18,9 @@ namespace Frontend { /// WindowInformation enum class WindowSystemType : u8 { Headless, + Android, Windows, + MacOS, X11, Wayland, }; diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index a8ca99559..40afc225c 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -8,7 +8,6 @@ #elif defined(_WIN32) #define VK_USE_PLATFORM_WIN32_KHR #elif defined(__APPLE__) -#define VK_USE_PLATFORM_MACOS_MVK #define VK_USE_PLATFORM_METAL_EXT #else #define VK_USE_PLATFORM_WAYLAND_KHR @@ -63,6 +62,17 @@ vk::SurfaceKHR CreateSurface(vk::Instance instance, const Frontend::EmuWindow& e UNREACHABLE(); } } +#elif defined(VK_USE_PLATFORM_METAL_EXT) + if (window_info.type == Frontend::WindowSystemType::MacOS) { + const vk::MetalSurfaceCreateInfoEXT macos_ci = { + .pLayer = static_cast(window_info.render_surface) + }; + + if (instance.createMetalSurfaceEXT(&macos_ci, nullptr, &surface) != vk::Result::eSuccess) { + LOG_CRITICAL(Render_Vulkan, "Failed to initialize MacOS surface"); + UNREACHABLE(); + } + } #endif if (!surface) { @@ -98,6 +108,10 @@ std::vector GetInstanceExtensions(Frontend::WindowSystemType window case Frontend::WindowSystemType::Wayland: extensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); break; +#elif defined(VK_USE_PLATFORM_METAL_EXT) + case Frontend::WindowSystemType::MacOS: + extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME); + break; #endif default: LOG_ERROR(Render_Vulkan, "Presentation not supported on this platform");