diff options
| author | Stenzek <stenzek@users.noreply.github.com> | 2017-03-02 21:30:10 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-02 21:30:10 +1000 |
| commit | 3390e6f258af85089cdc30a7957444975eb66ed6 (patch) | |
| tree | e91e832414e883e24c3598d2c10345333261a363 /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | 7982ba120ffb2ca04006d040af33080ad5300404 (diff) | |
| parent | db1d826ac39d94943a63e570970f10de01037603 (diff) | |
Merge pull request #4993 from ligfx/fixsonicadventure2
OGL SetBlendMode: always set blend equation and func
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index a92c4810f4..8ccabe5732 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1238,19 +1238,23 @@ void Renderer::SetBlendMode(bool forceUpdate) if (state.blendenable) { - GLenum equation = state.subtract ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD; - GLenum equationAlpha = state.subtractAlpha ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD; - glEnable(GL_BLEND); - glBlendEquationSeparate(equation, equationAlpha); - glBlendFuncSeparate(src_factors[state.srcfactor], dst_factors[state.dstfactor], - src_factors[state.srcfactoralpha], dst_factors[state.dstfactoralpha]); } else { glDisable(GL_BLEND); } + // Always call glBlendEquationSeparate and glBlendFuncSeparate, even when + // GL_BLEND is disabled, as a workaround for some bugs (possibly graphics + // driver issues?). See https://bugs.dolphin-emu.org/issues/10120 : "Sonic + // Adventure 2 Battle: graphics crash when loading first Dark level" + GLenum equation = state.subtract ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD; + GLenum equationAlpha = state.subtractAlpha ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD; + glBlendEquationSeparate(equation, equationAlpha); + glBlendFuncSeparate(src_factors[state.srcfactor], dst_factors[state.dstfactor], + src_factors[state.srcfactoralpha], dst_factors[state.dstfactoralpha]); + const GLenum logic_op_codes[16] = { GL_CLEAR, GL_AND, GL_AND_REVERSE, GL_COPY, GL_AND_INVERTED, GL_NOOP, GL_XOR, GL_OR, GL_NOR, GL_EQUIV, GL_INVERT, GL_OR_REVERSE, |
