Merge pull request #3000 from mimimi085181/efb-copies-garbage-collection

Perform garbage collection for efb copies
This commit is contained in:
Markus Wick 2015-09-10 12:52:54 +02:00
commit 257f2ef739
1 changed files with 20 additions and 4 deletions

View File

@ -150,10 +150,16 @@ void TextureCache::Cleanup(int _frameCount)
if (iter->second->frameCount == FRAMECOUNT_INVALID) if (iter->second->frameCount == FRAMECOUNT_INVALID)
{ {
iter->second->frameCount = _frameCount; iter->second->frameCount = _frameCount;
++iter;
} }
if (_frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount && else if (_frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount)
// EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted {
!iter->second->IsEfbCopy()) if (iter->second->IsEfbCopy())
{
// Only remove EFB copies when they wouldn't be used anymore(changed hash), because EFB copies living on the
// host GPU are unrecoverable. Perform this check only every TEXTURE_KILL_THRESHOLD for performance reasons
if ((_frameCount - iter->second->frameCount) % TEXTURE_KILL_THRESHOLD == 1 &&
iter->second->hash != GetHash64(Memory::GetPointer(iter->second->addr), iter->second->size_in_bytes, g_ActiveConfig.iSafeTextureCache_ColorSamples))
{ {
iter = FreeTexture(iter); iter = FreeTexture(iter);
} }
@ -162,6 +168,16 @@ void TextureCache::Cleanup(int _frameCount)
++iter; ++iter;
} }
} }
else
{
iter = FreeTexture(iter);
}
}
else
{
++iter;
}
}
TexPool::iterator iter2 = texture_pool.begin(); TexPool::iterator iter2 = texture_pool.begin();
TexPool::iterator tcend2 = texture_pool.end(); TexPool::iterator tcend2 = texture_pool.end();