GPU: Improve a 5551 stencil emulation case.

Hammerin' Hero (see #10777) uses ALWAYS with INCR, which can be rewritten
to maintain more correct stencil values.
This commit is contained in:
Unknown W. Brackets 2019-06-23 16:14:18 -07:00
parent 3de796779c
commit 7b8d3e0c36

View file

@ -1246,6 +1246,10 @@ static void ConvertStencilFunc5551(GenericStencilFuncState &state) {
state.testRef = usedRef;
// Nuke the mask as well, since this is always/never, just for consistency.
state.testMask = 0xFF;
} else {
// Not used, so let's make the ref 0xFF which is a useful value later.
state.testRef = 0xFF;
state.testMask = 0xFF;
}
};
@ -1341,6 +1345,10 @@ static void ConvertStencilFunc5551(GenericStencilFuncState &state) {
// Otherwise we get 1, which we mostly handle, but won't INVERT correctly.
rewriteOps(GE_STENCILOP_INCR, GE_STENCILOP_INVERT);
}
if (!usesRef && state.testRef == 0xFF) {
// Safe to use REPLACE instead of INCR.
rewriteOps(GE_STENCILOP_INCR, GE_STENCILOP_REPLACE);
}
}
void ConvertStencilFuncState(GenericStencilFuncState &state) {