From 2e0d11ca4c359a0fdaf1eba4e709a3302c8e48f6 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sun, 25 Oct 2026 12:31:35 +0100 Subject: [PATCH] Latte: Zero out remapped uniforms of the opposite mode --- src/Cafe/HW/Latte/Core/LatteBufferData.cpp | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteBufferData.cpp b/src/Cafe/HW/Latte/Core/LatteBufferData.cpp index 538f35e3..c08c98b6 100644 --- a/src/Cafe/HW/Latte/Core/LatteBufferData.cpp +++ b/src/Cafe/HW/Latte/Core/LatteBufferData.cpp @@ -90,7 +90,7 @@ bool LatteBufferCache_LoadRemappedUniforms(LatteDecompilerShader* shader, float* UNREACHABLE; } // sourced from uniform registers - if (aluConstDirty) + if (aluConstDirty && shader->list_remappedUniformEntries_register.size() > 0) { uint32* aluConstBase = LatteGPUState.contextRegister + mmSQ_ALU_CONSTANT0_0 + shaderAluConst; for (auto it : shader->list_remappedUniformEntries_register) @@ -100,8 +100,20 @@ bool LatteBufferCache_LoadRemappedUniforms(LatteDecompilerShader* shader, float* regDest[0] = uniformRegData[0]; regDest[1] = uniformRegData[1]; } - if (!shader->list_remappedUniformEntries_register.empty()) - hasChange = true; + hasChange = true; + } + // uniform blocks should read as zero + for (auto& bufferGroup : shader->list_remappedUniformEntries_bufferGroups) + { + if ((uniformBufferDirtyMask&(1<list_remappedUniformEntries_register.size() > 0) + { + for (auto it : shader->list_remappedUniformEntries_register) + { + uint64* __restrict regDest = (uint64*)((uint8*)uniformData + it.mappedIndexOffset); + regDest[0] = 0; + regDest[1] = 0; + } + hasChange = true; + } } return hasChange; }