Don't hash the clut when it's not even used.

Many games load the clut even when it wasn't changed, and we don't flush
between when this happens.  There shouldn't be any need to rehash the clut
either.

Technically, the clut could have actually changed, but this would
generally require them to clear the dcache or something in a way the GE
probably doesn't support.
This commit is contained in:
Unknown W. Brackets 2013-05-26 12:41:36 -07:00
parent 315559afe6
commit c53386244d
2 changed files with 5 additions and 4 deletions

View file

@ -769,12 +769,11 @@ inline bool TextureCache::TexCacheEntry::Matches(u16 dim2, u32 hash2, u8 format2
void TextureCache::LoadClut() {
u32 clutAddr = GetClutAddr();
u32 clutTotalBytes = (gstate.loadclut & 0x3f) * 32;
clutTotalBytes_ = (gstate.loadclut & 0x3f) * 32;
if (Memory::IsValidAddress(clutAddr)) {
Memory::Memcpy((u8 *)clutBuf_, clutAddr, clutTotalBytes);
clutHash_ = CityHash32((const char *)clutBuf_, clutTotalBytes);
Memory::Memcpy((u8 *)clutBuf_, clutAddr, clutTotalBytes_);
} else {
memset(clutBuf_, 0xFF, clutTotalBytes);
memset(clutBuf_, 0xFF, clutTotalBytes_);
clutHash_ = 0;
}
clutDirty_ = true;
@ -838,6 +837,7 @@ void TextureCache::SetTexture() {
if (hasClut) {
if (clutDirty_) {
// We update here because the clut format can be specified after the load.
clutHash_ = CityHash32((const char *)clutBuf_, clutTotalBytes_);
UpdateCurrentClut();
clutDirty_ = false;
}

View file

@ -129,6 +129,7 @@ private:
bool clutDirty_;
u32 *clutBuf_;
u32 clutHash_;
u32 clutTotalBytes_;
// True if the clut is just alpha values in the same order (RGBA4444-bit only.)
bool clutAlphaLinear_;
u16 clutAlphaLinearColor_;