From 4ac36cb8103f240a3c8790da20e54cf4989edc3b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 11 Sep 2021 12:18:28 -0700 Subject: [PATCH] GPU: Cull rectangles more when depth clamp off. If any vert is outside Z, it's culled when not clamping/clipping. --- GPU/Common/SoftwareTransformCommon.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 296f4dd197..882ebc89c6 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -633,7 +633,11 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy // If both transformed verts are outside Z, cull this rectangle entirely. constexpr float outsideValue = 1.000030517578125f; - if (fabsf(tl.z) >= outsideValue && fabsf(br.z) >= outsideValue) + bool tlOutside = fabsf(tl.z / tl.w) >= outsideValue; + bool brOutside = fabsf(br.z / br.w) >= outsideValue; + if (tlOutside && brOutside) + continue; + if (!gstate.isDepthClampEnabled() && (tlOutside || brOutside)) continue; RotateUV(trans, tl, br, flippedY);