From 34ad5b457dacf175d30b5521f863b45176374dff Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 17 Apr 2017 23:11:58 +1000 Subject: [PATCH] VideoCommon: Add usedualsrc field to BlendingState This is because we re-use BlendingState for our internal drawing (e.g. RasterFont) and for these shaders, we can't assume the presence of a second color output. --- Source/Core/VideoBackends/OGL/Render.cpp | 2 +- Source/Core/VideoCommon/RenderState.cpp | 1 + Source/Core/VideoCommon/RenderState.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b845c0b6ca..4663c2d6ac 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1214,7 +1214,7 @@ void Renderer::SetBlendMode(bool forceUpdate) state.Generate(bpmem); bool useDualSource = - g_ActiveConfig.backend_info.bSupportsDualSourceBlend && + state.usedualsrc && g_ActiveConfig.backend_info.bSupportsDualSourceBlend && (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) || state.dstalpha); const GLenum src_factors[8] = { diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp index 2e84646ce4..04c476e8da 100644 --- a/Source/Core/VideoCommon/RenderState.cpp +++ b/Source/Core/VideoCommon/RenderState.cpp @@ -65,6 +65,7 @@ void BlendingState::Generate(const BPMemory& bp) colorupdate = bp.blendmode.colorupdate && alpha_test_may_success; alphaupdate = bp.blendmode.alphaupdate && target_has_alpha && alpha_test_may_success; dstalpha = bp.dstalpha.enable && alphaupdate; + usedualsrc = true; // The subtract bit has the highest priority if (bp.blendmode.subtract) diff --git a/Source/Core/VideoCommon/RenderState.h b/Source/Core/VideoCommon/RenderState.h index cadd83e1a3..60bc37e6aa 100644 --- a/Source/Core/VideoCommon/RenderState.h +++ b/Source/Core/VideoCommon/RenderState.h @@ -26,6 +26,7 @@ union BlendingState BitField<14, 3, BlendMode::BlendFactor> dstfactoralpha; BitField<17, 3, BlendMode::BlendFactor> srcfactoralpha; BitField<20, 4, BlendMode::LogicOp> logicmode; + BitField<24, 1, u32> usedualsrc; u32 hex; };