• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3#extension GL_KHR_shader_subgroup_shuffle: 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} data[4];
13
14void main()
15{
16    uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4u;
17
18    data[0].f4.x   = subgroupShuffle(data[0].f4.x,    invocation);
19    data[0].f4.xy  = subgroupShuffle(data[1].f4.xy,   invocation);
20    data[0].f4.xyz = subgroupShuffle(data[2].f4.xyz,  invocation);
21    data[0].f4     = subgroupShuffle(data[3].f4,      invocation);
22
23    data[0].i4.x   = subgroupShuffle(data[0].i4.x,    invocation);
24    data[0].i4.xy  = subgroupShuffle(data[1].i4.xy,   invocation);
25    data[0].i4.xyz = subgroupShuffle(data[2].i4.xyz,  invocation);
26    data[0].i4     = subgroupShuffle(data[3].i4,      invocation);
27
28    data[1].u4.x   = subgroupShuffle(data[0].u4.x,    invocation);
29    data[1].u4.xy  = subgroupShuffle(data[1].u4.xy,   invocation);
30    data[1].u4.xyz = subgroupShuffle(data[2].u4.xyz,  invocation);
31    data[1].u4     = subgroupShuffle(data[3].u4,      invocation);
32
33    data[1].i4.x   =   int(subgroupShuffle(data[0].i4.x < 0,                   invocation));
34    data[1].i4.xy  = ivec2(subgroupShuffle(lessThan(data[1].i4.xy, ivec2(0)),  invocation));
35    data[1].i4.xyz = ivec3(subgroupShuffle(lessThan(data[1].i4.xyz, ivec3(0)), invocation));
36    data[1].i4     = ivec4(subgroupShuffle(lessThan(data[1].i4, ivec4(0)),     invocation));
37
38    data[2].f4.x   = subgroupShuffleXor(data[0].f4.x,    invocation);
39    data[2].f4.xy  = subgroupShuffleXor(data[1].f4.xy,   invocation);
40    data[2].f4.xyz = subgroupShuffleXor(data[2].f4.xyz,  invocation);
41    data[2].f4     = subgroupShuffleXor(data[3].f4,      invocation);
42
43    data[2].i4.x   = subgroupShuffleXor(data[0].i4.x,    invocation);
44    data[2].i4.xy  = subgroupShuffleXor(data[1].i4.xy,   invocation);
45    data[2].i4.xyz = subgroupShuffleXor(data[2].i4.xyz,  invocation);
46    data[2].i4     = subgroupShuffleXor(data[3].i4,      invocation);
47
48    data[3].u4.x   = subgroupShuffleXor(data[0].u4.x,    invocation);
49    data[3].u4.xy  = subgroupShuffleXor(data[1].u4.xy,   invocation);
50    data[3].u4.xyz = subgroupShuffleXor(data[2].u4.xyz,  invocation);
51    data[3].u4     = subgroupShuffleXor(data[3].u4,      invocation);
52
53    data[3].i4.x   =   int(subgroupShuffleXor(data[0].i4.x < 0,                   invocation));
54    data[3].i4.xy  = ivec2(subgroupShuffleXor(lessThan(data[1].i4.xy, ivec2(0)),  invocation));
55    data[3].i4.xyz = ivec3(subgroupShuffleXor(lessThan(data[1].i4.xyz, ivec3(0)), invocation));
56    data[3].i4     = ivec4(subgroupShuffleXor(lessThan(data[1].i4, ivec4(0)),     invocation));
57}
58