From f84cb1c9ccc5534125f07c5fa254ce3e532c3bb1 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 4 Feb 2022 17:02:50 +0100 Subject: [PATCH] GS-hw: Optimize fbmask on 16bit format. Set fbmask to 0 if unused bits are the ones enabling it, they aren't used anyway. --- pcsx2/GS/Renderers/HW/GSRendererNew.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp index de7425ad75..1eff4611e8 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererNew.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererNew.cpp @@ -298,7 +298,13 @@ void GSRendererNew::EmulateTextureShuffleAndFbmask() { m_conf.ps.dfmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt; - const GSVector4i fbmask_v = GSVector4i::load((int)m_context->FRAME.FBMSK); + // Don't allow only unused bits on 16bit format to enable fbmask, + // let's set the mask to 0 in such cases. + int fbmask = static_cast(m_context->FRAME.FBMSK); + if (!(fbmask & 0x80F8F8F8) && fbmask != 0x0 && m_conf.ps.dfmt == 2) + fbmask = 0x0; + + const GSVector4i fbmask_v = GSVector4i::load(fbmask); const int ff_fbmask = fbmask_v.eq8(GSVector4i::xffffffff()).mask(); const int zero_fbmask = fbmask_v.eq8(GSVector4i::zero()).mask();