summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-01-18 00:44:35 +0100
committerdegasus <wickmarkus@web.de>2013-01-18 00:44:35 +0100
commit714ff50fdfd435947f7a9add24fae5260c5e00e2 (patch)
treec68c92e30bd679cb1a6ad7e93993ded3b85a2933
parenta87fd89fce2c154a546c1a7a6aa325fab4f50493 (diff)
set blending if dual source might be triggered
-rw-r--r--Source/Core/VideoCommon/Src/BPStructs.cpp4
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp14
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp2
3 files changed, 12 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp
index 0bde9cc613..47dab0ec94 100644
--- a/Source/Core/VideoCommon/Src/BPStructs.cpp
+++ b/Source/Core/VideoCommon/Src/BPStructs.cpp
@@ -224,6 +224,8 @@ void BPWritten(const BPCmd& bp)
{
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
+ if(bp.changes & 0x100)
+ SetBlendMode();
break;
}
// This is called when the game is done drawing the new frame (eg: like in DX: Begin(); Draw(); End();)
@@ -457,6 +459,8 @@ void BPWritten(const BPCmd& bp)
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel
OnPixelFormatChange();
+ if(bp.changes & 3)
+ SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
break;
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index ff554d0276..76ac9e3cbb 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -959,13 +959,19 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
void Renderer::SetBlendMode(bool forceUpdate)
{
+ bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
+ && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
+ bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
+
// blend mode bit mask
// 0 - blend enable
+ // 1 - dst alpha enabled
// 2 - reverse subtract enable (else add)
// 3-5 - srcRGB function
// 6-8 - dstRGB function
- u32 newval = bpmem.blendmode.subtract << 2;
+ u32 newval = useDualSource << 1;
+ newval |= bpmem.blendmode.subtract << 2;
if (bpmem.blendmode.subtract)
newval |= 0x0049; // enable blending src 1 dst 1
@@ -978,10 +984,6 @@ void Renderer::SetBlendMode(bool forceUpdate)
u32 changes = forceUpdate ? 0xFFFFFFFF : newval ^ s_blendMode;
- bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
- && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
- bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
-
if (changes & 1)
// blend enable change
(newval & 1) ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
@@ -998,7 +1000,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
glBlendEquation(newval & 4 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD);
}
- if (changes & 0x1F8)
+ if (changes & 0x1FA)
{
if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
{
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp
index 5d3840775a..04889dfadf 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp
@@ -311,12 +311,10 @@ void VertexManager::vFlush()
{
// If host supports GL_ARB_blend_func_extended, we can do dst alpha in
// the same pass as regular rendering.
- g_renderer->SetBlendMode(true);
ps = PixelShaderCache::SetShader(DSTALPHA_DUAL_SOURCE_BLEND, g_nativeVertexFmt->m_components);
}
else
{
- g_renderer->SetBlendMode(true);
ps = PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components);
}
}