mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Remove eewrite from invalidatevideomem, allow age on frame
This commit is contained in:
parent
d6ba2aa76a
commit
261b3f7e5c
|
@ -183,7 +183,7 @@ GSTexture* GSRendererHW::GetOutput(int i, float& scale, int& y_offset)
|
|||
|
||||
if (GSTextureCache::Target* rt = g_texture_cache->LookupDisplayTarget(TEX0, framebufferSize, GetTextureScaleFactor()))
|
||||
{
|
||||
rt->Update(false);
|
||||
rt->Update();
|
||||
t = rt->m_texture;
|
||||
scale = rt->m_scale;
|
||||
|
||||
|
@ -224,7 +224,7 @@ GSTexture* GSRendererHW::GetFeedbackOutput(float& scale)
|
|||
if (!rt)
|
||||
return nullptr;
|
||||
|
||||
rt->Update(false);
|
||||
rt->Update();
|
||||
GSTexture* t = rt->m_texture;
|
||||
scale = rt->m_scale;
|
||||
|
||||
|
@ -993,7 +993,7 @@ void GSRendererHW::FinishSplitClear()
|
|||
OI_DoGsMemClear(clear_off, rect, m_split_clear_color);
|
||||
|
||||
// Invalidate any targets in this range.
|
||||
g_texture_cache->InvalidateVideoMem(clear_off, rect, false, true);
|
||||
g_texture_cache->InvalidateVideoMem(clear_off, rect, true);
|
||||
|
||||
m_split_clear_start.U64 = 0;
|
||||
m_split_clear_pages = 0;
|
||||
|
@ -1047,7 +1047,7 @@ void GSRendererHW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
|
|||
}
|
||||
if (loop_h || loop_w)
|
||||
{
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), rect, eewrite);
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), rect);
|
||||
if (loop_h)
|
||||
{
|
||||
rect.y = 0;
|
||||
|
@ -1058,10 +1058,10 @@ void GSRendererHW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
|
|||
rect.x = 0;
|
||||
rect.z = r.z - 2048;
|
||||
}
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), rect, eewrite);
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), rect);
|
||||
}
|
||||
else
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), r, eewrite);
|
||||
g_texture_cache->InvalidateVideoMem(m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM), r);
|
||||
}
|
||||
|
||||
void GSRendererHW::InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut)
|
||||
|
@ -1843,14 +1843,14 @@ void GSRendererHW::Draw()
|
|||
{
|
||||
GL_INS("Clear draw with mem clear and valid clear height, invalidating.");
|
||||
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, false, true);
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, true);
|
||||
g_texture_cache->InvalidateVideoMemType(GSTextureCache::RenderTarget, m_cached_ctx.FRAME.Block());
|
||||
if(no_target_found)
|
||||
g_texture_cache->InvalidateVideoMemType(GSTextureCache::DepthStencil, m_cached_ctx.FRAME.Block());
|
||||
|
||||
if (m_cached_ctx.ZBUF.ZMSK == 0)
|
||||
{
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.zb, m_r, false, false);
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.zb, m_r, false);
|
||||
g_texture_cache->InvalidateVideoMemType(GSTextureCache::DepthStencil, m_cached_ctx.ZBUF.Block());
|
||||
}
|
||||
|
||||
|
@ -2099,7 +2099,7 @@ void GSRendererHW::Draw()
|
|||
// If TEX0 == FBP, we're going to have a source left in the TC.
|
||||
// That source will get used in the actual draw unsafely, so kick it out.
|
||||
if (m_cached_ctx.FRAME.Block() == m_cached_ctx.TEX0.TBP0)
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, false, false);
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, false);
|
||||
|
||||
cleanup_cancelled_draw();
|
||||
return;
|
||||
|
@ -2267,9 +2267,9 @@ void GSRendererHW::Draw()
|
|||
}
|
||||
}
|
||||
if (rt)
|
||||
rt->Update(true);
|
||||
rt->Update();
|
||||
if (ds)
|
||||
ds->Update(true);
|
||||
ds->Update();
|
||||
|
||||
const GSVector2i resolution = PCRTCDisplays.GetResolution();
|
||||
GSTextureCache::Target* old_rt = nullptr;
|
||||
|
@ -2499,7 +2499,7 @@ void GSRendererHW::Draw()
|
|||
|
||||
rt->UpdateValidBits(~fm & fm_mask);
|
||||
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, false, false);
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.fb, m_r, false);
|
||||
|
||||
if (can_invalidate)
|
||||
g_texture_cache->InvalidateVideoMemType(GSTextureCache::DepthStencil, m_cached_ctx.FRAME.Block());
|
||||
|
@ -2513,7 +2513,7 @@ void GSRendererHW::Draw()
|
|||
|
||||
ds->UpdateValidBits(GSLocalMemory::m_psm[m_cached_ctx.ZBUF.PSM].fmsk);
|
||||
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.zb, m_r, false, false);
|
||||
g_texture_cache->InvalidateVideoMem(context->offset.zb, m_r, false);
|
||||
|
||||
if (can_invalidate)
|
||||
g_texture_cache->InvalidateVideoMemType(GSTextureCache::RenderTarget, m_cached_ctx.ZBUF.Block());
|
||||
|
|
|
@ -903,7 +903,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||
}
|
||||
// If not all channels are clean/dirty or only part of the rect is dirty, we need to update the target.
|
||||
if (((channels & channel_mask) != channel_mask || partial))
|
||||
t->Update(false);
|
||||
t->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1028,7 +1028,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||
{
|
||||
// Only update if the rect isn't empty
|
||||
if (!dirty_rect.rempty())
|
||||
t->Update(false);
|
||||
t->Update();
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
@ -1334,10 +1334,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(GIFRegTEX0 TEX0, const GSVe
|
|||
dst->m_TEX0.TBP0, dst->m_TEX0.TBW, psm_str(dst->m_TEX0.PSM));
|
||||
}
|
||||
|
||||
// Update is done by caller after TEX0 update for non-frame.
|
||||
if (is_frame)
|
||||
dst->Update(old_found == dst);
|
||||
|
||||
if (dst->m_scale != scale)
|
||||
{
|
||||
calcRescale(dst);
|
||||
|
@ -1421,7 +1417,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(GIFRegTEX0 TEX0, const GSVe
|
|||
}
|
||||
|
||||
// Now pull in any dirty areas in the new format.
|
||||
dst->Update(true);
|
||||
dst->Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1709,7 +1705,7 @@ void GSTextureCache::InvalidateVideoMemType(int type, u32 bp)
|
|||
|
||||
// Goal: invalidate data sent to the GPU when the source (GS memory) is modified
|
||||
// Called each time you want to write to the GS memory
|
||||
void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& rect, bool eewrite, bool target)
|
||||
void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& rect, bool target)
|
||||
{
|
||||
const u32 bp = off.bp();
|
||||
const u32 bw = off.bw();
|
||||
|
@ -1876,9 +1872,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
continue;
|
||||
}
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
@ -1949,9 +1942,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
continue;
|
||||
}
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
|
||||
can_erase = t->m_dirty.GetTotalRect(t->m_TEX0, GSVector2i(t->m_valid.z, t->m_valid.w)).eq(t->m_valid);
|
||||
}
|
||||
else
|
||||
|
@ -1982,9 +1972,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
continue;
|
||||
}
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
|
||||
can_erase = t->m_dirty.GetTotalRect(t->m_TEX0, GSVector2i(t->m_valid.z, t->m_valid.w)).eq(t->m_valid);
|
||||
}
|
||||
}
|
||||
|
@ -2044,8 +2031,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
}
|
||||
else
|
||||
{
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
++i;
|
||||
}
|
||||
continue;
|
||||
|
@ -2111,9 +2096,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
delete t;
|
||||
}
|
||||
|
||||
if (t && eewrite)
|
||||
t->m_age = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -2150,9 +2132,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
delete t;
|
||||
}
|
||||
|
||||
if (t && eewrite)
|
||||
t->m_age = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -2229,9 +2208,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
delete t;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2243,9 +2219,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
new_rect.w = (r.w + (page_size.y - 1)) & ~(page_size.y - 1);
|
||||
|
||||
DirtyRectByPage(bp & ~((1 << 5) - 1), psm, bw, t, new_rect);
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2283,9 +2256,6 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
|||
delete t;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eewrite)
|
||||
t->m_age = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2420,7 +2390,7 @@ void GSTextureCache::InvalidateLocalMem(const GSOffset& off, const GSVector4i& r
|
|||
{
|
||||
// The draw rect and read rect overlap somewhat, we should update the target before downloading it.
|
||||
if (t->m_TEX0.TBP0 == bp && !dirty_rect.rintersect(targetr).rempty())
|
||||
t->Update(false);
|
||||
t->Update();
|
||||
|
||||
Read(t, draw_rect);
|
||||
|
||||
|
@ -2569,7 +2539,7 @@ void GSTextureCache::InvalidateLocalMem(const GSOffset& off, const GSVector4i& r
|
|||
|
||||
// The draw rect and read rect overlap somewhat, we should update the target before downloading it.
|
||||
if (exact_bp && !dirty_rect.rintersect(targetr).rempty())
|
||||
t->Update(false);
|
||||
t->Update();
|
||||
|
||||
Read(t, targetr);
|
||||
|
||||
|
@ -2674,7 +2644,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
|
|||
|
||||
// The main point of HW moves is so GPU data can get used as sources. If we don't flush all writes,
|
||||
// we're not going to be able to use it as a source.
|
||||
dst->Update(true);
|
||||
dst->Update();
|
||||
|
||||
// Expand the target when we used a more conservative size.
|
||||
const int required_dh = scaled_dy + scaled_h;
|
||||
|
@ -2759,7 +2729,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
|
|||
|
||||
dst->UpdateValidity(GSVector4i(dx, dy, dx + w, dy + h));
|
||||
// Invalidate any sources that overlap with the target (since they're now stale).
|
||||
InvalidateVideoMem(g_gs_renderer->m_mem.GetOffset(DBP, DBW, DPSM), GSVector4i(dx, dy, dx + w, dy + h), false, false);
|
||||
InvalidateVideoMem(g_gs_renderer->m_mem.GetOffset(DBP, DBW, DPSM), GSVector4i(dx, dy, dx + w, dy + h), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3282,7 +3252,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
src->m_valid_rect = dst->m_valid;
|
||||
src->m_end_block = dst->m_end_block;
|
||||
|
||||
dst->Update(true);
|
||||
dst->Update();
|
||||
|
||||
// Rounding up should never exceed the texture size (since it itself should be rounded up), but just in case.
|
||||
GSVector2i new_size(
|
||||
|
@ -4653,9 +4623,8 @@ GSTextureCache::Target::~Target()
|
|||
#endif
|
||||
}
|
||||
|
||||
void GSTextureCache::Target::Update(bool reset_age)
|
||||
void GSTextureCache::Target::Update()
|
||||
{
|
||||
if (reset_age)
|
||||
m_age = 0;
|
||||
|
||||
// FIXME: the union of the rects may also update wrong parts of the render target (but a lot faster :)
|
||||
|
@ -4779,7 +4748,7 @@ void GSTextureCache::Target::UpdateIfDirtyIntersects(const GSVector4i& rc)
|
|||
// but, to keep things simple, just update the whole thing
|
||||
GL_CACHE("TC: Update dirty rectangle [%d,%d,%d,%d] due to intersection with [%d,%d,%d,%d]",
|
||||
dirty_rc.x, dirty_rc.y, dirty_rc.z, dirty_rc.w, rc.x, rc.y, rc.z, rc.w);
|
||||
Update(true);
|
||||
Update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public:
|
|||
void UpdateValidity(const GSVector4i& rect, bool can_resize = true);
|
||||
void UpdateValidBits(u32 bits_written);
|
||||
|
||||
void Update(bool reset_age);
|
||||
void Update();
|
||||
|
||||
/// Updates the target, if the dirty area intersects with the specified rectangle.
|
||||
void UpdateIfDirtyIntersects(const GSVector4i& rc);
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
|
||||
void InvalidateVideoMemType(int type, u32 bp);
|
||||
void InvalidateVideoMemSubTarget(GSTextureCache::Target* rt);
|
||||
void InvalidateVideoMem(const GSOffset& off, const GSVector4i& r, bool eewrite = false, bool target = true);
|
||||
void InvalidateVideoMem(const GSOffset& off, const GSVector4i& r, bool target = true);
|
||||
void InvalidateLocalMem(const GSOffset& off, const GSVector4i& r, bool full_flush = false);
|
||||
|
||||
/// Removes any sources which point to the specified target.
|
||||
|
|
Loading…
Reference in New Issue