Skip to content
Browse files

GPU: Restrict alpha test to zero for dest blend.

We could end up with the wrong blending in other cases, because the
exiting color will get multiplied.

Luckily, this is still the common case.
  • Loading branch information...
unknownbrackets committed Jul 29, 2018
1 parent a776dce commit fba0de59c10a51dd43bfdc838f9c8562d93cb2c0
Showing with 6 additions and 1 deletion.
  1. +6 −1 GPU/Common/GPUStateUtils.cpp
@@ -125,7 +125,12 @@ bool NeedsTestDiscard() {
return true;
if (gstate.getBlendFuncA() != GE_SRCBLEND_SRCALPHA && gstate.getBlendFuncA() != GE_DSTBLEND_DOUBLESRCALPHA)
return true;
if (!safeDestFactors[(int)gstate.getBlendFuncB()])
// GE_DSTBLEND_DOUBLEINVSRCALPHA is actually inverse double src alpha, and doubling zero is still zero.
if (gstate.getBlendFuncB() != GE_DSTBLEND_INVSRCALPHA && gstate.getBlendFuncB() != GE_DSTBLEND_DOUBLEINVSRCALPHA) {
if (gstate.getBlendFuncB() != GE_DSTBLEND_FIXB || gstate.getFixB() != 0xFFFFFF)
return true;
if (gstate.getBlendEq() != GE_BLENDMODE_MUL_AND_ADD && gstate.getBlendEq() != GE_BLENDMODE_MUL_AND_SUBTRACT_REVERSE)
return true;

return false;

0 comments on commit fba0de5

Please sign in to comment.
You can’t perform that action at this time.