Skip to content

Commit

Permalink
GSdx-hw, TC: aggressive rt overlap invalidation in Jak2/3/X.
Browse files Browse the repository at this point in the history
  • Loading branch information
iMineLink committed Dec 13, 2020
1 parent 5122f46 commit ef462ec
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions plugins/GSdx/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,37 @@ void GSTextureCache::InvalidateVideoMem(GSOffset* off, const GSVector4i& rect, b

// GH: Try to detect texture write that will overlap with a target buffer
if(GSUtil::HasSharedBits(psm, t->m_TEX0.PSM)) {
if (m_renderer->m_game.title == CRC::Jak2 ||
m_renderer->m_game.title == CRC::Jak3 ||
m_renderer->m_game.title == CRC::JakX)
{
// Detect generic overlapping with framebuffer.
// Some games do not like to have the Target(s) made dirty so aggresively, hence the branch.
// Fixes Jak 2/3 striped and shimmering textures.
// Fixes Jak X wheels rendering.

const SurfaceOffset so = ComputeSurfaceOffset(off, r, t);
if (so.is_valid)
{
// Offset from Target to Source in Target coords.
t->m_dirty.push_back(GSDirtyRect(so.b2a_offset, psm));
t->m_TEX0.TBW = bw;
GL_CACHE("TC: Dirty in the middle [aggressive] of Target(%s) %d (0x%x->0x%x) pos(%d,%d => %d,%d) bw:%u",
to_string(type),
t->m_texture ? t->m_texture->GetID() : 0,
t->m_TEX0.TBP0,
t->m_end_block,
so.b2a_offset.x,
so.b2a_offset.y,
so.b2a_offset.z,
so.b2a_offset.w,
bw
);
continue;
}
// Proceed with legacy code.
}

if (bp < t->m_TEX0.TBP0)
{
uint32 rowsize = bw * 8192;
Expand Down

0 comments on commit ef462ec

Please sign in to comment.