diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-07-01 22:38:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-01 22:38:26 -0400 |
| commit | ae7e9b54692741a706610cb228da9631db939771 (patch) | |
| tree | a8b9813e124b39e067c179032dd7f3b215487266 /src/yuzu | |
| parent | 971b89b979cb3b903263234f3a6fdd2bceb03cbe (diff) | |
| parent | aa89ec921481696c976dd1ca6687721c98e0b2d7 (diff) | |
Merge pull request #10974 from Steveice10/macos_vk
vulkan: Improvements to macOS surface creation
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/qt_common.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/vk_device_info.cpp | 5 |
2 files changed, 11 insertions, 3 deletions
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 @@ #if !defined(WIN32) && !defined(__APPLE__) #include <qpa/qplatformnativeinterface.h> +#elif defined(__APPLE__) +#include <objc/message.h> #endif namespace QtCommon { @@ -37,9 +39,12 @@ Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window) Core::Frontend::EmuWindow::WindowSystemInfo wsi; wsi.type = GetWindowSystemType(); +#if defined(WIN32) // Our Win32 Qt external doesn't have the private API. -#if defined(WIN32) || defined(__APPLE__) - wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr; + wsi.render_surface = reinterpret_cast<void*>(window->winId()); +#elif defined(__APPLE__) + wsi.render_surface = reinterpret_cast<void* (*)(id, SEL)>(objc_msgSend)( + reinterpret_cast<id>(window->winId()), sel_registerName("layer")); #else QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); wsi.display_connection = pni->nativeResourceForWindow("display", window); diff --git a/src/yuzu/vk_device_info.cpp b/src/yuzu/vk_device_info.cpp index 7c26a3dc7..e1a0e6a2a 100644 --- a/src/yuzu/vk_device_info.cpp +++ b/src/yuzu/vk_device_info.cpp @@ -26,7 +26,10 @@ Record::~Record() = default; void PopulateRecords(std::vector<Record>& records, QWindow* window) try { using namespace Vulkan; - auto wsi = QtCommon::GetWindowSystemInfo(window); + // Create a test window with a Vulkan surface type for checking present modes. + QWindow test_window(window); + test_window.setSurfaceType(QWindow::VulkanSurface); + auto wsi = QtCommon::GetWindowSystemInfo(&test_window); vk::InstanceDispatch dld; const auto library = OpenLibrary(); |
