From 5ccd3ee4dcf4048815cc5f43837f4f9c15358f88 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 27 Jul 2018 20:10:26 -0700 Subject: [PATCH] GPU: Allow skipping discard when write disabled. Even if we depth test, if we don't write, we can still force alpha to zero. --- GPU/Common/GPUStateUtils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 0194464d91..9da2049d61 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -115,7 +115,9 @@ bool IsAlphaTestTriviallyTrue() { bool NeedsTestDiscard() { // We assume this is called only when enabled and not trivially true (may also be for color testing.) - if (gstate.isStencilTestEnabled() || gstate.isDepthTestEnabled()) + if (gstate.isStencilTestEnabled() && (gstate.pmska & 0xFF) != 0xFF) + return true; + if (gstate.isDepthTestEnabled() && gstate.isDepthWriteEnabled()) return true; if (!gstate.isAlphaBlendEnabled()) return true;