From 673f1963a068fb7d5cd8af9bb209c7633950e8f8 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 31 May 2018 04:23:45 -0700 Subject: Vulkan: Support macOS via MoltenVK The path to the MoltenVK library can be specified by the LIBMOLTENVK_PATH environment variable, otherwise it assumes it is located in the application bundle's Contents/MacOS directory. --- Source/Core/VideoBackends/Vulkan/SwapChain.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Source/Core/VideoBackends/Vulkan/SwapChain.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp index 5222d88114..ffddfe4d07 100644 --- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp +++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp @@ -118,6 +118,19 @@ VkSurfaceKHR SwapChain::CreateVulkanSurface(VkInstance instance, void* display_h return surface; +#elif defined(VK_USE_PLATFORM_MACOS_MVK) + VkMacOSSurfaceCreateInfoMVK surface_create_info = { + VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK, nullptr, 0, hwnd}; + + VkSurfaceKHR surface; + VkResult res = vkCreateMacOSSurfaceMVK(instance, &surface_create_info, nullptr, &surface); + if (res != VK_SUCCESS) + { + LOG_VULKAN_ERROR(res, "vkCreateMacOSSurfaceMVK failed: "); + return VK_NULL_HANDLE; + } + + return surface; #else return VK_NULL_HANDLE; #endif -- cgit v1.2.3