From aec41b34d6d4d15bb04dccbc1c3c3bd087391482 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 1 Dec 2021 19:31:29 -0800 Subject: [PATCH] softjit: Reduce ditherMatrix to 8-bit. Oops, not sure why I made it 16 bit. --- GPU/Software/DrawPixelX86.cpp | 9 ++++----- GPU/Software/FuncId.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/GPU/Software/DrawPixelX86.cpp b/GPU/Software/DrawPixelX86.cpp index c8a98ca3e8..cf670a3dc9 100644 --- a/GPU/Software/DrawPixelX86.cpp +++ b/GPU/Software/DrawPixelX86.cpp @@ -1382,19 +1382,18 @@ bool PixelJitCache::Jit_Dither(const PixelFuncID &id) { MOVSX(32, 8, valueReg, R(valueReg)); SAR(8, R(valueReg), Imm8(4)); #else - // Sum up (x + y * 4) * 2 + ditherMatrix offset to valueReg. - SHL(32, R(argXReg), Imm8(1)); - LEA(32, valueReg, MComplex(argXReg, valueReg, 8, offsetof(PixelFuncID, cached.ditherMatrix))); + // Sum up (x + y * 4) + ditherMatrix offset to valueReg. + LEA(32, valueReg, MComplex(argXReg, valueReg, 4, offsetof(PixelFuncID, cached.ditherMatrix))); // Okay, now abuse argXReg to read the PixelFuncID pointer on the stack. if (regCache_.Has(RegCache::GEN_ARG_ID)) { X64Reg idReg = regCache_.Find(RegCache::GEN_ARG_ID); - MOVSX(32, 16, valueReg, MRegSum(idReg, valueReg)); + MOVSX(32, 8, valueReg, MRegSum(idReg, valueReg)); regCache_.Unlock(idReg, RegCache::GEN_ARG_ID); } else { _assert_(stackIDOffset_ != -1); MOV(PTRBITS, R(argXReg), MDisp(RSP, stackIDOffset_)); - MOVSX(32, 16, valueReg, MRegSum(argXReg, valueReg)); + MOVSX(32, 8, valueReg, MRegSum(argXReg, valueReg)); } #endif if (argXReg != INVALID_REG) { diff --git a/GPU/Software/FuncId.h b/GPU/Software/FuncId.h index 565860f15d..c36df1bfdc 100644 --- a/GPU/Software/FuncId.h +++ b/GPU/Software/FuncId.h @@ -35,7 +35,7 @@ struct PixelFuncID { struct { // Warning: these are not hashed or compared for equal. Just cached values. uint32_t colorWriteMask{}; - int16_t ditherMatrix[16]{}; + int8_t ditherMatrix[16]{}; } cached; #endif