softgpu: Enable early Z tests a bit more often.

This helps in cases where sfail doesn't matter.
This commit is contained in:
Unknown W. Brackets 2022-09-11 18:39:39 -07:00
parent 5f2e20d8ca
commit 8a2115be46

View File

@ -93,13 +93,6 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
if (gstate.FrameBufFormat() != GE_FORMAT_565 && gstate.getStencilOpZPass() <= GE_STENCILOP_DECR)
id->zPass = gstate.getStencilOpZPass();
// Always treat zPass/zFail the same if there's no depth test.
if (!gstate.isDepthTestEnabled() || gstate.getDepthTestFunction() == GE_COMP_ALWAYS)
id->zFail = id->zPass;
// And same for sFail if there's no stencil test.
if (id->StencilTestFunc() == GE_COMP_ALWAYS)
id->sFail = id->zPass;
// Normalize REPLACE 00 to ZERO, especially if using a mask.
if (gstate.getStencilTestRef() == 0) {
if (id->SFail() == GE_STENCILOP_REPLACE)
@ -120,6 +113,13 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
id->zPass = GE_STENCILOP_ZERO;
}
// Always treat zPass/zFail the same if there's no depth test.
if (!gstate.isDepthTestEnabled() || gstate.getDepthTestFunction() == GE_COMP_ALWAYS)
id->zFail = id->zPass;
// And same for sFail if there's no stencil test. Prefer KEEP, though.
if (id->StencilTestFunc() == GE_COMP_ALWAYS)
id->sFail = id->ZFail() == GE_STENCILOP_KEEP ? GE_STENCILOP_KEEP : id->zPass;
// Turn off stencil testing if it's doing nothing.
if (id->SFail() == GE_STENCILOP_KEEP && id->ZFail() == GE_STENCILOP_KEEP && id->ZPass() == GE_STENCILOP_KEEP) {
if (id->StencilTestFunc() == GE_COMP_ALWAYS)