• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3#extension GL_KHR_shader_subgroup_vote: enable
4
5layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
6
7layout(binding = 0) buffer Buffers
8{
9    vec4  f4;
10    ivec4 i4;
11    uvec4 u4;
12    int r;
13} data[4];
14
15void main()
16{
17    uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4u;
18
19    if (subgroupAll(data[0].r < 0))
20    {
21        data[0].r = int(subgroupAllEqual(data[0].f4.x));
22        data[0].r = int(subgroupAllEqual(data[1].f4.xy));
23        data[0].r = int(subgroupAllEqual(data[2].f4.xyz));
24        data[0].r = int(subgroupAllEqual(data[3].f4));
25
26        data[0].r = int(subgroupAllEqual(data[0].i4.x));
27        data[0].r = int(subgroupAllEqual(data[1].i4.xy));
28        data[0].r = int(subgroupAllEqual(data[2].i4.xyz));
29        data[0].r = int(subgroupAllEqual(data[3].i4));
30
31        data[0].r = int(subgroupAllEqual(data[0].u4.x));
32        data[0].r = int(subgroupAllEqual(data[1].u4.xy));
33        data[0].r = int(subgroupAllEqual(data[2].u4.xyz));
34        data[0].r = int(subgroupAllEqual(data[3].u4));
35    }
36    else if (subgroupAny(data[1].r < 0))
37    {
38        data[1].r = int(int(subgroupAllEqual(data[0].i4.x < 0)));
39        data[1].r = int(ivec2(subgroupAllEqual(lessThan(data[1].i4.xy, ivec2(0)))));
40        data[1].r = int(ivec3(subgroupAllEqual(lessThan(data[1].i4.xyz, ivec3(0)))));
41        data[1].r = int(ivec4(subgroupAllEqual(lessThan(data[1].i4, ivec4(0)))));
42    }
43}
44