Merge pull request #652 from unknownbrackets/texcache

Don't blacklist an invalidated texture forever
This commit is contained in:
Henrik Rydgård 2013-02-10 23:55:48 -08:00
commit a76d1e26de
2 changed files with 9 additions and 1 deletions

View File

@ -94,7 +94,9 @@ void TextureCache::Invalidate(u32 addr, int size, bool force) {
}
if (force) {
gpuStats.numTextureInvalidations++;
iter->second.status = TexCacheEntry::STATUS_UNRELIABLE;
// Start it over from 0.
iter->second.numFrames = 0;
iter->second.framesUntilNextFullHash = 0;
} else {
iter->second.invalidHint++;
}
@ -771,6 +773,9 @@ void TextureCache::SetTexture() {
match = false;
gpuStats.numTextureInvalidations++;
entry->status = TexCacheEntry::STATUS_UNRELIABLE;
entry->numFrames = 0;
} else if (entry->status == TexCacheEntry::STATUS_UNRELIABLE && entry->numFrames > TexCacheEntry::FRAMES_REGAIN_TRUST) {
entry->status = TexCacheEntry::STATUS_HASHING;
}
}

View File

@ -45,6 +45,9 @@ public:
private:
struct TexCacheEntry {
// After marking STATUS_UNRELIABLE, if it stays the same this many frames we'll trust it again.
const static int FRAMES_REGAIN_TRUST = 1000;
enum Status {
STATUS_HASHING,
STATUS_RELIABLE, // cache, don't hash