From f2a9b59aae417be940abd5d61e92635fb63a60f3 Mon Sep 17 00:00:00 2001 From: lightningterror Date: Thu, 3 Oct 2019 15:50:19 +0200 Subject: [PATCH] gsdx-ogl: Hit unsafe instead of safe path for sw fbmask when there is no alpha blending. (#3100) So far notable performance improvement show Spiderman 3 and Scarface of 1-2 fps when using basic blending. Full list of known affected games at #3100 --- plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp | 4 ++-- plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp index fda90fe6de..3253259c5d 100644 --- a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp @@ -295,7 +295,7 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask() if (m_ps_sel.fbmask && enable_fbmask_emulation) { - // fprintf(stderr, "%d: FBMASK SW emulated fb_mask:%x on tex shuffle\n", s_n, fbmask); + // fprintf(stderr, "%d: FBMASK Unsafe SW emulated fb_mask:%x on tex shuffle\n", s_n, fbmask); ps_cb.FbMask.r = rg_mask; ps_cb.FbMask.g = rg_mask; ps_cb.FbMask.b = ba_mask; @@ -329,7 +329,7 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask() // it will work. Masked bit will be constant and normally the same everywhere // RT/FS output/Cached value. - /*fprintf(stderr, "%d: FBMASK SW emulated fb_mask:%x on %d bits format\n", s_n, m_context->FRAME.FBMSK, + /*fprintf(stderr, "%d: FBMASK Unsafe SW emulated fb_mask:%x on %d bits format\n", s_n, m_context->FRAME.FBMSK, (GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt == 2) ? 16 : 32);*/ m_bind_rtsample = true; } diff --git a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp index 9c85bf4669..0641afbf9f 100644 --- a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp @@ -261,12 +261,19 @@ void GSRendererOGL::EmulateTextureShuffleAndFbmask() } if (m_ps_sel.fbmask && m_sw_blending) { - GL_INS("FBMASK SW emulated fb_mask:%x on tex shuffle", fbmask); ps_cb.FbMask.r = rg_mask; ps_cb.FbMask.g = rg_mask; ps_cb.FbMask.b = ba_mask; ps_cb.FbMask.a = ba_mask; - m_require_full_barrier = true; + + // No blending so hit unsafe path. + if (!PRIM->ABE) { + GL_INS("FBMASK Unsafe SW emulated fb_mask:%x on tex shuffle", fbmask); + m_require_one_barrier = true; + } else { + GL_INS("FBMASK SW emulated fb_mask:%x on tex shuffle", fbmask); + m_require_full_barrier = true; + } } else { m_ps_sel.fbmask = 0; } @@ -303,8 +310,8 @@ void GSRendererOGL::EmulateTextureShuffleAndFbmask() TextureBarrier() will guarantee that writes have completed and caches have been invalidated before subsequent Draws are executed. */ - // Safe option was removed. Likely nobody never use it. Keep the code commented if it becomes useful one day - if (!(~ff_fbmask & ~zero_fbmask & 0x7) /*&& !UserHacks_safe_fbmask*/) { + // No blending so hit unsafe path. + if (!PRIM->ABE || !(~ff_fbmask & ~zero_fbmask & 0x7)) { GL_INS("FBMASK Unsafe SW emulated fb_mask:%x on %d bits format", m_context->FRAME.FBMSK, (GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt == 2) ? 16 : 32); m_require_one_barrier = true;