From 818d17183b954892f23d45df49451136bc950241 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 23 Jan 2022 12:39:50 -0800 Subject: [PATCH] softgpu: Correct clear mode dither. It does apply, but have to be careful about alpha. --- GPU/Software/Clipper.cpp | 2 +- GPU/Software/DrawPixelX86.cpp | 4 ++-- test.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPU/Software/Clipper.cpp b/GPU/Software/Clipper.cpp index f07f64614e..9035c85077 100644 --- a/GPU/Software/Clipper.cpp +++ b/GPU/Software/Clipper.cpp @@ -243,7 +243,7 @@ void ProcessRect(const VertexData &v0, const VertexData &v1, BinManager &binner) RotateUVThrough(v0, v1, *topright, *bottomleft); - if (gstate.isModeClear()) { + if (gstate.isModeClear() && !gstate.isDitherEnabled()) { binner.AddClearRect(v0, v1); } else { // Four triangles to do backfaces as well. Two of them will get backface culled. diff --git a/GPU/Software/DrawPixelX86.cpp b/GPU/Software/DrawPixelX86.cpp index e6bee83afc..8399390a92 100644 --- a/GPU/Software/DrawPixelX86.cpp +++ b/GPU/Software/DrawPixelX86.cpp @@ -1449,9 +1449,9 @@ bool PixelJitCache::Jit_Dither(const PixelFuncID &id) { regCache_.Release(valueReg, RegCache::GEN_TEMP0); // Now we want to broadcast RGB in 16-bit, but keep A as 0. - // Luckily, we know that second lane (in 16-bit) is zero from valueReg's high 16 bits. + // Luckily, we know that third lane (in 16-bit) is zero from MOVD clearing it. // We use 16-bit because we need a signed add, but we also want to saturate. - PSHUFLW(vecValueReg, R(vecValueReg), _MM_SHUFFLE(1, 0, 0, 0)); + PSHUFLW(vecValueReg, R(vecValueReg), _MM_SHUFFLE(2, 0, 0, 0)); // With that, now let's convert the color to 16 bit... X64Reg argColorReg = regCache_.Find(RegCache::VEC_ARG_COLOR); diff --git a/test.py b/test.py index e5a3af6c45..77e7644df7 100755 --- a/test.py +++ b/test.py @@ -136,6 +136,7 @@ tests_good = [ "gpu/commands/basic", "gpu/commands/blocktransfer", "gpu/commands/material", + "gpu/dither/dither", "gpu/filtering/linear", "gpu/filtering/mipmaplinear", "gpu/filtering/nearest", @@ -379,7 +380,6 @@ tests_next = [ "gpu/depth/precision", "gpu/displaylist/alignment", "gpu/displaylist/state", - "gpu/dither/dither", "gpu/ge/break", "gpu/ge/get", "gpu/primitives/bezier",