summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authormimimi085181 <mimimi085181@gmail.com>2015-09-12 08:59:14 +0200
committermimimi085181 <mimimi085181@gmail.com>2015-09-12 09:12:14 +0200
commitdd458b554d3987d625cd4d17cbb5cdcd0b980f93 (patch)
tree08b597092c565751fe8dbb221845dadc3024ccbd /Source/Core/VideoCommon/TextureCacheBase.cpp
parent2e6db7dc278c2ba1d95d58c7e7fc490e5c68e14b (diff)
Fix performance regression in Sonic the Fighters, introduced by PR#2001
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 8b7b7190aa..694aa80c0a 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -22,7 +22,7 @@
#include "VideoCommon/VideoConfig.h"
static const u64 TEXHASH_INVALID = 0;
-static const int TEXTURE_KILL_THRESHOLD = 60;
+static const int TEXTURE_KILL_THRESHOLD = 64; // Sonic the Fighters (inside Sonic Gems Collection) loops a 64 frames animation
static const int TEXTURE_POOL_KILL_THRESHOLD = 3;
static const int FRAMECOUNT_INVALID = 0;
@@ -496,8 +496,12 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
}
}
- // Find the entry which hasn't been used for the longest time
- if (entry->frameCount != FRAMECOUNT_INVALID && entry->frameCount < temp_frameCount)
+ // Find the texture which hasn't been used for the longest time. Count paletted
+ // textures as the same texture here, when the texture itself is the same. This
+ // improves the performance a lot in some games that use paletted textures.
+ // Example: Sonic the Fighters (inside Sonic Gems Collection)
+ if (entry->frameCount != FRAMECOUNT_INVALID && entry->frameCount < temp_frameCount &&
+ !(isPaletteTexture && entry->base_hash == base_hash))
{
temp_frameCount = entry->frameCount;
oldest_entry = iter;