mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
GPU: Avoid enabling depth test pointlessly.
See #16015. Attempting to avoid a driver bug.
This commit is contained in:
parent
855d16ffb3
commit
745d9ad320
@ -136,6 +136,15 @@ bool IsColorTestTriviallyTrue() {
|
||||
}
|
||||
}
|
||||
|
||||
bool IsDepthTestEffectivelyDisabled() {
|
||||
if (!gstate.isDepthTestEnabled())
|
||||
return true;
|
||||
// We can ignore stencil, because ALWAYS and disabled choose the same stencil path.
|
||||
if (gstate.getDepthTestFunction() != GE_COMP_ALWAYS)
|
||||
return false;
|
||||
return !gstate.isDepthWriteEnabled();
|
||||
}
|
||||
|
||||
const bool nonAlphaSrcFactors[16] = {
|
||||
true, // GE_SRCBLEND_DSTCOLOR,
|
||||
true, // GE_SRCBLEND_INVDSTCOLOR,
|
||||
|
@ -56,6 +56,7 @@ bool IsColorTestAgainstZero();
|
||||
bool IsColorTestTriviallyTrue();
|
||||
bool IsAlphaTestAgainstZero();
|
||||
bool NeedsTestDiscard();
|
||||
bool IsDepthTestEffectivelyDisabled();
|
||||
bool IsStencilTestOutputDisabled();
|
||||
|
||||
StencilValueType ReplaceAlphaWithStencilType();
|
||||
|
@ -270,7 +270,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
} else {
|
||||
keys_.depthStencil.value = 0;
|
||||
// Depth Test
|
||||
if (gstate.isDepthTestEnabled()) {
|
||||
if (!IsDepthTestEffectivelyDisabled()) {
|
||||
keys_.depthStencil.depthTestEnable = true;
|
||||
keys_.depthStencil.depthCompareOp = compareOps[gstate.getDepthTestFunction()];
|
||||
keys_.depthStencil.depthWriteEnable = gstate.isDepthWriteEnabled();
|
||||
|
@ -228,7 +228,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
|
||||
}
|
||||
} else {
|
||||
// Depth Test
|
||||
if (gstate.isDepthTestEnabled()) {
|
||||
if (!IsDepthTestEffectivelyDisabled()) {
|
||||
dxstate.depthTest.enable();
|
||||
dxstate.depthFunc.set(ztests[gstate.getDepthTestFunction()]);
|
||||
dxstate.depthWrite.set(gstate.isDepthWriteEnabled());
|
||||
|
@ -253,8 +253,9 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
renderManager->SetDepth(true, gstate.isClearModeDepthMask() ? true : false, GL_ALWAYS);
|
||||
} else {
|
||||
// Depth Test
|
||||
renderManager->SetDepth(gstate.isDepthTestEnabled(), gstate.isDepthWriteEnabled(), compareOps[gstate.getDepthTestFunction()]);
|
||||
if (gstate.isDepthTestEnabled())
|
||||
bool depthTestUsed = !IsDepthTestEffectivelyDisabled();
|
||||
renderManager->SetDepth(depthTestUsed, gstate.isDepthWriteEnabled(), compareOps[gstate.getDepthTestFunction()]);
|
||||
if (depthTestUsed)
|
||||
UpdateEverUsedEqualDepth(gstate.getDepthTestFunction());
|
||||
|
||||
// Stencil Test
|
||||
|
@ -274,7 +274,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
||||
}
|
||||
} else {
|
||||
// Depth Test
|
||||
if (gstate.isDepthTestEnabled()) {
|
||||
if (!IsDepthTestEffectivelyDisabled()) {
|
||||
key.depthTestEnable = true;
|
||||
key.depthCompareOp = compareOps[gstate.getDepthTestFunction()];
|
||||
key.depthWriteEnable = gstate.isDepthWriteEnabled();
|
||||
|
Loading…
Reference in New Issue
Block a user