From 0fe4e70aefa60e305777d12e1d09ab4751fef901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 8 Feb 2018 16:47:04 +0100 Subject: [PATCH] Fix another way the scissor test could accidentally get disabled --- ext/native/thin3d/GLQueueRunner.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ext/native/thin3d/GLQueueRunner.cpp b/ext/native/thin3d/GLQueueRunner.cpp index 3f5389cd6b..c8faa9958b 100644 --- a/ext/native/thin3d/GLQueueRunner.cpp +++ b/ext/native/thin3d/GLQueueRunner.cpp @@ -588,11 +588,12 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) { #endif break; case GLRRenderCommand::CLEAR: - if (c.clear.scissorW > 0) { - glEnable(GL_SCISSOR_TEST); - glScissor(c.clear.scissorX, c.clear.scissorY, c.clear.scissorW, c.clear.scissorH); - } else { + // Scissor test is on, and should be on after leaving this case. If we disable it, + // we re-enable it at the end. + if (c.clear.scissorW == 0) { glDisable(GL_SCISSOR_TEST); + } else { + glScissor(c.clear.scissorX, c.clear.scissorY, c.clear.scissorW, c.clear.scissorH); } if (c.clear.colorMask != colorMask) { glColorMask(c.clear.colorMask & 1, (c.clear.colorMask >> 1) & 1, (c.clear.colorMask >> 2) & 1, (c.clear.colorMask >> 3) & 1); @@ -614,9 +615,7 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) { glClearStencil(c.clear.clearStencil); } glClear(c.clear.clearMask); - if (c.clear.scissorW > 0) { - glDisable(GL_SCISSOR_TEST); - } else { + if (c.clear.scissorW == 0) { glEnable(GL_SCISSOR_TEST); } break;