From 63ef98a9946f9f2e2f21ea12cc01ccab9ae2fa99 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 28 Jan 2013 22:35:41 -0800 Subject: [PATCH] Use pointer walking and sizeInRAM for texture hash. --- GPU/GLES/TextureCache.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 7b2164a9f1..5bddcafbb7 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -635,12 +635,11 @@ void TextureCache::SetTexture() { // If it's not huge or has been invalidated many times, recheck the whole texture. if (entry.invalidHint > 180 || (entry.invalidHint > 15 && dim <= 0x909)) { entry.invalidHint = 0; - int bufw = gstate.texbufwidth[0] & 0x3ff; - int h = 1 << ((gstate.texsize[0]>>8) & 0xf); u32 check = 0; - for (int i = 0; i < bufw * h; i += 4) { - check += Memory::ReadUnchecked_U32(texaddr + i); + u32 *checkp = (u32 *) Memory::GetPointer(texaddr); + for (u32 i = 0; i < (entry.sizeInRAM * 2) / 4; ++i) { + check += *checkp++; } if (check != entry.fullhash) { @@ -694,8 +693,9 @@ void TextureCache::SetTexture() { // to avoid excessive clearing caused by cache invalidations. entry.sizeInRAM = (bitsPerPixel[format < 11 ? format : 0] * bufw * h / 2) / 8; - for (int i = 0; i < bufw * h; i += 4) - entry.fullhash += Memory::ReadUnchecked_U32(texaddr + i); + u32 *checkp = (u32 *) Memory::GetPointer(texaddr); + for (u32 i = 0; i < (entry.sizeInRAM * 2) / 4; ++i) + entry.fullhash += *checkp++; gstate_c.curTextureWidth=w; gstate_c.curTextureHeight=h;