From 64132f765a7621fa76407dcb6f9bf4a2d25e7e52 Mon Sep 17 00:00:00 2001 From: rogerman Date: Thu, 22 Aug 2024 19:26:39 -0700 Subject: [PATCH] OpenGL Renderer: Fix a bug where having Edge Mark enabled could cause fragments to disappear. (Regression from commit f910c61.) --- desmume/src/OGLRender.cpp | 4 ++++ desmume/src/OGLRender_3_2.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index 64aec648f..b78d309ec 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -4581,6 +4581,8 @@ Render3DError OpenGLRenderer_1_2::PostprocessFramebuffer() // Pass 3: Blended edge mark glEnable(GL_BLEND); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA); + glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glDisable(GL_STENCIL_TEST); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -4595,6 +4597,8 @@ Render3DError OpenGLRenderer_1_2::PostprocessFramebuffer() glUniform1i(OGLRef.uniformStateClearPolyID, this->_pendingRenderStates.clearPolyID); glUniform1f(OGLRef.uniformStateClearDepth, this->_pendingRenderStates.clearDepth); glEnable(GL_BLEND); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA); + glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glDisable(GL_STENCIL_TEST); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); diff --git a/desmume/src/OGLRender_3_2.cpp b/desmume/src/OGLRender_3_2.cpp index 1ea560794..8fa9bb58a 100644 --- a/desmume/src/OGLRender_3_2.cpp +++ b/desmume/src/OGLRender_3_2.cpp @@ -3425,6 +3425,8 @@ Render3DError OpenGLRenderer_3_2::PostprocessFramebuffer() // Pass 3: Blended edge mark glEnable(GL_BLEND); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA); + glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glDisable(GL_STENCIL_TEST); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -3433,6 +3435,8 @@ Render3DError OpenGLRenderer_3_2::PostprocessFramebuffer() { glUseProgram(pEdgeMarkID); glEnable(GL_BLEND); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA); + glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glDisable(GL_STENCIL_TEST); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);