From 93ee82d84f6b95c46ee2ea30ee64b66cc0441ff3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 22 Oct 2022 10:29:47 -0700 Subject: [PATCH] GPU: Respect depth clamp in bounding box check. Although, logically, this feels reversed - it rejects the point if it's outside positive Z, which would clamp. This matches PSP tests. --- GPU/Common/DrawEngineCommon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index ad3f733a40..17b93dc810 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -295,7 +295,9 @@ bool DrawEngineCommon::TestBoundingBox(const void *control_points, const void *i Matrix4ByMatrix4(worldview, world, view); Matrix4ByMatrix4(worldviewproj, worldview, gstate.projMatrix); PlanesFromMatrix(worldviewproj, planes); - for (int plane = 0; plane < 6; plane++) { + // Note: near/far are not checked without clamp/clip enabled, so we skip those planes. + int totalPlanes = gstate.isDepthClampEnabled() ? 6 : 4; + for (int plane = 0; plane < totalPlanes; plane++) { int inside = 0; int out = 0; for (int i = 0; i < vertexCount; i++) {