From e146a0034552200cf19740f56fb05153f465a51e Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Fri, 30 Jun 2023 23:35:07 -0700 Subject: vulkan: Use newer VK_EXT_metal_surface to create surface for MoltenVK. --- src/yuzu/qt_common.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/yuzu') 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 +#elif defined(__APPLE__) +#include #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(window->winId()) : nullptr; + wsi.render_surface = reinterpret_cast(window->winId()); +#elif defined(__APPLE__) + wsi.render_surface = reinterpret_cast(objc_msgSend)( + reinterpret_cast(window->winId()), sel_registerName("layer")); #else QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); wsi.display_connection = pni->nativeResourceForWindow("display", window); -- cgit v1.2.3 From aa89ec921481696c976dd1ca6687721c98e0b2d7 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Fri, 30 Jun 2023 23:35:36 -0700 Subject: yuzu: Use test window with VulkanSurface to check for present modes. It is probably not correct to create a surface on a non-VulkanSurface window. On macOS this causes a preferences crash due to missing CAMetalLayer. --- src/yuzu/vk_device_info.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/yuzu') 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& 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(); -- cgit v1.2.3