Permalink
Browse files

Merge pull request #11290 from unknownbrackets/gpu-clipping

SoftGPU: Oops, correct rounding to make sense
  • Loading branch information...
hrydgard committed Aug 11, 2018
2 parents 945eab6 + 06ad9b8 commit 1fdb1f785a5f179851e5672425bde7c394eeed54
Showing with 2 additions and 2 deletions.
  1. +2 −2 GPU/Software/TransformUnit.cpp
@@ -105,8 +105,8 @@ static inline ScreenCoords ClipToScreenInternal(const ClipCoords& coords, bool *
float z = coords.z * zScale / coords.w + zCenter;
// Account for rounding for X and Y.
const float SCREEN_BOUND = 4095.0f + (15.0f / 16.0f) + 0.375f;
// TODO: Validate actual rounding range.
const float SCREEN_BOUND = 4095.0f + (15.5f / 16.0f);
const float DEPTH_BOUND = 65535.5f;
// This matches hardware tests - depth is clamped when this flag is on.
@@ -118,7 +118,7 @@ static inline ScreenCoords ClipToScreenInternal(const ClipCoords& coords, bool *
z = 65535.0f;
else if (outside_range_flag && (x >= SCREEN_BOUND || y >= SCREEN_BOUND || x < 0 || y < 0))
*outside_range_flag = true;
} else if (outside_range_flag && (x > 4095.9675f || y >= SCREEN_BOUND || x < 0 || y < 0 || z < 0 || z >= DEPTH_BOUND)) {
} else if (outside_range_flag && (x > SCREEN_BOUND || y >= SCREEN_BOUND || x < 0 || y < 0 || z < 0 || z >= DEPTH_BOUND)) {
*outside_range_flag = true;
}

0 comments on commit 1fdb1f7

Please sign in to comment.