From c05ecfc6f1f479895aa716d7d278dc5a78e9d60c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 11 May 2017 18:36:03 -0700 Subject: [PATCH] SoftGPU: Implement separate CLUT in samplerjit. --- GPU/Software/SamplerX86.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GPU/Software/SamplerX86.cpp b/GPU/Software/SamplerX86.cpp index 34d456ff91..0751c1efc3 100644 --- a/GPU/Software/SamplerX86.cpp +++ b/GPU/Software/SamplerX86.cpp @@ -434,8 +434,15 @@ bool SamplerJitCache::Jit_TransformClutIndex(const SamplerID &id, int bitsPerInd bool SamplerJitCache::Jit_ReadClutColor(const SamplerID &id) { if (!id.useSharedClut) { - // TODO: Load level, SHL 4, and add to resultReg. - return false; +#ifdef _WIN32 + // The argument was saved on the stack. + MOV(32, R(tempReg2), MDisp(RSP, 40)); + LEA(32, tempReg2, MScaled(tempReg2, SCALE_4, 0)); +#else + // We need to multiply by 16 and add, LEA allows us to copy too. + LEA(32, tempReg2, MScaled(levelReg, SCALE_4, 0)); +#endif + LEA(64, resultReg, MComplex(resultReg, tempReg2, SCALE_4, 0)); } MOV(PTRBITS, R(tempReg1), ImmPtr(clut));