Skip to content

Commit

Permalink
GS/HW: Improve half right detection on shuffles
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Sep 18, 2023
1 parent eaf3b79 commit 1668ec2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,23 @@ void GSRendererHW::ConvertSpriteTextureShuffle(bool& write_ba, bool& read_ba, GS
// No super source of truth here, since the width can get batted around, the valid is probably our best bet.
const int tex_width = tex->m_target ? tex->m_from_target->m_valid.z : (tex->m_TEX0.TBW * 64);
const int tex_tbw = tex->m_target ? tex->m_from_target_TEX0.TBW : tex->m_TEX0.TBW;
if ((static_cast<int>(m_cached_ctx.TEX0.TBW * 64) >= std::min(tex_width * 2, 1024) && tex_tbw != m_cached_ctx.TEX0.TBW) || (m_cached_ctx.TEX0.TBW * 64) < floor(m_vt.m_max.t.x))
const int clamp_minu = m_context->CLAMP.MINU;
const int clamp_maxu = m_context->CLAMP.MAXU;
int max_tex_draw_width = std::min(static_cast<int>(m_vt.m_max.t.x), 1 << m_cached_ctx.TEX0.TW);

switch (m_context->CLAMP.WMS)
{
case CLAMP_REGION_CLAMP:
max_tex_draw_width = std::min(max_tex_draw_width, clamp_maxu);
break;
case CLAMP_REGION_REPEAT:
max_tex_draw_width = std::min(max_tex_draw_width, (clamp_maxu | clamp_minu));
break;
default:
break;
}

if ((static_cast<int>(m_cached_ctx.TEX0.TBW * 64) >= std::min(tex_width * 2, 1024) && tex_tbw != m_cached_ctx.TEX0.TBW) || (m_cached_ctx.TEX0.TBW * 64) < floor(max_tex_draw_width))
{
half_right_uv = false;
half_right_vert = false;
Expand Down

0 comments on commit 1668ec2

Please sign in to comment.