Skip to content

Commit

Permalink
overdraw: Remove redundant v2z/v3z swap
Browse files Browse the repository at this point in the history
v2z/v3z are unused in the rest of the function since we just rely on v1z
and depth gradients from here on. We already avoided flipping them, so
we also avoid swapping them. This fixes a few clang-tidy warnings.
  • Loading branch information
zeux committed Nov 19, 2023
1 parent f95a0bb commit 8c3ae2f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/overdrawanalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ static void rasterize(OverdrawBuffer* buffer, float v1x, float v1y, float v1z, f
// flip backfacing triangles to simplify rasterization logic
if (sign)
{
// flipping v2 & v3 preserves depth gradients since they're based on v1
// flipping v2 & v3 preserves depth gradients since they're based on v1; only v1z is used below
float t;
t = v2x, v2x = v3x, v3x = t;
t = v2y, v2y = v3y, v3y = t;
t = v2z, v2z = v3z, v3z = t;

// flip depth since we rasterize backfacing triangles to second buffer with reverse Z; only v1z is used below
v1z = kViewport - v1z;
Expand Down

0 comments on commit 8c3ae2f

Please sign in to comment.