summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2015-09-10 12:52:54 +0200
committerMarkus Wick <markus@selfnet.de>2015-09-10 12:52:54 +0200
commit257f2ef739793b571fdbc72356a3d8f2de325bee (patch)
tree1dc8b25be5d6ada86836d51a6a3cbc16d4b1dfc1 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent921bab6b4d1656a83666083a9f198b4341ceeaf1 (diff)
parent38f6cf208934c7415c16f69a26bf85b201c447ba (diff)
Merge pull request #3000 from mimimi085181/efb-copies-garbage-collection
Perform garbage collection for efb copies
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 0107b3e57d..85a1726817 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -150,12 +150,28 @@ void TextureCache::Cleanup(int _frameCount)
if (iter->second->frameCount == FRAMECOUNT_INVALID)
{
iter->second->frameCount = _frameCount;
+ ++iter;
}
- 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())
+ else if (_frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount)
{
- iter = FreeTexture(iter);
+ 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);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+ else
+ {
+ iter = FreeTexture(iter);
+ }
}
else
{