Set amask based on ReplaceAlphaWithStencil()

This commit is contained in:
raven02 committed 2013-12-25 19:42:08 +08:00
1 parent ca0fd61998
commit e5059d2c96
1 file changed
+14 -9
+14 -9
View File
@@ -407,18 +407,23 @@ 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;
// Let's not write to alpha if stencil isn't enabled.
if (!gstate.isStencilTestEnabled()) {
bool amask;
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil();
switch (stencilToAlpha) {
case REPLACE_ALPHA_DUALSOURCE:
amask = (gstate.pmska & 0xFF) < 128;
break;
case REPLACE_ALPHA_YES:
amask = true;
break;
case REPLACE_ALPHA_NO:
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;
}
break;
}
glstate.colorMask.set(rmask, gmask, bmask, amask);
// Stencil Test