Skip to content

Commit

Permalink
GS/HW: Don't allow PCRTC frames pull RGB from depth
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Sep 15, 2023
1 parent 30e3a3a commit da8db72
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1802,19 +1802,24 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(GIFRegTEX0 TEX0, const GSVe
!dst->m_valid_rgb && !FullRectDirty(dst, 0x7) &&
(GSLocalMemory::m_psm[TEX0.PSM].trbpp < 24 || fbmask != 0x00FFFFFFu))
{
GL_CACHE("TC: Attempt to repopulate RGB for %s[%x]", to_string(type), dst->m_TEX0.TBP0);
for (Target* dst_match : m_dst[DepthStencil])
// Neo Contra clears 0x1400 with Z16S, then uses that address to upload C32 frames, this gets confused and makes a mess of it.
// TODO: Look in to making sure bad format conversions don't happen.
if (!is_frame)
{
if (dst_match->m_TEX0.TBP0 != TEX0.TBP0 || !dst_match->m_valid_rgb)
continue;

if (!CopyRGBFromDepthToColor(dst, dst_match))
GL_CACHE("TC: Attempt to repopulate RGB for %s[%x]", to_string(type), dst->m_TEX0.TBP0);
for (Target* dst_match : m_dst[DepthStencil])
{
// Needed new texture and memory allocation failed.
return nullptr;
}
if (dst_match->m_TEX0.TBP0 != TEX0.TBP0 || !dst_match->m_valid_rgb)
continue;

break;
if (!CopyRGBFromDepthToColor(dst, dst_match))
{
// Needed new texture and memory allocation failed.
return nullptr;
}

break;
}
}

if (!dst->m_valid_rgb)
Expand Down

0 comments on commit da8db72

Please sign in to comment.