Merge pull request #3031 from rg3igalia/sub-group-size-arb-flat-fix
[platform/upstream/glslang.git] / Test / glsl.450.subgroupVote.comp
1 #version 450\r
2 \r
3 #extension GL_KHR_shader_subgroup_vote: enable\r
4 \r
5 layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;\r
6 \r
7 layout(binding = 0) buffer Buffers\r
8 {\r
9     vec4  f4;\r
10     ivec4 i4;\r
11     uvec4 u4;\r
12     dvec4 d4;\r
13     int r;\r
14 } data[4];\r
15 \r
16 void main()\r
17 {\r
18     uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4;\r
19 \r
20     if (subgroupAll(data[invocation].r < 0))\r
21     {\r
22         data[invocation].r = int(subgroupAllEqual(data[0].f4.x));\r
23         data[invocation].r = int(subgroupAllEqual(data[1].f4.xy));\r
24         data[invocation].r = int(subgroupAllEqual(data[2].f4.xyz));\r
25         data[invocation].r = int(subgroupAllEqual(data[3].f4));\r
26 \r
27         data[invocation].r = int(subgroupAllEqual(data[0].i4.x));\r
28         data[invocation].r = int(subgroupAllEqual(data[1].i4.xy));\r
29         data[invocation].r = int(subgroupAllEqual(data[2].i4.xyz));\r
30         data[invocation].r = int(subgroupAllEqual(data[3].i4));\r
31 \r
32         data[invocation].r = int(subgroupAllEqual(data[0].u4.x));\r
33         data[invocation].r = int(subgroupAllEqual(data[1].u4.xy));\r
34         data[invocation].r = int(subgroupAllEqual(data[2].u4.xyz));\r
35         data[invocation].r = int(subgroupAllEqual(data[3].u4));\r
36     }\r
37     else if (subgroupAny(data[invocation].r < 0))\r
38     {\r
39         data[invocation].r = int(subgroupAllEqual(data[0].d4.x));\r
40         data[invocation].r = int(subgroupAllEqual(data[1].d4.xy));\r
41         data[invocation].r = int(subgroupAllEqual(data[2].d4.xyz));\r
42         data[invocation].r = int(subgroupAllEqual(data[3].d4));\r
43 \r
44         data[invocation].r = int(int(subgroupAllEqual(data[0].i4.x < 0)));\r
45         data[invocation].r = int(ivec2(subgroupAllEqual(lessThan(data[1].i4.xy, ivec2(0)))));\r
46         data[invocation].r = int(ivec3(subgroupAllEqual(lessThan(data[1].i4.xyz, ivec3(0)))));\r
47         data[invocation].r = int(ivec4(subgroupAllEqual(lessThan(data[1].i4, ivec4(0)))));\r
48     }\r
49 }\r