Generate 'false' sometimes for random bool data
authorGraeme Leese <gleese@broadcom.com>
Fri, 13 Sep 2019 15:33:15 +0000 (16:33 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 1 Oct 2019 10:43:37 +0000 (06:43 -0400)
The subgroup tests were generating random bools as a random 32-bit
value. This means that almost every value was a variant of 'true',
reducing the coverage of the tests significantly.

Components: Vulkan
VK-GL-CTS issue: 1998
Affects: dEQP-VK.subgroups.*_bool*
         dEQP-VK.subgroups.*_bvec*

Change-Id: Ibe37fa63d3bd3348255bcdbe263d103eef855cb2

external/vulkancts/modules/vulkan/subgroups/vktSubgroupsTestsUtils.cpp

index dd84558..c66f99c 100644 (file)
@@ -1748,6 +1748,16 @@ void initializeMemory(Context& context, const Allocation& alloc, subgroups::SSBO
                        case VK_FORMAT_R8G8_USCALED:
                        case VK_FORMAT_R8G8B8_USCALED:
                        case VK_FORMAT_R8G8B8A8_USCALED:
+                       {
+                               deUint32* ptr = reinterpret_cast<deUint32*>(alloc.getHostPtr());
+
+                               for (vk::VkDeviceSize k = 0; k < (size / sizeof(deUint32)); k++)
+                               {
+                                       deUint32 r = rnd.getUint32();
+                                       ptr[k] = (r & 1) ? r : 0;
+                               }
+                       }
+                       break;
                        case VK_FORMAT_R32_SINT:
                        case VK_FORMAT_R32G32_SINT:
                        case VK_FORMAT_R32G32B32_SINT: