From f97191e241e8a6dbea6b08eb108fab98273d3523 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 15 Feb 2023 02:14:00 +1000 Subject: [PATCH] GS/HW: Split up consecutive channel shuffles --- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 7 ++++++- pcsx2/GS/Renderers/HW/GSRendererHW.h | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index adc6b56713..510947f002 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -1361,7 +1361,10 @@ void GSRendererHW::Draw() if (m_channel_shuffle) { - m_channel_shuffle = draw_sprite_tex && (m_context->TEX0.PSM == PSM_PSMT8) && single_page; + // NFSU2 does consecutive channel shuffles with blending, reducing the alpha channel over time. + // Fortunately, it seems to change the FBMSK along the way, so this check alone is sufficient. + m_channel_shuffle = draw_sprite_tex && m_context->TEX0.PSM == PSM_PSMT8 && single_page && + m_last_channel_shuffle_fbmsk == m_context->FRAME.FBMSK; if (m_channel_shuffle) { GL_CACHE("Channel shuffle effect detected SKIP"); @@ -1375,6 +1378,7 @@ void GSRendererHW::Draw() { GL_INS("Channel shuffle effect detected"); m_channel_shuffle = true; + m_last_channel_shuffle_fbmsk = m_context->FRAME.FBMSK; } else { @@ -1621,6 +1625,7 @@ void GSRendererHW::Draw() { GL_INS("Channel shuffle effect detected (2nd shot)"); m_channel_shuffle = true; + m_last_channel_shuffle_fbmsk = m_context->FRAME.FBMSK; } else { diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.h b/pcsx2/GS/Renderers/HW/GSRendererHW.h index c3e9a77b58..4c6c8cf79e 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.h +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.h @@ -107,8 +107,10 @@ private: int m_skip = 0; int m_skip_offset = 0; - bool m_tex_is_fb = false; + u32 m_last_channel_shuffle_fbmsk = 0; bool m_channel_shuffle = false; + + bool m_tex_is_fb = false; bool m_userhacks_tcoffset = false; float m_userhacks_tcoffset_x = 0.0f; float m_userhacks_tcoffset_y = 0.0f;