Allow false positive hits from build-in AABBs intersector
authorSÅ‚awomir Cygan <slawomir.cygan@intel.com>
Tue, 16 Mar 2021 16:07:16 +0000 (17:07 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 18 Mar 2021 17:20:20 +0000 (17:20 +0000)
This change allows the test to execute any hit shader,
in case of AABB geometry is used and the ray falsely 'intersects'
it.

This is needed, as the test does not calculate the proper
intersection in 'intersection' stage - it uses a shader that always
reports TRUE. Hence the test relies on build-in AABB
intersector, which may report false positives according to the
specification.

VK-GL-CTS Issue: 2848

Components: Vulkan

Affects: dEQP-VK.ray_tracing_pipeline.build.*aabbs*

Change-Id: Ib90f45227a7cd4c412fd4d1c97598f32a80eb6ca

external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp

index 26613b7df2eae10103204384a52dfa2bf380bcb6..0c58cfadb236cf20275c1a8182ba348b66b8f65c 100644 (file)
@@ -523,11 +523,30 @@ deUint32 RayTracingBuildTestInstance::validateBuffer (de::MovePtr<BufferWithMemo
        for (deUint32 y = 0; y < m_data.height; ++y)
        for (deUint32 x = 0; x < m_data.width; ++x)
        {
+               const deUint32  anyHitValue             = 1;
+               const deUint32  missValue               = 2;
+
                const deUint32  n                               = m_data.width * y + x;
-               const deUint32  expectedValue   = (n % 7 == 0) ? 2 : 1;
+               const deUint32  expectedValue   = (n % 7 == 0) ? missValue : anyHitValue;
 
                if (bufferPtr[pos] != expectedValue)
-                       failures++;
+               {
+                       if (m_data.testType == TEST_TYPE_AABBS)
+                       {
+                               // In the case of AABB geometries, implementations may increase their size in
+                               // an acceleration structure in order to mitigate precision issues. This may
+                               // result in false positives being reported to the application."
+
+                               if (bufferPtr[pos] != anyHitValue)
+                               {
+                                       failures++;
+                               }
+                       }
+                       else
+                       {
+                               failures++;
+                       }
+               }
 
                ++pos;
        }