diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index 754a094cdb..8eed926819 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -139,6 +139,6 @@ extern CGprofile g_cgvProf, g_cgfProf; // XXX: Dual-source blending in OpenGL does not work correctly yet. To make it // work, we may need to use glBindFragDataLocation. To use that, we need to // use GLSL shaders across the whole pipeline. Yikes! -const bool USE_DUAL_SOURCE_BLEND = false; +//#define USE_DUAL_SOURCE_BLEND #endif // _GLINIT_H_ diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 44c84aaf8f..3f51031597 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1034,9 +1034,11 @@ void Renderer::SetBlendMode(bool forceUpdate) u32 changes = forceUpdate ? 0xFFFFFFFF : newval ^ s_blendMode; +#ifdef USE_DUAL_SOURCE_BLEND bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; - bool useDualSource = USE_DUAL_SOURCE_BLEND && useDstAlpha && GLEW_ARB_blend_func_extended; + bool useDualSource = useDstAlpha && GLEW_ARB_blend_func_extended; +#endif if (changes & 1) // blend enable change @@ -1044,14 +1046,19 @@ void Renderer::SetBlendMode(bool forceUpdate) if (changes & 4) { +#ifdef USE_DUAL_SOURCE_BLEND // subtract enable change GLenum equation = newval & 4 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD; GLenum equationAlpha = useDualSource ? GL_FUNC_ADD : equation; glBlendEquationSeparate(equation, equationAlpha); +#else + glBlendEquation(newval & 4 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD); +#endif } if (changes & 0x1F8) { +#ifdef USE_DUAL_SOURCE_BLEND GLenum srcFactor = glSrcFactors[(newval >> 3) & 7]; GLenum srcFactorAlpha = srcFactor; GLenum dstFactor = glDestFactors[(newval >> 6) & 7]; @@ -1074,6 +1081,9 @@ void Renderer::SetBlendMode(bool forceUpdate) // blend RGB change glBlendFuncSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha); +#else + glBlendFunc(glSrcFactors[(newval >> 3) & 7], glDestFactors[(newval >> 6) & 7]); +#endif } s_blendMode = newval; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 58e677d563..af274520ba 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -186,7 +186,9 @@ void VertexManager::vFlush() bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; - bool dualSourcePossible = USE_DUAL_SOURCE_BLEND && GLEW_ARB_blend_func_extended; + +#ifdef USE_DUAL_SOURCE_BLEND + bool dualSourcePossible = GLEW_ARB_blend_func_extended; // finally bind FRAGMENTSHADER* ps; @@ -209,6 +211,10 @@ void VertexManager::vFlush() { ps = PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components); } +#else + bool dualSourcePossible = false; + FRAGMENTSHADER* ps = PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components); +#endif VERTEXSHADER* vs = VertexShaderCache::SetShader(g_nativeVertexFmt->m_components); if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here. if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);