From fba0de59c10a51dd43bfdc838f9c8562d93cb2c0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 29 Jul 2018 11:03:55 -0700 Subject: [PATCH] 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. --- GPU/Common/GPUStateUtils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 9da2049d61e4..47605f64b72a 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/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;