gsdx tc: add an invalidation procedure to drop sub rt

It will be used in next commit. However, it might not be the best solution
This commit is contained in:
Gregory Hainaut 2016-03-19 11:39:56 +01:00
parent 2ca624c8c6
commit 72d43b2e56
2 changed files with 25 additions and 0 deletions

View File

@ -851,6 +851,30 @@ void GSTextureCache::InvalidateLocalMem(GSOffset* off, const GSVector4i& r)
// TODO: ds
}
// Hack: remove Target that are strictly included in current rt. Typically uses for FMV
// For example, game is rendered at 0x800->0x1000, fmv will be uploaded to 0x0->0x2800
// FIXME In theory, we ought to report the data from the sub rt to the main rt. But let's
// postpone it for later.
void GSTextureCache::InvalidateVideoMemSubTarget(GSTextureCache::Target* rt)
{
if (!rt)
return;
for(list<Target*>::iterator i = m_dst[RenderTarget].begin(); i != m_dst[RenderTarget].end(); ) {
list<Target*>::iterator j = i++;
Target* t = *j;
if ((t->m_TEX0.TBP0 > rt->m_TEX0.TBP0) && (t->m_end_block < rt->m_end_block) && (t->m_TEX0.TBW == rt->m_TEX0.TBW)
&& (t->m_TEX0.TBP0 < t->m_end_block)) {
GL_INS("InvalidateVideoMemSubTarget: rt 0x%x -> 0x%x, sub rt 0x%x -> 0x%x",
rt->m_TEX0.TBP0, rt->m_end_block, t->m_TEX0.TBP0, t->m_end_block);
m_dst[RenderTarget].erase(j);
delete t;
}
}
}
void GSTextureCache::IncAge()
{
int maxage = m_src.m_used ? 3 : 30;

View File

@ -145,6 +145,7 @@ public:
Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h, int real_h);
void InvalidateVideoMemType(int type, uint32 bp);
void InvalidateVideoMemSubTarget(GSTextureCache::Target* rt);
void InvalidateVideoMem(GSOffset* off, const GSVector4i& r, bool target = true);
void InvalidateLocalMem(GSOffset* off, const GSVector4i& r);