diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_instance.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_surface.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.h | 2 | ||||
| -rw-r--r-- | src/yuzu/qt_common.cpp | 9 |
4 files changed, 19 insertions, 15 deletions
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp index 7624a9b32..6a294c1da 100644 --- a/src/video_core/vulkan_common/vulkan_instance.cpp +++ b/src/video_core/vulkan_common/vulkan_instance.cpp | |||
| @@ -19,11 +19,9 @@ | |||
| 19 | #include <windows.h> | 19 | #include <windows.h> |
| 20 | // ensure include order | 20 | // ensure include order |
| 21 | #include <vulkan/vulkan_win32.h> | 21 | #include <vulkan/vulkan_win32.h> |
| 22 | #elif defined(__APPLE__) | ||
| 23 | #include <vulkan/vulkan_macos.h> | ||
| 24 | #elif defined(__ANDROID__) | 22 | #elif defined(__ANDROID__) |
| 25 | #include <vulkan/vulkan_android.h> | 23 | #include <vulkan/vulkan_android.h> |
| 26 | #else | 24 | #elif !defined(__APPLE__) |
| 27 | #include <X11/Xlib.h> | 25 | #include <X11/Xlib.h> |
| 28 | #include <vulkan/vulkan_wayland.h> | 26 | #include <vulkan/vulkan_wayland.h> |
| 29 | #include <vulkan/vulkan_xlib.h> | 27 | #include <vulkan/vulkan_xlib.h> |
| @@ -68,7 +66,7 @@ namespace { | |||
| 68 | break; | 66 | break; |
| 69 | #elif defined(__APPLE__) | 67 | #elif defined(__APPLE__) |
| 70 | case Core::Frontend::WindowSystemType::Cocoa: | 68 | case Core::Frontend::WindowSystemType::Cocoa: |
| 71 | extensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME); | 69 | extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME); |
| 72 | break; | 70 | break; |
| 73 | #elif defined(__ANDROID__) | 71 | #elif defined(__ANDROID__) |
| 74 | case Core::Frontend::WindowSystemType::Android: | 72 | case Core::Frontend::WindowSystemType::Android: |
diff --git a/src/video_core/vulkan_common/vulkan_surface.cpp b/src/video_core/vulkan_common/vulkan_surface.cpp index c34599365..cfea4cd7b 100644 --- a/src/video_core/vulkan_common/vulkan_surface.cpp +++ b/src/video_core/vulkan_common/vulkan_surface.cpp | |||
| @@ -11,11 +11,9 @@ | |||
| 11 | #include <windows.h> | 11 | #include <windows.h> |
| 12 | // ensure include order | 12 | // ensure include order |
| 13 | #include <vulkan/vulkan_win32.h> | 13 | #include <vulkan/vulkan_win32.h> |
| 14 | #elif defined(__APPLE__) | ||
| 15 | #include <vulkan/vulkan_macos.h> | ||
| 16 | #elif defined(__ANDROID__) | 14 | #elif defined(__ANDROID__) |
| 17 | #include <vulkan/vulkan_android.h> | 15 | #include <vulkan/vulkan_android.h> |
| 18 | #else | 16 | #elif !defined(__APPLE__) |
| 19 | #include <X11/Xlib.h> | 17 | #include <X11/Xlib.h> |
| 20 | #include <vulkan/vulkan_wayland.h> | 18 | #include <vulkan/vulkan_wayland.h> |
| 21 | #include <vulkan/vulkan_xlib.h> | 19 | #include <vulkan/vulkan_xlib.h> |
| @@ -44,12 +42,13 @@ vk::SurfaceKHR CreateSurface( | |||
| 44 | } | 42 | } |
| 45 | #elif defined(__APPLE__) | 43 | #elif defined(__APPLE__) |
| 46 | if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) { | 44 | if (window_info.type == Core::Frontend::WindowSystemType::Cocoa) { |
| 47 | const VkMacOSSurfaceCreateInfoMVK mvk_ci{VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK, | 45 | const VkMetalSurfaceCreateInfoEXT macos_ci = { |
| 48 | nullptr, 0, window_info.render_surface}; | 46 | .pLayer = static_cast<const CAMetalLayer*>(window_info.render_surface), |
| 49 | const auto vkCreateMacOSSurfaceMVK = reinterpret_cast<PFN_vkCreateMacOSSurfaceMVK>( | 47 | }; |
| 50 | dld.vkGetInstanceProcAddr(*instance, "vkCreateMacOSSurfaceMVK")); | 48 | const auto vkCreateMetalSurfaceEXT = reinterpret_cast<PFN_vkCreateMetalSurfaceEXT>( |
| 51 | if (!vkCreateMacOSSurfaceMVK || | 49 | dld.vkGetInstanceProcAddr(*instance, "vkCreateMetalSurfaceEXT")); |
| 52 | vkCreateMacOSSurfaceMVK(*instance, &mvk_ci, nullptr, &unsafe_surface) != VK_SUCCESS) { | 50 | if (!vkCreateMetalSurfaceEXT || |
| 51 | vkCreateMetalSurfaceEXT(*instance, &macos_ci, nullptr, &unsafe_surface) != VK_SUCCESS) { | ||
| 53 | LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface"); | 52 | LOG_ERROR(Render_Vulkan, "Failed to initialize Metal surface"); |
| 54 | throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); | 53 | throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); |
| 55 | } | 54 | } |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h index b5e70fcd4..32bd75ad8 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.h +++ b/src/video_core/vulkan_common/vulkan_wrapper.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #define VK_NO_PROTOTYPES | 15 | #define VK_NO_PROTOTYPES |
| 16 | #ifdef _WIN32 | 16 | #ifdef _WIN32 |
| 17 | #define VK_USE_PLATFORM_WIN32_KHR | 17 | #define VK_USE_PLATFORM_WIN32_KHR |
| 18 | #elif defined(__APPLE__) | ||
| 19 | #define VK_USE_PLATFORM_METAL_EXT | ||
| 18 | #endif | 20 | #endif |
| 19 | #include <vulkan/vulkan.h> | 21 | #include <vulkan/vulkan.h> |
| 20 | 22 | ||
diff --git a/src/yuzu/qt_common.cpp b/src/yuzu/qt_common.cpp index 5d0fd7674..413402165 100644 --- a/src/yuzu/qt_common.cpp +++ b/src/yuzu/qt_common.cpp | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | #if !defined(WIN32) && !defined(__APPLE__) | 11 | #if !defined(WIN32) && !defined(__APPLE__) |
| 12 | #include <qpa/qplatformnativeinterface.h> | 12 | #include <qpa/qplatformnativeinterface.h> |
| 13 | #elif defined(__APPLE__) | ||
| 14 | #include <objc/message.h> | ||
| 13 | #endif | 15 | #endif |
| 14 | 16 | ||
| 15 | namespace QtCommon { | 17 | namespace QtCommon { |
| @@ -37,9 +39,12 @@ Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window) | |||
| 37 | Core::Frontend::EmuWindow::WindowSystemInfo wsi; | 39 | Core::Frontend::EmuWindow::WindowSystemInfo wsi; |
| 38 | wsi.type = GetWindowSystemType(); | 40 | wsi.type = GetWindowSystemType(); |
| 39 | 41 | ||
| 42 | #if defined(WIN32) | ||
| 40 | // Our Win32 Qt external doesn't have the private API. | 43 | // Our Win32 Qt external doesn't have the private API. |
| 41 | #if defined(WIN32) || defined(__APPLE__) | 44 | wsi.render_surface = reinterpret_cast<void*>(window->winId()); |
| 42 | wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr; | 45 | #elif defined(__APPLE__) |
| 46 | wsi.render_surface = reinterpret_cast<void* (*)(id, SEL)>(objc_msgSend)( | ||
| 47 | reinterpret_cast<id>(window->winId()), sel_registerName("layer")); | ||
| 43 | #else | 48 | #else |
| 44 | QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); | 49 | QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); |
| 45 | wsi.display_connection = pni->nativeResourceForWindow("display", window); | 50 | wsi.display_connection = pni->nativeResourceForWindow("display", window); |