Skip to content

Commit

Permalink
softgpu: Correct linear interp for uneven positions.
Browse files Browse the repository at this point in the history
Can't round to the pixel when calculating the S/T deltas.
This fixes issues in Wipeout (#16131) and Call of Duty bloom.
  • Loading branch information
unknownbrackets committed Oct 17, 2022
1 parent 9d6de98 commit 7eb7bd5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions GPU/Software/Rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7eb7bd5

Please sign in to comment.