From eb140c52a4d84a9ce881477f0686aece2bd128a6 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 29 Feb 2020 12:12:34 +0300 Subject: [PATCH] rsx: Reset ZCULL statistics at the end of a frame - Workaround for games that leak zpass/zstats. The information is useless anyway without a clear op so it should be fine. --- rpcs3/Emu/RSX/RSXThread.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 2f81d4ae70..61d99c2669 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -2560,6 +2560,15 @@ namespace rsx Emu.Pause(); } + if (zcull_ctrl->has_pending()) + { + // NOTE: This is a workaround for buggy games. + // Some applications leave the zpass/stats gathering active but don't use the information. + // This can lead to the zcull unit using up all the memory queueing up operations that never get consumed. + // Seen in Diablo III and Yakuza 5 + zcull_ctrl->clear(this, CELL_GCM_ZPASS_PIXEL_CNT | CELL_GCM_ZCULL_STATS); + } + // Save current state m_queued_flip.stats = m_frame_stats; m_queued_flip.push(buffer); @@ -2930,7 +2939,7 @@ namespace rsx void ZCULL_control::clear(class ::rsx::thread* ptimer, u32 type) { - if (type != CELL_GCM_ZPASS_PIXEL_CNT) + if (!(type & CELL_GCM_ZPASS_PIXEL_CNT)) { // Other types do not generate queries at the moment return;