From 5f5220b608ae09de0e59d9bdc889bb961978cdfb Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 2 Jan 2014 20:17:58 +0800 Subject: [PATCH 1/2] Revert acf4562 --- GPU/GLES/StateMapping.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 24618200f5..78f752fdee 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -407,22 +407,18 @@ void TransformDrawEngine::ApplyDrawState(int prim) { bool rmask = (gstate.pmskc & 0xFF) < 128; bool gmask = ((gstate.pmskc >> 8) & 0xFF) < 128; bool bmask = ((gstate.pmskc >> 16) & 0xFF) < 128; + bool amask = (gstate.pmska & 0xFF) < 128; - bool amask; - ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil(); - - switch (stencilToAlpha) { - case REPLACE_ALPHA_DUALSOURCE: - case REPLACE_ALPHA_NO: - amask = (gstate.pmska & 0xFF) < 128; - break; - - case REPLACE_ALPHA_YES: - amask = true; - break; - - } - glstate.colorMask.set(rmask, gmask, bmask, amask); + // Let's not write to alpha if stencil isn't enabled. + if (!gstate.isStencilTestEnabled()) { + amask = false; + } else { + // If the stencil type is set to KEEP, we shouldn't write to the stencil/alpha channel. + if (ReplaceAlphaWithStencilType() == STENCIL_VALUE_KEEP) { + amask = false; + } + } + glstate.colorMask.set(rmask, gmask, bmask, amask); // Stencil Test if (gstate.isStencilTestEnabled() && enableStencilTest) { From 164a6846b0f2d1b32111c0eb9d7fc95ab3947d99 Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 2 Jan 2014 20:24:57 +0800 Subject: [PATCH 2/2] Indentation fix --- GPU/GLES/StateMapping.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 78f752fdee..f1c9269381 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -409,16 +409,17 @@ void TransformDrawEngine::ApplyDrawState(int prim) { bool bmask = ((gstate.pmskc >> 16) & 0xFF) < 128; bool amask = (gstate.pmska & 0xFF) < 128; - // Let's not write to alpha if stencil isn't enabled. - if (!gstate.isStencilTestEnabled()) { - amask = false; - } else { - // If the stencil type is set to KEEP, we shouldn't write to the stencil/alpha channel. - if (ReplaceAlphaWithStencilType() == STENCIL_VALUE_KEEP) { - amask = false; - } - } - glstate.colorMask.set(rmask, gmask, bmask, amask); + // Let's not write to alpha if stencil isn't enabled. + if (!gstate.isStencilTestEnabled()) { + amask = false; + } else { + // If the stencil type is set to KEEP, we shouldn't write to the stencil/alpha channel. + if (ReplaceAlphaWithStencilType() == STENCIL_VALUE_KEEP) { + amask = false; + } + } + + glstate.colorMask.set(rmask, gmask, bmask, amask); // Stencil Test if (gstate.isStencilTestEnabled() && enableStencilTest) {