diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 73708c930a..b702d15250 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -633,6 +633,10 @@ rotateVBO: swTransform.SetProjMatrix(gstate.projMatrix, gstate_c.vpWidth < 0, gstate_c.vpHeight < 0, trans, scale); swTransform.Decode(prim, dec_->VertexType(), dec_->GetDecVtxFmt(), maxIndex, &result); + // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. + // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. + if (result.action == SW_NOT_READY && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) + result.action = SW_DRAW_PRIMITIVES; if (result.action == SW_NOT_READY) { swTransform.DetectOffsetTexture(maxIndex); } @@ -647,10 +651,6 @@ rotateVBO: swTransform.BuildDrawingParams(prim, indexGen.VertexCount(), dec_->VertexType(), inds, maxIndex, &result); if (result.setSafeSize) framebufferManager_->SetSafeSize(result.safeWidth, result.safeHeight); - // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. - // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. - if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) - result.action = SW_DRAW_PRIMITIVES; ApplyDrawStateLate(result.setStencil, result.stencilValue); diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index f16d48c6a8..8a9de7ef79 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -602,6 +602,10 @@ rotateVBO: swTransform.SetProjMatrix(gstate.projMatrix, gstate_c.vpWidth < 0, gstate_c.vpHeight > 0, trans, scale); swTransform.Decode(prim, dec_->VertexType(), dec_->GetDecVtxFmt(), maxIndex, &result); + // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. + // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. + if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) + result.action = SW_NOT_READY; if (result.action == SW_NOT_READY) { swTransform.DetectOffsetTexture(maxIndex); } @@ -615,10 +619,6 @@ rotateVBO: swTransform.BuildDrawingParams(prim, indexGen.VertexCount(), dec_->VertexType(), inds, maxIndex, &result); if (result.setSafeSize) framebufferManager_->SetSafeSize(result.safeWidth, result.safeHeight); - // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. - // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. - if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) - result.action = SW_DRAW_PRIMITIVES; ApplyDrawStateLate(); diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 14eb57afc7..8b842f1dd2 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -395,6 +395,10 @@ void DrawEngineGLES::DoFlush() { swTransform.SetProjMatrix(gstate.projMatrix, gstate_c.vpWidth < 0, invertedY, trans, scale); swTransform.Decode(prim, dec_->VertexType(), dec_->GetDecVtxFmt(), maxIndex, &result); + // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. + // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. + if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) + result.action = SW_NOT_READY; if (result.action == SW_NOT_READY) swTransform.DetectOffsetTexture(maxIndex); @@ -408,10 +412,6 @@ void DrawEngineGLES::DoFlush() { swTransform.BuildDrawingParams(prim, vertexCount, dec_->VertexType(), inds, maxIndex, &result); if (result.setSafeSize) framebufferManager_->SetSafeSize(result.safeWidth, result.safeHeight); - // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. - // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. - if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) - result.action = SW_DRAW_PRIMITIVES; ApplyDrawStateLate(result.setStencil, result.stencilValue); diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index bc51195144..3a683f3238 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -896,6 +896,10 @@ void DrawEngineVulkan::DoFlush() { swTransform.SetProjMatrix(gstate.projMatrix, gstate_c.vpWidth < 0, gstate_c.vpHeight < 0, trans, scale); swTransform.Decode(prim, dec_->VertexType(), dec_->GetDecVtxFmt(), maxIndex, &result); + // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. + // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. + if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) + result.action = SW_NOT_READY; if (result.action == SW_NOT_READY) { swTransform.DetectOffsetTexture(maxIndex); swTransform.BuildDrawingParams(prim, indexGen.VertexCount(), dec_->VertexType(), inds, maxIndex, &result); @@ -903,10 +907,6 @@ void DrawEngineVulkan::DoFlush() { if (result.setSafeSize) framebufferManager_->SetSafeSize(result.safeWidth, result.safeHeight); - // Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values. - // Games sometimes expect exact matches (see #12626, for example) for equal comparisons. - if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f) - result.action = SW_DRAW_PRIMITIVES; // Only here, where we know whether to clear or to draw primitives, should we actually set the current framebuffer! Because that gives use the opportunity // to use a "pre-clear" render pass, for high efficiency on tilers.