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.
This commit is contained in:
lightningterror 2020-06-03 18:58:10 +02:00
parent cc3c5a8efc
commit 3269c58c8d
1 changed files with 15 additions and 8 deletions

View File

@ -1294,20 +1294,27 @@ void GSRendererHW::Draw()
m_texture_shuffle = (GSLocalMemory::m_psm[context->FRAME.PSM].bpp == 16) && (tex_psm.bpp == 16) m_texture_shuffle = (GSLocalMemory::m_psm[context->FRAME.PSM].bpp == 16) && (tex_psm.bpp == 16)
&& draw_sprite_tex && m_src->m_32_bits_fmt; && 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)) { 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 // Avious dubious call to m_texture_shuffle on 16 bits games
// The pattern is severals column of 8 pixels. A single sprite // The pattern is severals column of 8 pixels. A single sprite
// smell fishy but a big sprite is wrong. // smell fishy but a big sprite is wrong.
// 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) ||
// Tomb Raider Angel of Darkness relies on this behavior to produce a fog effect. // 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. // 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. // 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. // However, only RG => BA needs to be emulated because RG isn't used.
GL_INS("WARNING: Possible misdetection of a texture shuffle effect"); 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);
GSVertex* v = &m_vertex.buff[0]; GL_INS("WARNING: Possible misdetection of effect, texture shuffle is %s", m_texture_shuffle ? "Enabled" : "Disabled");
m_texture_shuffle = ((v[1].U - v[0].U) < 256) || m_context->FRAME.Block() == m_context->TEX0.TBP0;
} }
// Texture shuffle is not yet supported with strange clamp mode // Texture shuffle is not yet supported with strange clamp mode