Fix RobustnessVertexAccessInstance bounds check
authorLiam Middlebrook <lmiddlebrook@nvidia.com>
Tue, 11 Sep 2018 05:42:26 +0000 (22:42 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 13 Sep 2018 19:23:20 +0000 (15:23 -0400)
The bounds check preformed by
VertexAccessInstance::isValueWithinVertexBufferOrZero() needs to round
the value rather than truncating it when encoding it. When
`value * 0x3FFu` is casted to a deUint32 it's possible for the result to
be truncated instead of rounded causing unintended test failures.

Affects: dEQP-VK.robustness.vertex_access.a2b10g10r10_unorm_pack32.draw.vertex_incomplete

Components: Vulkan

VK-GL-CTS issue: 1351

Change-Id: Ib034b3e29fdbbbd4670e2bbdedad07492abf5cd4
(cherry picked from commit fed61233a802b5a8e7f6e634d0ef698e9155a94c)

external/vulkancts/modules/vulkan/robustness/vktRobustnessVertexAccessTests.cpp

index 8a445dc..cc64ba1 100644 (file)
@@ -899,9 +899,9 @@ bool VertexAccessInstance::isValueWithinVertexBufferOrZero(void* vertexBuffer, V
                deUint32                encodedValue;
 
                if (isAlpha)
-                       encodedValue = deMin32(deUint32(normValue * 0x3u), 0x3u);
+                       encodedValue = deMin32(deUint32(deFloatRound(normValue * 0x3u)), 0x3u);
                else
-                       encodedValue = deMin32(deUint32(normValue * 0x3FFu), 0x3FFu);
+                       encodedValue = deMin32(deUint32(deFloatRound(normValue * 0x3FFu)), 0x3FFu);
 
                if (encodedValue == 0)
                        return true;