From b8411a90cd95da4ac69ee1830f71c0c53eabe78a Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 1 Mar 2025 16:16:07 +0300 Subject: [PATCH] vk/swapchain: Fix WSI swapchain configuration overrides --- rpcs3/Emu/RSX/VK/vkutils/instance.cpp | 9 ++++++--- rpcs3/Emu/RSX/VK/vkutils/swapchain_android.hpp | 4 ++-- rpcs3/Emu/RSX/VK/vkutils/swapchain_core.h | 5 +++++ rpcs3/Emu/RSX/VK/vkutils/swapchain_macos.hpp | 4 ++-- rpcs3/Emu/RSX/VK/vkutils/swapchain_unix.hpp | 6 +++--- rpcs3/Emu/RSX/VK/vkutils/swapchain_win32.hpp | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/vkutils/instance.cpp b/rpcs3/Emu/RSX/VK/vkutils/instance.cpp index d28b90b338..0527376e08 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/instance.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/instance.cpp @@ -250,8 +250,11 @@ namespace vk swapchain_base* instance::create_swapchain(display_handle_t window_handle, vk::physical_device& dev) { - bool force_wm_reporting_off = false; - m_surface = make_WSI_surface(m_instance, window_handle); + WSI_config surface_config + { + .supports_automatic_wm_reports = true + }; + m_surface = make_WSI_surface(m_instance, window_handle, &surface_config); u32 device_queues = dev.get_queue_count(); std::vector supports_present(device_queues, VK_FALSE); @@ -358,6 +361,6 @@ namespace vk color_space = surfFormats[0].colorSpace; - return new swapchain_WSI(dev, present_queue_idx, graphics_queue_idx, transfer_queue_idx, format, m_surface, color_space, force_wm_reporting_off); + return new swapchain_WSI(dev, present_queue_idx, graphics_queue_idx, transfer_queue_idx, format, m_surface, color_space, !surface_config.supports_automatic_wm_reports); } } diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain_android.hpp b/rpcs3/Emu/RSX/VK/vkutils/swapchain_android.hpp index 38da782e87..ccec22a383 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain_android.hpp +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain_android.hpp @@ -9,8 +9,8 @@ namespace vk using swapchain_NATIVE = swapchain_ANDROID; // TODO: Implement this - static - VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle) + [[maybe_unused]] static + VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* /*config*/) { return VK_NULL_HANDLE; } diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain_core.h b/rpcs3/Emu/RSX/VK/vkutils/swapchain_core.h index 37285c4f77..aaf8426b9a 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain_core.h +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain_core.h @@ -219,4 +219,9 @@ namespace vk return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; } }; + + struct WSI_config + { + bool supports_automatic_wm_reports = true; + }; } diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain_macos.hpp b/rpcs3/Emu/RSX/VK/vkutils/swapchain_macos.hpp index ec53ab1812..1d502d1b9f 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain_macos.hpp +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain_macos.hpp @@ -8,8 +8,8 @@ namespace vk using swapchain_MacOS = native_swapchain_base; using swapchain_NATIVE = swapchain_MacOS; - static - VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t handle) + [[maybe_unused]] static + VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t handle, WSI_config* /*config*/) { VkSurfaceKHR result = VK_NULL_HANDLE; VkMacOSSurfaceCreateInfoMVK createInfo = {}; diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain_unix.hpp b/rpcs3/Emu/RSX/VK/vkutils/swapchain_unix.hpp index a2bf589346..ec893da8e8 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain_unix.hpp +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain_unix.hpp @@ -130,8 +130,8 @@ namespace vk #endif - static - VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle) + [[maybe_unused]] static + VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* config) { VkSurfaceKHR result = VK_NULL_HANDLE; @@ -158,7 +158,7 @@ namespace vk createInfo.display = p.first; createInfo.surface = p.second; CHECK_RESULT(vkCreateWaylandSurfaceKHR(vk_instance, &createInfo, nullptr, &result)); - force_wm_reporting_off = true; + config->supports_automatic_wm_reports = false; } else #endif diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain_win32.hpp b/rpcs3/Emu/RSX/VK/vkutils/swapchain_win32.hpp index de7f45c5c4..c509d7cffa 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain_win32.hpp +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain_win32.hpp @@ -93,8 +93,8 @@ namespace vk using swapchain_NATIVE = swapchain_WIN32; - static - VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle) + [[maybe_unused]] static + VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* /*config*/) { HINSTANCE hInstance = NULL; VkSurfaceKHR result = VK_NULL_HANDLE;