From e04d23e086354263fea9a1dade3de1c7d81f50f9 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 28 Aug 2022 12:16:08 -0700 Subject: [PATCH] SW/Rasterizer: Fix indirect stage using texture coordinates/maps >= 4 The masking was incorrect. This affects the main menu of The Last Avatar, though that menu also relies on copy filter functionality that is not correctly handled in the software renderer so the difference is not obvious; that game shuffles textures across all indices for some reason, so this issue would presumably result in subtle flickering. --- Source/Core/VideoBackends/Software/Rasterizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index b7170527d5..2a341d8093 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -291,9 +291,9 @@ static void BuildBlock(s32 blockX, s32 blockY) u32 indref = bpmem.tevindref.hex; for (unsigned int i = 0; i < bpmem.genMode.numindstages; i++) { - u32 texmap = indref & 3; + u32 texmap = indref & 7; indref >>= 3; - u32 texcoord = indref & 3; + u32 texcoord = indref & 7; indref >>= 3; CalculateLOD(&rasterBlock.IndirectLod[i], &rasterBlock.IndirectLinear[i], texmap, texcoord);