From 29b55814160bc021812360fa5f1f58106b2b4e52 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 28 Oct 2018 15:56:02 -0700 Subject: [PATCH] GLES: Correct invalid scissor handling. Also improves Direct3D 9. See #11444. Per hardware tests, we should correctly not draw in this case. --- GPU/Common/GPUStateUtils.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index a4432fd971..2a0e88d216 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -571,10 +571,17 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo // This is a bit of a hack as the render buffer isn't always that size // We always scissor on non-buffered so that clears don't spill outside the frame. out.scissorEnable = true; - out.scissorX = renderX + displayOffsetX + scissorX1 * renderWidthFactor; - out.scissorY = renderY + displayOffsetY + scissorY1 * renderHeightFactor; - out.scissorW = (scissorX2 - scissorX1) * renderWidthFactor; - out.scissorH = (scissorY2 - scissorY1) * renderHeightFactor; + if (scissorX2 < scissorX1 || scissorY2 < scissorY1) { + out.scissorX = 0; + out.scissorY = 0; + out.scissorW = 0; + out.scissorH = 0; + } else { + out.scissorX = renderX + displayOffsetX + scissorX1 * renderWidthFactor; + out.scissorY = renderY + displayOffsetY + scissorY1 * renderHeightFactor; + out.scissorW = (scissorX2 - scissorX1) * renderWidthFactor; + out.scissorH = (scissorY2 - scissorY1) * renderHeightFactor; + } int curRTWidth = gstate_c.curRTWidth; int curRTHeight = gstate_c.curRTHeight;