Skip to content

Commit

Permalink
OpenGL Renderer: Fix a bug where having Edge Mark enabled could cause…
Browse files Browse the repository at this point in the history
… fragments to disappear. (Regression from commit f910c61.)
  • Loading branch information
rogerman committed Aug 23, 2024
1 parent 00b8df1 commit 64132f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions desmume/src/OGLRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions desmume/src/OGLRender_3_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 64132f7

Please sign in to comment.