From 57d3c9e1719f9194cf621e841a385166d6501cc2 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 4 Nov 2019 13:52:26 +0300 Subject: [PATCH] rsx: Take empty queries into account for engines that spam report reads. - Some games will spam the report queue with requests but have zpass statistics enabled. --- rpcs3/Emu/RSX/RSXThread.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 974c2d424e..adf3961fdf 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -3216,19 +3216,36 @@ namespace rsx const auto memory_end = memory_address + memory_range; u32 sync_address = 0; - occlusion_query_info* query; + occlusion_query_info* query = nullptr; for (auto It = m_pending_writes.crbegin(); It != m_pending_writes.crend(); ++It) { + if (sync_address) + { + if (It->query) + { + sync_address = It->sink; + query = It->query; + break; + } + + continue; + } + if (It->sink >= memory_address && It->sink < memory_end) { sync_address = It->sink; - query = It->query; - break; + + // NOTE: If application is spamming requests, there may be no query attached + if (It->query) + { + query = It->query; + break; + } } } - if (!sync_address) + if (!sync_address || !query) return result_none; if (!(flags & sync_defer_copy))