Write stencil early when using earlyFragmentTests The writeStencil() operation should happen early when using earlyFragmentTests, so this CL allows this operation to happen right after the early depth test. Tests: dEQP-VK.fragment_operations.early_fragment.discard_early_fragment_tests_stencil Bug: b/200826740 Change-Id: Ibfead3d9731c052b954c9d448de8dea5bb108316 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66151 Reviewed-by: Nicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: Alexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/PixelRoutine.cpp b/src/Pipeline/PixelRoutine.cpp index 7fb54d4..7ca20f5 100644 --- a/src/Pipeline/PixelRoutine.cpp +++ b/src/Pipeline/PixelRoutine.cpp
@@ -129,6 +129,8 @@ depthPass = depthPass || depthTest(zBuffer, q, x, z[q], sMask[q], zMask[q], cMask[q]); depthBoundsTest(zBuffer, q, x, zMask[q], cMask[q]); } + + writeStencil(sBuffer, x, sMask, zMask, cMask, samples); } If(depthPass || !earlyFragmentTests) @@ -318,7 +320,10 @@ } } - writeStencil(sBuffer, x, sMask, zMask, cMask, samples); + if(!earlyFragmentTests) + { + writeStencil(sBuffer, x, sMask, zMask, cMask, samples); + } } }