-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SoftGPU: Fix some minor rounding on viewport cull.
Had some tests failing when on the edge due to this.
- Loading branch information
1 parent
44be615
commit 31d5c39
Showing
1 changed file
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -104,16 +104,21 @@ static inline ScreenCoords ClipToScreenInternal(const ClipCoords& coords, bool * | ||
float y = coords.y * yScale / coords.w + yCenter; | float y = coords.y * yScale / coords.w + yCenter; | ||
float z = coords.z * zScale / coords.w + zCenter; | 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; | |||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
unknownbrackets
Author
Collaborator
|
|||
// TODO: Validate actual rounding range. | |||
const float DEPTH_BOUND = 65535.5f; | |||
|
|||
// This matches hardware tests - depth is clamped when this flag is on. | // This matches hardware tests - depth is clamped when this flag is on. | ||
if (gstate.isDepthClampEnabled()) { | if (gstate.isDepthClampEnabled()) { | ||
// Note: if the depth is clamped, the outside_range_flag should NOT be set, even for x and y. | // Note: if the depth is clamped, the outside_range_flag should NOT be set, even for x and y. | ||
if (z < 0.f) | if (z < 0.f) | ||
z = 0.f; | z = 0.f; | ||
else if (z > 65535.f) | else if (z > 65535.0f) | ||
z = 65535.f; | z = 65535.0f; | ||
else if (outside_range_flag && (x > 4095.9375f || y > 4095.9375f || x < 0 || y < 0)) | else if (outside_range_flag && (x >= SCREEN_BOUND || y >= SCREEN_BOUND || x < 0 || y < 0)) | ||
*outside_range_flag = true; | *outside_range_flag = true; | ||
} else 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.9675f || y >= SCREEN_BOUND || x < 0 || y < 0 || z < 0 || z >= DEPTH_BOUND)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
|||
*outside_range_flag = true; | *outside_range_flag = true; | ||
} | } | ||
|
|
||
|
Hm, by the way. So this is supposed to be more than 4096 ?