From fc292b127ba60208065d2e940c0c59d414702f53 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 15 Jan 2022 23:51:21 -0800 Subject: [PATCH] softgpu: Correct dither matrix lookup. Oops, need to wrap x/y, of course... --- GPU/Software/DrawPixel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPU/Software/DrawPixel.cpp b/GPU/Software/DrawPixel.cpp index f345059f70..54eb519bdc 100644 --- a/GPU/Software/DrawPixel.cpp +++ b/GPU/Software/DrawPixel.cpp @@ -460,7 +460,7 @@ void SOFTRAST_CALL DrawSinglePixel(int x, int y, int z, int fog, Vec4IntArg colo const Vec4 dst = Vec4::FromRGBA(old_color); Vec3 blended = AlphaBlendingResult(pixelID, prim_color, dst); if (pixelID.dithering) { - blended += Vec3::AssignToAll(pixelID.cached.ditherMatrix[y * 4 + x]); + blended += Vec3::AssignToAll(pixelID.cached.ditherMatrix[(y & 3) * 4 + (x & 3)]); } // ToRGB() always automatically clamps. @@ -469,7 +469,7 @@ void SOFTRAST_CALL DrawSinglePixel(int x, int y, int z, int fog, Vec4IntArg colo } else { if (pixelID.dithering) { // We'll discard alpha anyway. - prim_color += Vec4::AssignToAll(pixelID.cached.ditherMatrix[y * 4 + x]); + prim_color += Vec4::AssignToAll(pixelID.cached.ditherMatrix[(y & 3) * 4 + (x & 3)]); } #if defined(_M_SSE)