From 3efe7ae24d21535adef1429e93d3d5c2bf8fbf53 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 20 May 2013 00:53:39 -0700 Subject: [PATCH] Cache based on the full clutformat. Not just 2 bits of it. Oops. Simpler this way. --- GPU/GLES/TextureCache.cpp | 12 +++--------- GPU/GLES/TextureCache.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 943d4ffeaf..2ef93f2d7f 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -767,12 +767,6 @@ inline bool TextureCache::TexCacheEntry::Matches(u16 dim2, u32 hash2, u8 format2 return dim == dim2 && hash == hash2 && format == format2 && maxLevel == maxLevel2; } -inline bool TextureCache::TexCacheEntry::MatchesClut(bool hasClut, u8 clutformat2) { - if (!hasClut) - return true; - return clutformat == clutformat2; -} - void TextureCache::LoadClut() { u32 clutAddr = GetClutAddr(); u32 clutTotalBytes = (gstate.loadclut & 0x3f) * 32; @@ -848,7 +842,7 @@ void TextureCache::SetTexture() { clutDirty_ = false; } clutformat = gstate.clutformat & 3; - cluthash = GetCurrentClutHash(); + cluthash = GetCurrentClutHash() ^ gstate.clutformat; cachekey |= (u64)cluthash << 32; } else { clutformat = 0; @@ -898,7 +892,7 @@ void TextureCache::SetTexture() { //Validate the texture here (width, height etc) int dim = gstate.texsize[0] & 0xF0F; - bool match = entry->Matches(dim, texhash, format, maxLevel) && entry->MatchesClut(hasClut, clutformat); + bool match = entry->Matches(dim, texhash, format, maxLevel); bool rehash = (entry->status & TexCacheEntry::STATUS_MASK) == TexCacheEntry::STATUS_UNRELIABLE; bool doDelete = true; @@ -936,7 +930,7 @@ void TextureCache::SetTexture() { TexCache::iterator secondIter = secondCache.find(secondKey); if (secondIter != secondCache.end()) { TexCacheEntry *secondEntry = &secondIter->second; - if (secondEntry->Matches(dim, texhash, format, maxLevel) && secondEntry->MatchesClut(hasClut, clutformat)) { + if (secondEntry->Matches(dim, texhash, format, maxLevel)) { // Reset the numInvalidated value lower, we got a match. if (entry->numInvalidated > 8) { --entry->numInvalidated; diff --git a/GPU/GLES/TextureCache.h b/GPU/GLES/TextureCache.h index 3875982839..4c3d922ca5 100644 --- a/GPU/GLES/TextureCache.h +++ b/GPU/GLES/TextureCache.h @@ -98,7 +98,6 @@ private: bool tClamp; bool Matches(u16 dim2, u32 hash2, u8 format2, int maxLevel2); - bool MatchesClut(bool hasClut, u8 clutformat2); }; void Decimate(); // Run this once per frame to get rid of old textures.