From 55ad9244c0d39b35bbf506cdf09ee36fac8ac67a Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 10 Dec 2019 09:14:47 +0300 Subject: [PATCH] vk: Switch occlusion pool to FIFO rather than LIFO to avoid hard stall --- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 1 + rpcs3/Emu/RSX/VK/VKHelpers.h | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index d99673404a..b6f47e8235 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -3745,6 +3745,7 @@ void VKGSRender::get_occlusion_query_result(rsx::reports::occlusion_query_info* busy_wait(); } + // Allocation stack is FIFO and very long so no need to actually wait for fence signal data.command_buffer_to_wait->flush(); // Gather data diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 7ca143fe35..fb776dfb7c 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -9,6 +9,7 @@ #include #include #include +#include #ifdef HAVE_X11 #include @@ -2993,7 +2994,7 @@ public: VkQueryPool query_pool = VK_NULL_HANDLE; vk::render_device* owner = nullptr; - std::stack available_slots; + std::deque available_slots; std::vector query_active_status; public: @@ -3031,7 +3032,7 @@ public: for (u32 n = 0; n < count; ++n) { - available_slots.push(n); + available_slots.push_back(n); } } @@ -3102,7 +3103,7 @@ public: vkCmdResetQueryPool(cmd, query_pool, index, 1); query_active_status[index] = false; - available_slots.push(index); + available_slots.push_back(index); } } @@ -3129,8 +3130,8 @@ public: return ~0u; } - u32 result = available_slots.top(); - available_slots.pop(); + u32 result = available_slots.front(); + available_slots.pop_front(); verify(HERE), !query_active_status[result]; return result;