From 7eb7bd51417beff7c0d2abc3acca8ee6c4785e4a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 16 Oct 2022 18:49:37 -0700 Subject: [PATCH] softgpu: Correct linear interp for uneven positions. Can't round to the pixel when calculating the S/T deltas. This fixes issues in Wipeout (#16131) and Call of Duty bloom. --- GPU/Software/Rasterizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 2a24ee348a..d75f7f9476 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -826,8 +826,8 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords & tc1.t() *= 1.0f / (float)(1 << state.samplerID.height0Shift); } - int diffX = (entireX2 - entireX1 + 1) / SCREEN_SCALE_FACTOR; - int diffY = (entireY2 - entireY1 + 1) / SCREEN_SCALE_FACTOR; + float diffX = (entireX2 - entireX1 + 1) / (float)SCREEN_SCALE_FACTOR; + float diffY = (entireY2 - entireY1 + 1) / (float)SCREEN_SCALE_FACTOR; float diffS = tc1.s() - tc0.s(); float diffT = tc1.t() - tc0.t(); @@ -860,8 +860,8 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords & } // Okay, now move ST to the minX, minY position. - rowST += (stx / (float)(SCREEN_SCALE_FACTOR * 2)) * (minX - entireX1); - rowST += (sty / (float)(SCREEN_SCALE_FACTOR * 2)) * (minY - entireY1); + rowST += (stx / (float)(SCREEN_SCALE_FACTOR * 2)) * (minX - entireX1 + 1); + rowST += (sty / (float)(SCREEN_SCALE_FACTOR * 2)) * (minY - entireY1 + 1); } // And now what we add to spread out to 4 values.