From dfd14dbc1b913e34781a06f589a451db4f6ffc72 Mon Sep 17 00:00:00 2001 From: binary1248 Date: Fri, 21 Jun 2024 16:56:48 +0200 Subject: [PATCH] Fixed cache state not correctly being ignored when switching between RenderTargets within a single context. --- src/SFML/Graphics/RenderTarget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index dd9dc81eb..9ab235f5d 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -662,7 +662,7 @@ void RenderTarget::applyCurrentView() // Set the scissor rectangle and enable/disable scissor testing if (m_view.getScissor() == FloatRect({0, 0}, {1, 1})) { - if (m_cache.scissorEnabled) + if (!m_cache.enable || m_cache.scissorEnabled) { glCheck(glDisable(GL_SCISSOR_TEST)); m_cache.scissorEnabled = false; @@ -674,7 +674,7 @@ void RenderTarget::applyCurrentView() const int scissorTop = static_cast(getSize().y) - (pixelScissor.position.y + pixelScissor.size.y); glCheck(glScissor(pixelScissor.position.x, scissorTop, pixelScissor.size.x, pixelScissor.size.y)); - if (!m_cache.scissorEnabled) + if (!m_cache.enable || !m_cache.scissorEnabled) { glCheck(glEnable(GL_SCISSOR_TEST)); m_cache.scissorEnabled = true; @@ -754,7 +754,7 @@ void RenderTarget::applyStencilMode(const StencilMode& mode) // Fast path if we have a default (disabled) stencil mode if (mode == StencilMode()) { - if (m_cache.stencilEnabled) + if (!m_cache.enable || m_cache.stencilEnabled) { glCheck(glDisable(GL_STENCIL_TEST)); glCheck(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); @@ -765,7 +765,7 @@ void RenderTarget::applyStencilMode(const StencilMode& mode) else { // Apply the stencil mode - if (!m_cache.stencilEnabled) + if (!m_cache.enable || !m_cache.stencilEnabled) glCheck(glEnable(GL_STENCIL_TEST)); glCheck(glStencilOp(GL_KEEP,