Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
GLSL: fix transparency issues on dual source blend. fix issue 6104
  • Loading branch information
degasus committed Mar 16, 2013
1 parent 9a404ca commit 4a929f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Source/Core/VideoCommon/Src/BPStructs.cpp
Expand Up @@ -213,7 +213,7 @@ void BPWritten(const BPCmd& bp)
if (bp.changes & 4)
SetDitherMode();
// Set Blending Mode
if (bp.changes & 0xFE1)
if (bp.changes & 0xFF1)
SetBlendMode();
// Set Color Mask
if (bp.changes & 0x18)
Expand Down Expand Up @@ -458,11 +458,11 @@ void BPWritten(const BPCmd& bp)
break;

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
g_renderer->SetBlendMode(true);
OnPixelFormatChange();
if(bp.changes & 3)
if(bp.changes & 7) {
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel
}
break;

case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
Expand Down
8 changes: 4 additions & 4 deletions Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
Expand Up @@ -882,13 +882,13 @@ 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;

// Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel
// Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1.
bool target_has_alpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;

bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha;
bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;

const GLenum glSrcFactors[8] =
{
GL_ZERO,
Expand Down

0 comments on commit 4a929f8

Please sign in to comment.