Make VK_KHR_shader_subgroup_vote tests work with sparse dispatch
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 18 Oct 2018 12:20:31 +0000 (14:20 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 25 Oct 2018 10:15:32 +0000 (06:15 -0400)
commit9429e621c48848d224e35f30a1ae45a4a079922c
tree24f09f2cfe6e757c01ede2372a77f3d9aa1caca5
parenta642cc1ba028fc89a2e8f5c925ad2260866b28bb
Make VK_KHR_shader_subgroup_vote tests work with sparse dispatch

The voteallequal tests created a value which was supposed to be
different for some threads in the subgroup, and then called
voteAllEqual() on it expecting it to return false. However, because the
entire expression was reduced modulo 2, if the implementation dispatched
threads in a sparse manner so that some subgroup indices were skipped,
then all the active threads could have wound up with the same value. In
particular, this caused the graphics voteallequal tests to fail in the
fragment stage on AMD due to how the hardware dispatches single-pixel
point sprites.

Fix this by just using gl_SubgroupIndex directly, so that every thread
is guaranteed to get a unique value. Some care has to be taken for
boolean values -- I've just made them use subgroupElect() instead, as
that's the simplest way to get a guaranteed-divergent boolean value.

Affected tests:
dEQP-VK.subgroups.vote.*

Components: Vulkan
VK-GL-CTS Issue: 1437

Change-Id: I10ddc438db4cd4925bdbc4f458a082fcab9c9155
external/vulkancts/modules/vulkan/subgroups/vktSubgroupsVoteTests.cpp