TextureCacheBase: De-uglify entry lookup a bit

This commit is contained in:
NeoBrainX 2011-12-26 18:45:22 +01:00 committed by NeoBrainX
parent 9c39952c34
commit 8bc9e443fd
1 changed files with 14 additions and 24 deletions

View File

@ -88,9 +88,8 @@ TextureCache::~TextureCache()
void TextureCache::Cleanup() void TextureCache::Cleanup()
{ {
TexCache::iterator TexCache::iterator iter = textures.begin();
iter = textures.begin(), TexCache::iterator tcend = textures.end();
tcend = textures.end();
while (iter != tcend) while (iter != tcend)
{ {
if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) // TODO: Deleting EFB copies might not be a good idea here... if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) // TODO: Deleting EFB copies might not be a good idea here...
@ -236,33 +235,24 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
TCacheEntryBase *entry = textures[texID]; TCacheEntryBase *entry = textures[texID];
if (entry) if (entry)
{ {
if (!g_ActiveConfig.bSafeTextureCache) if (g_ActiveConfig.bSafeTextureCache)
{ {
if (entry->isRenderTarget || entry->isDynamic) if (g_ActiveConfig.bCopyEFBToTexture && (entry->isRenderTarget || entry->isDynamic))
hash_value = TEXHASH_INVALID;
}
else
{
if (!(entry->isRenderTarget || entry->isDynamic))
hash_value = *(u32*)ptr;
else if (g_ActiveConfig.bCopyEFBToTexture)
hash_value = TEXHASH_INVALID;
else
{ {
if (!g_ActiveConfig.bCopyEFBToTexture)
{
hash_value = GetHash64(ptr, texture_size, g_ActiveConfig.iSafeTextureCache_ColorSamples); hash_value = GetHash64(ptr, texture_size, g_ActiveConfig.iSafeTextureCache_ColorSamples);
if (isPaletteTexture) if (isPaletteTexture)
{ hash_value ^= GetHash64(&texMem[tlutaddr], palette_size, g_ActiveConfig.iSafeTextureCache_ColorSamples);
hash_value ^= GetHash64(&texMem[tlutaddr], palette_size,
g_ActiveConfig.iSafeTextureCache_ColorSamples);
}
}
else
{
hash_value = TEXHASH_INVALID;
}
} }
else
{
hash_value = *(u32*)ptr;
}
}
else if ((entry->isRenderTarget || entry->isDynamic) && g_ActiveConfig.bCopyEFBToTexture)
{
hash_value = TEXHASH_INVALID;
} }
if (((entry->isRenderTarget || entry->isDynamic) && hash_value == entry->hash && address == entry->addr) if (((entry->isRenderTarget || entry->isDynamic) && hash_value == entry->hash && address == entry->addr)