From 58ded2e0d00990380f7a1d8a0359f8087048b15a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 5 Apr 2023 22:31:18 +1000 Subject: [PATCH] GS/HW: Fix incorrect hashing of non-palette textures --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index 345c8fb5ec..6b337549da 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -5112,9 +5112,10 @@ static void HashTextureLevel(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, GST if (tw < bs.x || th < bs.y || psm.fmsk != 0xFFFFFFFFu || region.GetMaxX() > 0 || region.GetMinY() > 0) { // Expand texture indices. Align to 32 bytes for AVX2. - const u32 pitch = Common::AlignUpPow2(static_cast(block_rect.z), 32); - const u32 row_size = static_cast(tw); - const GSLocalMemory::readTexture rtx = psm.rtxP; + const bool palette = (psm.pal > 0); + const u32 pitch = Common::AlignUpPow2(static_cast(block_rect.z) << (palette ? 0 : 2), 32); + const u32 row_size = static_cast(tw) << (palette ? 0 : 2); + const GSLocalMemory::readTexture rtx = palette ? psm.rtxP : psm.rtx; // Use temp buffer for expanding, since we may not need to update. rtx(mem, off, block_rect, temp, pitch, TEXA);