From 3269c58c8d5eac82a9334eee989364dc625e6f25 Mon Sep 17 00:00:00 2001 From: lightningterror Date: Wed, 3 Jun 2020 18:58:10 +0200 Subject: [PATCH] gsdx-hw: Improve detection of Texture Shuffle effect. DMC3, Onimusha 3 rely on this behavior. They do fullscreen rectangle with scissor, then shift by 8 pixels, not done with recursion. So we check if it's a TS effect by checking the scissor value. Credits to Kojin for figuring out the issue. --- plugins/GSdx/Renderers/HW/GSRendererHW.cpp | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp index 025227b460..9b539c4f80 100644 --- a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp +++ b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp @@ -1294,20 +1294,27 @@ void GSRendererHW::Draw() m_texture_shuffle = (GSLocalMemory::m_psm[context->FRAME.PSM].bpp == 16) && (tex_psm.bpp == 16) && draw_sprite_tex && m_src->m_32_bits_fmt; - // Shadow_of_memories_Shadow_Flickering (Okami mustn't call this code) + // Okami mustn't call this code if (m_texture_shuffle && m_vertex.next < 3 && PRIM->FST && (m_context->FRAME.FBMSK == 0)) { // Avious dubious call to m_texture_shuffle on 16 bits games // The pattern is severals column of 8 pixels. A single sprite // smell fishy but a big sprite is wrong. - // Tomb Raider Angel of Darkness relies on this behavior to produce a fog effect. - // In this case, the address of the framebuffer and texture are the same. - // The game will take RG => BA and then the BA => RG of next pixels. - // However, only RG => BA needs to be emulated because RG isn't used. - GL_INS("WARNING: Possible misdetection of a texture shuffle effect"); - + // Shadow of Memories/Destiny shouldn't call this code. + // Causes shadow flickering. GSVertex* v = &m_vertex.buff[0]; - m_texture_shuffle = ((v[1].U - v[0].U) < 256) || m_context->FRAME.Block() == m_context->TEX0.TBP0; + m_texture_shuffle = ((v[1].U - v[0].U) < 256) || + // Tomb Raider Angel of Darkness relies on this behavior to produce a fog effect. + // In this case, the address of the framebuffer and texture are the same. + // The game will take RG => BA and then the BA => RG of next pixels. + // However, only RG => BA needs to be emulated because RG isn't used. + m_context->FRAME.Block() == m_context->TEX0.TBP0 || + // DMC3, Onimusha 3 rely on this behavior. + // They do fullscreen rectangle with scissor, then shift by 8 pixels, not done with recursion. + // So we check if it's a TS effect by checking the scissor. + ((m_context->SCISSOR.SCAX1 - m_context->SCISSOR.SCAX0) < 32); + + GL_INS("WARNING: Possible misdetection of effect, texture shuffle is %s", m_texture_shuffle ? "Enabled" : "Disabled"); } // Texture shuffle is not yet supported with strange clamp mode