• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3#extension GL_KHR_shader_subgroup_clustered: enable
4
5layout (local_size_x = 8) 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   = subgroupClusteredAdd(data[0].f4.x, 1u);
19    data[0].f4.xy  = subgroupClusteredAdd(data[1].f4.xy, 1u);
20    data[0].f4.xyz = subgroupClusteredAdd(data[2].f4.xyz, 1u);
21    data[0].f4     = subgroupClusteredAdd(data[3].f4, 1u);
22
23    data[1].i4.x   = subgroupClusteredAdd(data[0].i4.x, 1u);
24    data[1].i4.xy  = subgroupClusteredAdd(data[1].i4.xy, 1u);
25    data[1].i4.xyz = subgroupClusteredAdd(data[2].i4.xyz, 1u);
26    data[1].i4     = subgroupClusteredAdd(data[3].i4, 1u);
27
28    data[2].u4.x   = subgroupClusteredAdd(data[0].u4.x, 1u);
29    data[2].u4.xy  = subgroupClusteredAdd(data[1].u4.xy, 1u);
30    data[2].u4.xyz = subgroupClusteredAdd(data[2].u4.xyz, 1u);
31    data[2].u4     = subgroupClusteredAdd(data[3].u4, 1u);
32
33    data[3].f4.x   = subgroupClusteredMul(data[0].f4.x, 1u);
34    data[3].f4.xy  = subgroupClusteredMul(data[1].f4.xy, 1u);
35    data[3].f4.xyz = subgroupClusteredMul(data[2].f4.xyz, 1u);
36    data[3].f4     = subgroupClusteredMul(data[3].f4, 1u);
37
38    data[0].i4.x   = subgroupClusteredMul(data[0].i4.x, 1u);
39    data[0].i4.xy  = subgroupClusteredMul(data[1].i4.xy, 1u);
40    data[0].i4.xyz = subgroupClusteredMul(data[2].i4.xyz, 1u);
41    data[0].i4     = subgroupClusteredMul(data[3].i4, 1u);
42
43    data[1].u4.x   = subgroupClusteredMul(data[0].u4.x, 1u);
44    data[1].u4.xy  = subgroupClusteredMul(data[1].u4.xy, 1u);
45    data[1].u4.xyz = subgroupClusteredMul(data[2].u4.xyz, 1u);
46    data[1].u4     = subgroupClusteredMul(data[3].u4, 1u);
47
48    data[2].f4.x   = subgroupClusteredMin(data[0].f4.x, 1u);
49    data[2].f4.xy  = subgroupClusteredMin(data[1].f4.xy, 1u);
50    data[2].f4.xyz = subgroupClusteredMin(data[2].f4.xyz, 1u);
51    data[2].f4     = subgroupClusteredMin(data[3].f4, 1u);
52
53    data[3].i4.x   = subgroupClusteredMin(data[0].i4.x, 1u);
54    data[3].i4.xy  = subgroupClusteredMin(data[1].i4.xy, 1u);
55    data[3].i4.xyz = subgroupClusteredMin(data[2].i4.xyz, 1u);
56    data[3].i4     = subgroupClusteredMin(data[3].i4, 1u);
57
58    data[0].u4.x   = subgroupClusteredMin(data[0].u4.x, 1u);
59    data[0].u4.xy  = subgroupClusteredMin(data[1].u4.xy, 1u);
60    data[0].u4.xyz = subgroupClusteredMin(data[2].u4.xyz, 1u);
61    data[0].u4     = subgroupClusteredMin(data[3].u4, 1u);
62
63    data[1].f4.x   = subgroupClusteredMax(data[0].f4.x, 1u);
64    data[1].f4.xy  = subgroupClusteredMax(data[1].f4.xy, 1u);
65    data[1].f4.xyz = subgroupClusteredMax(data[2].f4.xyz, 1u);
66    data[1].f4     = subgroupClusteredMax(data[3].f4, 1u);
67
68    data[2].i4.x   = subgroupClusteredMax(data[0].i4.x, 1u);
69    data[2].i4.xy  = subgroupClusteredMax(data[1].i4.xy, 1u);
70    data[2].i4.xyz = subgroupClusteredMax(data[2].i4.xyz, 1u);
71    data[2].i4     = subgroupClusteredMax(data[3].i4, 1u);
72
73    data[3].u4.x   = subgroupClusteredMax(data[0].u4.x, 1u);
74    data[3].u4.xy  = subgroupClusteredMax(data[1].u4.xy, 1u);
75    data[3].u4.xyz = subgroupClusteredMax(data[2].u4.xyz, 1u);
76    data[3].u4     = subgroupClusteredMax(data[3].u4, 1u);
77
78    data[0].i4.x   = subgroupClusteredAnd(data[0].i4.x, 1u);
79    data[0].i4.xy  = subgroupClusteredAnd(data[1].i4.xy, 1u);
80    data[0].i4.xyz = subgroupClusteredAnd(data[2].i4.xyz, 1u);
81    data[0].i4     = subgroupClusteredAnd(data[3].i4, 1u);
82
83    data[1].u4.x   = subgroupClusteredAnd(data[0].u4.x, 1u);
84    data[1].u4.xy  = subgroupClusteredAnd(data[1].u4.xy, 1u);
85    data[1].u4.xyz = subgroupClusteredAnd(data[2].u4.xyz, 1u);
86    data[1].u4     = subgroupClusteredAnd(data[3].u4, 1u);
87
88    data[2].i4.x   =   int(subgroupClusteredAnd(data[0].i4.x < 0, 1u));
89    data[2].i4.xy  = ivec2(subgroupClusteredAnd(lessThan(data[1].i4.xy, ivec2(0)), 1u));
90    data[2].i4.xyz = ivec3(subgroupClusteredAnd(lessThan(data[1].i4.xyz, ivec3(0)), 1u));
91    data[2].i4     = ivec4(subgroupClusteredAnd(lessThan(data[1].i4, ivec4(0)), 1u));
92
93    data[3].i4.x   = subgroupClusteredOr(data[0].i4.x, 1u);
94    data[3].i4.xy  = subgroupClusteredOr(data[1].i4.xy, 1u);
95    data[3].i4.xyz = subgroupClusteredOr(data[2].i4.xyz, 1u);
96    data[3].i4     = subgroupClusteredOr(data[3].i4, 1u);
97
98    data[0].u4.x   = subgroupClusteredOr(data[0].u4.x, 1u);
99    data[0].u4.xy  = subgroupClusteredOr(data[1].u4.xy, 1u);
100    data[0].u4.xyz = subgroupClusteredOr(data[2].u4.xyz, 1u);
101    data[0].u4     = subgroupClusteredOr(data[3].u4, 1u);
102
103    data[1].i4.x   =   int(subgroupClusteredOr(data[0].i4.x < 0, 1u));
104    data[1].i4.xy  = ivec2(subgroupClusteredOr(lessThan(data[1].i4.xy, ivec2(0)), 1u));
105    data[1].i4.xyz = ivec3(subgroupClusteredOr(lessThan(data[1].i4.xyz, ivec3(0)), 1u));
106    data[1].i4     = ivec4(subgroupClusteredOr(lessThan(data[1].i4, ivec4(0)), 1u));
107
108    data[2].i4.x   = subgroupClusteredXor(data[0].i4.x, 1u);
109    data[2].i4.xy  = subgroupClusteredXor(data[1].i4.xy, 1u);
110    data[2].i4.xyz = subgroupClusteredXor(data[2].i4.xyz, 1u);
111    data[2].i4     = subgroupClusteredXor(data[3].i4, 1u);
112
113    data[3].u4.x   = subgroupClusteredXor(data[0].u4.x, 1u);
114    data[3].u4.xy  = subgroupClusteredXor(data[1].u4.xy, 1u);
115    data[3].u4.xyz = subgroupClusteredXor(data[2].u4.xyz, 1u);
116    data[3].u4     = subgroupClusteredXor(data[3].u4, 1u);
117
118    data[0].i4.x   =   int(subgroupClusteredXor(data[0].i4.x < 0, 1u));
119    data[0].i4.xy  = ivec2(subgroupClusteredXor(lessThan(data[1].i4.xy, ivec2(0)), 1u));
120    data[0].i4.xyz = ivec3(subgroupClusteredXor(lessThan(data[1].i4.xyz, ivec3(0)), 1u));
121    data[0].i4     = ivec4(subgroupClusteredXor(lessThan(data[1].i4, ivec4(0)), 1u));
122}
123