summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/Render.cpp
diff options
context:
space:
mode:
authorMichael Maltese <michaeljosephmaltese@gmail.com>2017-02-28 21:29:31 -0800
committerMichael Maltese <michaeljosephmaltese@gmail.com>2017-03-01 00:49:14 -0800
commitdb1d826ac39d94943a63e570970f10de01037603 (patch)
tree7971d536814556f3b28d4160b3d7d2f228d45316 /Source/Core/VideoBackends/OGL/Render.cpp
parent83bd74aef033c0a38aa18b014929bc96bb961080 (diff)
OGL SetBlendMode: always set blend equation and func
Before #4581, an invocation of `SetBlendMode` could invoke `glBlendEquationSeparate` and `glBlendFuncSeparate` even when it was setting `glDisable(GL_BLEND)`. I couldn't figure out how to map the old behavior over to the new BlendingState code, so I changed it to always call the two blend functions. Fixes https://bugs.dolphin-emu.org/issues/10120 : "Sonic Adventure 2 Battle: graphics crash when loading first Dark level".
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp16
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,