Skip to content

Commit

Permalink
GS/HW: Reduce sensitivity of SW renderer in some scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Feb 4, 2025
1 parent 9a501b9 commit a90c6fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7306,12 +7306,19 @@ bool GSRendererHW::CanUseSwPrimRender(bool no_rt, bool no_ds, bool draw_sprite_t
if (level < 2 && (IsMipMapActive() || !IsOpaque()))
return false;

// Middle of a shuffle, don't SW it.
if (m_split_texture_shuffle_pages)
return false;

// Make sure this isn't something we've actually rendered to (e.g. a texture shuffle).
if (PRIM->TME)
{
GSTextureCache::Target* src_target = g_texture_cache->GetTargetWithSharedBits(m_cached_ctx.TEX0.TBP0, m_cached_ctx.TEX0.PSM);
if (src_target)
{
if (((GSUtil::GetChannelMask(m_cached_ctx.TEX0.PSM) & 0x7) && !src_target->m_valid_rgb) || ((GSUtil::GetChannelMask(m_cached_ctx.TEX0.PSM) & 0x8) && (!src_target->m_valid_alpha_low || !src_target->m_valid_alpha_high)))
return true;

// If the EE has written over our sample area, we're fine to do this on the CPU, despite the target.
if (!src_target->m_dirty.empty())
{
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4620,7 +4620,7 @@ GSTextureCache::Target* GSTextureCache::GetTargetWithSharedBits(u32 BP, u32 PSM)
{
Target* t = *it;
const u32 t_psm = (t->HasValidAlpha()) ? t->m_TEX0.PSM & ~0x1 : t->m_TEX0.PSM;
if (GSUtil::HasSharedBits(BP, PSM, t->m_TEX0.TBP0, t_psm))
if (GSUtil::HasSharedBits(PSM, t_psm) && (t->m_TEX0.TBP0 == BP || (GSConfig.UserHacks_TextureInsideRt >= GSTextureInRtMode::InsideTargets && t->m_TEX0.TBP0 < BP && t->UnwrappedEndBlock() > BP)))
return t;
}

Expand Down

0 comments on commit a90c6fa

Please sign in to comment.