Skip to content
Permalink
Browse files

SoftGPU: Drop verts only when depth not clamped.

Depth clamping bypasses the 4096x4096 box check.
  • Loading branch information...
unknownbrackets committed Aug 6, 2018
1 parent 921727f commit cd6b1f73c1a87c2e9b6e0f8c9ec810e061dba43c
Showing with 6 additions and 4 deletions.
  1. +6 −4 GPU/Software/TransformUnit.cpp
@@ -106,14 +106,16 @@ static inline ScreenCoords ClipToScreenInternal(const ClipCoords& coords, bool *

// This matches hardware tests - depth is clamped when this flag is on.
if (gstate.isDepthClampEnabled()) {
// Note: if the depth is clamped, the outside_range_flag should NOT be set, even for x and y.
if (z < 0.f)
z = 0.f;
if (z > 65535.f)
else if (z > 65535.f)
z = 65535.f;
}

if (outside_range_flag && (x > 4095.9375f || y > 4095.9375f || x < 0 || y < 0 || z < 0 || z > 65535.f))
else if (outside_range_flag && (x > 4095.9375f || y > 4095.9375f || x < 0 || y < 0))
*outside_range_flag = true;
} else if (outside_range_flag && (x > 4095.9375f || y > 4095.9375f || x < 0 || y < 0 || z < 0 || z > 65535.f)) {
*outside_range_flag = true;
}

// 16 = 0xFFFF / 4095.9375
// Round up at 0.625 to the nearest subpixel.

0 comments on commit cd6b1f7

Please sign in to comment.
You can’t perform that action at this time.