From 6e2ec8f7a1b836e761f655d428c5b356dc100586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 1 Apr 2016 13:06:42 -0700 Subject: [PATCH] GL: Scissor always enabled. --- src/glimports.h | 1 + src/renderer_gl.cpp | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/glimports.h b/src/glimports.h index f288a6a35..1668dafdc 100644 --- a/src/glimports.h +++ b/src/glimports.h @@ -515,6 +515,7 @@ GL_IMPORT_OES__(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexA GL_IMPORT_OES__(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); GL_IMPORT_OES__(true, PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays); +GL_IMPORT_____x(true, PFNGLCLIPCONTROLPROC, glClipControl); GL_IMPORT_____x(true, PFNGLENABLEIPROC, glEnablei); GL_IMPORT_____x(true, PFNGLDISABLEIPROC, glDisablei); GL_IMPORT_____x(true, PFNGLBLENDEQUATIONIPROC, glBlendEquationi); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 73d730ec8..eb3db4442 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -5473,6 +5473,8 @@ namespace bgfx { namespace gl viewScissorRect.clear(); uint16_t discardFlags = BGFX_CLEAR_NONE; + GL_CHECK(glEnable(GL_SCISSOR_TEST) ); + const bool blendIndependentSupported = s_extension[Extension::ARB_draw_buffers_blend].m_supported; const bool computeSupported = (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) @@ -5595,7 +5597,7 @@ namespace bgfx { namespace gl } const Rect& scissorRect = _render->m_scissor[view]; - viewHasScissor = !scissorRect.isZero(); + viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; GL_CHECK(glViewport(viewState.m_rect.m_x @@ -5822,25 +5824,16 @@ namespace bgfx { namespace gl if (UINT16_MAX == scissor) { - if (viewHasScissor) - { - GL_CHECK(glEnable(GL_SCISSOR_TEST) ); - GL_CHECK(glScissor(viewScissorRect.m_x - , resolutionHeight-viewScissorRect.m_height-viewScissorRect.m_y - , viewScissorRect.m_width - , viewScissorRect.m_height - ) ); - } - else - { - GL_CHECK(glDisable(GL_SCISSOR_TEST) ); - } + GL_CHECK(glScissor(viewScissorRect.m_x + , resolutionHeight-viewScissorRect.m_height-viewScissorRect.m_y + , viewScissorRect.m_width + , viewScissorRect.m_height + ) ); } else { Rect scissorRect; scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]); - GL_CHECK(glEnable(GL_SCISSOR_TEST) ); GL_CHECK(glScissor(scissorRect.m_x , resolutionHeight-scissorRect.m_height-scissorRect.m_y , scissorRect.m_width