From: Iago Toral Quiroga Date: Mon, 22 Nov 2021 07:29:50 +0000 (+0100) Subject: Allow rounding error when reading back Z buffer X-Git-Tag: upstream/1.3.5~428^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a8cfa6dd21ab69339adf7fc8b989dcf8577f50e;p=platform%2Fupstream%2FVK-GL-CTS.git Allow rounding error when reading back Z buffer The early fragment test produces Z values <= 0.5 and uses a shader to write 0.75 that it expects to be ignored due to early fragment tests, which it verifies by reading back the Z buffer and testing that all values are <= 0.5. On our platform, we observe that on storing 0.5 we retrieve 0.500008, which makes us fail the test incorrectly. Fix this by adding a small room for rounding error, like we do for other verification paths in these tests. While we are doing this, lower the tolerance admited for the late fragment test case as well. Components: Vulkan VK-GL-CTS Issue: 3340 Affects: dEQP-VK.fragment_operations.early_fragment.discard_early_fragment_tests_depth dEQP-VK.fragment_operations.early_fragment.discard_no_early_fragment_tests_depth Change-Id: I8e1782b81d0e74a4a5af3e3cac40c9679f543ac6 --- diff --git a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp index f92f1bb..644ff4d 100644 --- a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp +++ b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp @@ -755,10 +755,12 @@ tcu::TestStatus EarlyFragmentDiscardTestInstance::iterate (void) int stencilValue = (m_testMode == MODE_STENCIL) ? dsPixelAccess.getPixStencil(x, y, z) : 0; // Depth test should write to the depth buffer even when there is a discard in the fragment shader, - // when early fragment tests are enabled. + // when early fragment tests are enabled. We allow some tolerance to account for precision error + // on depth writes. if (m_testMode == MODE_DEPTH) { - if (m_useEarlyTests && ((x + y) < 31) && depthValue >= 0.5f) + float tolerance = 0.0001f; + if (m_useEarlyTests && ((x + y) < 31) && depthValue >= 0.50 + tolerance) { std::ostringstream error; error << "Rendered depth value [ "<< x << ", " << y << ", " << z << "] is not correct: " << depthValue << " >= 0.5f"; @@ -766,7 +768,7 @@ tcu::TestStatus EarlyFragmentDiscardTestInstance::iterate (void) } // When early fragment tests are disabled, the depth test happens after the fragment shader, but as we are discarding // all fragments, the stored value in the depth buffer should be the clear one (0.5f). - if (!m_useEarlyTests && deAbs(depthValue - 0.5f) > 0.01f) + if (!m_useEarlyTests && deAbs(depthValue - 0.5f) > tolerance) { std::ostringstream error; error << "Rendered depth value [ "<< x << ", " << y << ", " << z << "] is not correct: " << depthValue << " != 0.5f";