Cache based on the full clutformat.
Not just 2 bits of it. Oops. Simpler this way.
This commit is contained in:
parent
2076b00c9d
commit
3efe7ae24d
2 changed files with 3 additions and 10 deletions
|
@ -767,12 +767,6 @@ inline bool TextureCache::TexCacheEntry::Matches(u16 dim2, u32 hash2, u8 format2
|
||||||
return dim == dim2 && hash == hash2 && format == format2 && maxLevel == maxLevel2;
|
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() {
|
void TextureCache::LoadClut() {
|
||||||
u32 clutAddr = GetClutAddr();
|
u32 clutAddr = GetClutAddr();
|
||||||
u32 clutTotalBytes = (gstate.loadclut & 0x3f) * 32;
|
u32 clutTotalBytes = (gstate.loadclut & 0x3f) * 32;
|
||||||
|
@ -848,7 +842,7 @@ void TextureCache::SetTexture() {
|
||||||
clutDirty_ = false;
|
clutDirty_ = false;
|
||||||
}
|
}
|
||||||
clutformat = gstate.clutformat & 3;
|
clutformat = gstate.clutformat & 3;
|
||||||
cluthash = GetCurrentClutHash();
|
cluthash = GetCurrentClutHash() ^ gstate.clutformat;
|
||||||
cachekey |= (u64)cluthash << 32;
|
cachekey |= (u64)cluthash << 32;
|
||||||
} else {
|
} else {
|
||||||
clutformat = 0;
|
clutformat = 0;
|
||||||
|
@ -898,7 +892,7 @@ void TextureCache::SetTexture() {
|
||||||
//Validate the texture here (width, height etc)
|
//Validate the texture here (width, height etc)
|
||||||
|
|
||||||
int dim = gstate.texsize[0] & 0xF0F;
|
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 rehash = (entry->status & TexCacheEntry::STATUS_MASK) == TexCacheEntry::STATUS_UNRELIABLE;
|
||||||
bool doDelete = true;
|
bool doDelete = true;
|
||||||
|
|
||||||
|
@ -936,7 +930,7 @@ void TextureCache::SetTexture() {
|
||||||
TexCache::iterator secondIter = secondCache.find(secondKey);
|
TexCache::iterator secondIter = secondCache.find(secondKey);
|
||||||
if (secondIter != secondCache.end()) {
|
if (secondIter != secondCache.end()) {
|
||||||
TexCacheEntry *secondEntry = &secondIter->second;
|
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.
|
// Reset the numInvalidated value lower, we got a match.
|
||||||
if (entry->numInvalidated > 8) {
|
if (entry->numInvalidated > 8) {
|
||||||
--entry->numInvalidated;
|
--entry->numInvalidated;
|
||||||
|
|
|
@ -98,7 +98,6 @@ private:
|
||||||
bool tClamp;
|
bool tClamp;
|
||||||
|
|
||||||
bool Matches(u16 dim2, u32 hash2, u8 format2, int maxLevel2);
|
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.
|
void Decimate(); // Run this once per frame to get rid of old textures.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue