• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2
3#extension GL_NV_shader_subgroup_partitioned: enable
4#extension GL_EXT_shader_explicit_arithmetic_types_int8: enable
5#extension GL_EXT_shader_explicit_arithmetic_types_int16: enable
6#extension GL_EXT_shader_explicit_arithmetic_types_int64: enable
7#extension GL_EXT_shader_explicit_arithmetic_types_float16: enable
8
9layout (local_size_x = 8) in;
10
11layout(binding = 0) buffer Buffers
12{
13    i8vec4 i8;
14    u8vec4 u8;
15    i16vec4 i16;
16    u16vec4 u16;
17    i64vec4 i64;
18    u64vec4 u64;
19    f16vec4 f16;
20} data[4];
21
22void main()
23{
24    uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4;
25
26    uvec4 ballot;
27    ballot = subgroupPartitionNV(data[0].i8.x);
28    ballot = subgroupPartitionNV(data[1].i8.xy);
29    ballot = subgroupPartitionNV(data[2].i8.xyz);
30    ballot = subgroupPartitionNV(data[3].i8);
31
32    ballot = subgroupPartitionNV(data[0].u8.x);
33    ballot = subgroupPartitionNV(data[1].u8.xy);
34    ballot = subgroupPartitionNV(data[2].u8.xyz);
35    ballot = subgroupPartitionNV(data[3].u8);
36
37    ballot = subgroupPartitionNV(data[0].i16.x);
38    ballot = subgroupPartitionNV(data[1].i16.xy);
39    ballot = subgroupPartitionNV(data[2].i16.xyz);
40    ballot = subgroupPartitionNV(data[3].i16);
41
42    ballot = subgroupPartitionNV(data[0].u16.x);
43    ballot = subgroupPartitionNV(data[1].u16.xy);
44    ballot = subgroupPartitionNV(data[2].u16.xyz);
45    ballot = subgroupPartitionNV(data[3].u16);
46
47    ballot = subgroupPartitionNV(data[0].i64.x);
48    ballot = subgroupPartitionNV(data[1].i64.xy);
49    ballot = subgroupPartitionNV(data[2].i64.xyz);
50    ballot = subgroupPartitionNV(data[3].i64);
51
52    ballot = subgroupPartitionNV(data[0].u64.x);
53    ballot = subgroupPartitionNV(data[1].u64.xy);
54    ballot = subgroupPartitionNV(data[2].u64.xyz);
55    ballot = subgroupPartitionNV(data[3].u64);
56
57    ballot = subgroupPartitionNV(data[0].f16.x);
58    ballot = subgroupPartitionNV(data[1].f16.xy);
59    ballot = subgroupPartitionNV(data[2].f16.xyz);
60    ballot = subgroupPartitionNV(data[3].f16);
61
62    data[invocation].i8.x   = subgroupPartitionedAddNV(data[0].i8.x, ballot);
63    data[invocation].i8.xy  = subgroupPartitionedAddNV(data[1].i8.xy, ballot);
64    data[invocation].i8.xyz = subgroupPartitionedAddNV(data[2].i8.xyz, ballot);
65    data[invocation].i8     = subgroupPartitionedAddNV(data[3].i8, ballot);
66
67    data[invocation].i8.x   = subgroupPartitionedMulNV(data[0].i8.x, ballot);
68    data[invocation].i8.xy  = subgroupPartitionedMulNV(data[1].i8.xy, ballot);
69    data[invocation].i8.xyz = subgroupPartitionedMulNV(data[2].i8.xyz, ballot);
70    data[invocation].i8     = subgroupPartitionedMulNV(data[3].i8, ballot);
71
72    data[invocation].i8.x   = subgroupPartitionedMinNV(data[0].i8.x, ballot);
73    data[invocation].i8.xy  = subgroupPartitionedMinNV(data[1].i8.xy, ballot);
74    data[invocation].i8.xyz = subgroupPartitionedMinNV(data[2].i8.xyz, ballot);
75    data[invocation].i8     = subgroupPartitionedMinNV(data[3].i8, ballot);
76
77    data[invocation].i8.x   = subgroupPartitionedMaxNV(data[0].i8.x, ballot);
78    data[invocation].i8.xy  = subgroupPartitionedMaxNV(data[1].i8.xy, ballot);
79    data[invocation].i8.xyz = subgroupPartitionedMaxNV(data[2].i8.xyz, ballot);
80    data[invocation].i8     = subgroupPartitionedMaxNV(data[3].i8, ballot);
81
82    data[invocation].i8.x   = subgroupPartitionedAndNV(data[0].i8.x, ballot);
83    data[invocation].i8.xy  = subgroupPartitionedAndNV(data[1].i8.xy, ballot);
84    data[invocation].i8.xyz = subgroupPartitionedAndNV(data[2].i8.xyz, ballot);
85    data[invocation].i8     = subgroupPartitionedAndNV(data[3].i8, ballot);
86
87    data[invocation].i8.x   = subgroupPartitionedOrNV(data[0].i8.x, ballot);
88    data[invocation].i8.xy  = subgroupPartitionedOrNV(data[1].i8.xy, ballot);
89    data[invocation].i8.xyz = subgroupPartitionedOrNV(data[2].i8.xyz, ballot);
90    data[invocation].i8     = subgroupPartitionedOrNV(data[3].i8, ballot);
91
92    data[invocation].i8.x   = subgroupPartitionedXorNV(data[0].i8.x, ballot);
93    data[invocation].i8.xy  = subgroupPartitionedXorNV(data[1].i8.xy, ballot);
94    data[invocation].i8.xyz = subgroupPartitionedXorNV(data[2].i8.xyz, ballot);
95    data[invocation].i8     = subgroupPartitionedXorNV(data[3].i8, ballot);
96
97    data[invocation].u8.x   = subgroupPartitionedAddNV(data[0].u8.x, ballot);
98    data[invocation].u8.xy  = subgroupPartitionedAddNV(data[1].u8.xy, ballot);
99    data[invocation].u8.xyz = subgroupPartitionedAddNV(data[2].u8.xyz, ballot);
100    data[invocation].u8     = subgroupPartitionedAddNV(data[3].u8, ballot);
101
102    data[invocation].u8.x   = subgroupPartitionedMulNV(data[0].u8.x, ballot);
103    data[invocation].u8.xy  = subgroupPartitionedMulNV(data[1].u8.xy, ballot);
104    data[invocation].u8.xyz = subgroupPartitionedMulNV(data[2].u8.xyz, ballot);
105    data[invocation].u8     = subgroupPartitionedMulNV(data[3].u8, ballot);
106
107    data[invocation].u8.x   = subgroupPartitionedMinNV(data[0].u8.x, ballot);
108    data[invocation].u8.xy  = subgroupPartitionedMinNV(data[1].u8.xy, ballot);
109    data[invocation].u8.xyz = subgroupPartitionedMinNV(data[2].u8.xyz, ballot);
110    data[invocation].u8     = subgroupPartitionedMinNV(data[3].u8, ballot);
111
112    data[invocation].u8.x   = subgroupPartitionedMaxNV(data[0].u8.x, ballot);
113    data[invocation].u8.xy  = subgroupPartitionedMaxNV(data[1].u8.xy, ballot);
114    data[invocation].u8.xyz = subgroupPartitionedMaxNV(data[2].u8.xyz, ballot);
115    data[invocation].u8     = subgroupPartitionedMaxNV(data[3].u8, ballot);
116
117    data[invocation].u8.x   = subgroupPartitionedAndNV(data[0].u8.x, ballot);
118    data[invocation].u8.xy  = subgroupPartitionedAndNV(data[1].u8.xy, ballot);
119    data[invocation].u8.xyz = subgroupPartitionedAndNV(data[2].u8.xyz, ballot);
120    data[invocation].u8     = subgroupPartitionedAndNV(data[3].u8, ballot);
121
122    data[invocation].u8.x   = subgroupPartitionedOrNV(data[0].u8.x, ballot);
123    data[invocation].u8.xy  = subgroupPartitionedOrNV(data[1].u8.xy, ballot);
124    data[invocation].u8.xyz = subgroupPartitionedOrNV(data[2].u8.xyz, ballot);
125    data[invocation].u8     = subgroupPartitionedOrNV(data[3].u8, ballot);
126
127    data[invocation].u8.x   = subgroupPartitionedXorNV(data[0].u8.x, ballot);
128    data[invocation].u8.xy  = subgroupPartitionedXorNV(data[1].u8.xy, ballot);
129    data[invocation].u8.xyz = subgroupPartitionedXorNV(data[2].u8.xyz, ballot);
130    data[invocation].u8     = subgroupPartitionedXorNV(data[3].u8, ballot);
131
132    data[invocation].i16.x   = subgroupPartitionedAddNV(data[0].i16.x, ballot);
133    data[invocation].i16.xy  = subgroupPartitionedAddNV(data[1].i16.xy, ballot);
134    data[invocation].i16.xyz = subgroupPartitionedAddNV(data[2].i16.xyz, ballot);
135    data[invocation].i16     = subgroupPartitionedAddNV(data[3].i16, ballot);
136
137    data[invocation].i16.x   = subgroupPartitionedMulNV(data[0].i16.x, ballot);
138    data[invocation].i16.xy  = subgroupPartitionedMulNV(data[1].i16.xy, ballot);
139    data[invocation].i16.xyz = subgroupPartitionedMulNV(data[2].i16.xyz, ballot);
140    data[invocation].i16     = subgroupPartitionedMulNV(data[3].i16, ballot);
141
142    data[invocation].i16.x   = subgroupPartitionedMinNV(data[0].i16.x, ballot);
143    data[invocation].i16.xy  = subgroupPartitionedMinNV(data[1].i16.xy, ballot);
144    data[invocation].i16.xyz = subgroupPartitionedMinNV(data[2].i16.xyz, ballot);
145    data[invocation].i16     = subgroupPartitionedMinNV(data[3].i16, ballot);
146
147    data[invocation].i16.x   = subgroupPartitionedMaxNV(data[0].i16.x, ballot);
148    data[invocation].i16.xy  = subgroupPartitionedMaxNV(data[1].i16.xy, ballot);
149    data[invocation].i16.xyz = subgroupPartitionedMaxNV(data[2].i16.xyz, ballot);
150    data[invocation].i16     = subgroupPartitionedMaxNV(data[3].i16, ballot);
151
152    data[invocation].i16.x   = subgroupPartitionedAndNV(data[0].i16.x, ballot);
153    data[invocation].i16.xy  = subgroupPartitionedAndNV(data[1].i16.xy, ballot);
154    data[invocation].i16.xyz = subgroupPartitionedAndNV(data[2].i16.xyz, ballot);
155    data[invocation].i16     = subgroupPartitionedAndNV(data[3].i16, ballot);
156
157    data[invocation].i16.x   = subgroupPartitionedOrNV(data[0].i16.x, ballot);
158    data[invocation].i16.xy  = subgroupPartitionedOrNV(data[1].i16.xy, ballot);
159    data[invocation].i16.xyz = subgroupPartitionedOrNV(data[2].i16.xyz, ballot);
160    data[invocation].i16     = subgroupPartitionedOrNV(data[3].i16, ballot);
161
162    data[invocation].i16.x   = subgroupPartitionedXorNV(data[0].i16.x, ballot);
163    data[invocation].i16.xy  = subgroupPartitionedXorNV(data[1].i16.xy, ballot);
164    data[invocation].i16.xyz = subgroupPartitionedXorNV(data[2].i16.xyz, ballot);
165    data[invocation].i16     = subgroupPartitionedXorNV(data[3].i16, ballot);
166
167    data[invocation].u16.x   = subgroupPartitionedAddNV(data[0].u16.x, ballot);
168    data[invocation].u16.xy  = subgroupPartitionedAddNV(data[1].u16.xy, ballot);
169    data[invocation].u16.xyz = subgroupPartitionedAddNV(data[2].u16.xyz, ballot);
170    data[invocation].u16     = subgroupPartitionedAddNV(data[3].u16, ballot);
171
172    data[invocation].u16.x   = subgroupPartitionedMulNV(data[0].u16.x, ballot);
173    data[invocation].u16.xy  = subgroupPartitionedMulNV(data[1].u16.xy, ballot);
174    data[invocation].u16.xyz = subgroupPartitionedMulNV(data[2].u16.xyz, ballot);
175    data[invocation].u16     = subgroupPartitionedMulNV(data[3].u16, ballot);
176
177    data[invocation].u16.x   = subgroupPartitionedMinNV(data[0].u16.x, ballot);
178    data[invocation].u16.xy  = subgroupPartitionedMinNV(data[1].u16.xy, ballot);
179    data[invocation].u16.xyz = subgroupPartitionedMinNV(data[2].u16.xyz, ballot);
180    data[invocation].u16     = subgroupPartitionedMinNV(data[3].u16, ballot);
181
182    data[invocation].u16.x   = subgroupPartitionedMaxNV(data[0].u16.x, ballot);
183    data[invocation].u16.xy  = subgroupPartitionedMaxNV(data[1].u16.xy, ballot);
184    data[invocation].u16.xyz = subgroupPartitionedMaxNV(data[2].u16.xyz, ballot);
185    data[invocation].u16     = subgroupPartitionedMaxNV(data[3].u16, ballot);
186
187    data[invocation].u16.x   = subgroupPartitionedAndNV(data[0].u16.x, ballot);
188    data[invocation].u16.xy  = subgroupPartitionedAndNV(data[1].u16.xy, ballot);
189    data[invocation].u16.xyz = subgroupPartitionedAndNV(data[2].u16.xyz, ballot);
190    data[invocation].u16     = subgroupPartitionedAndNV(data[3].u16, ballot);
191
192    data[invocation].u16.x   = subgroupPartitionedOrNV(data[0].u16.x, ballot);
193    data[invocation].u16.xy  = subgroupPartitionedOrNV(data[1].u16.xy, ballot);
194    data[invocation].u16.xyz = subgroupPartitionedOrNV(data[2].u16.xyz, ballot);
195    data[invocation].u16     = subgroupPartitionedOrNV(data[3].u16, ballot);
196
197    data[invocation].u16.x   = subgroupPartitionedXorNV(data[0].u16.x, ballot);
198    data[invocation].u16.xy  = subgroupPartitionedXorNV(data[1].u16.xy, ballot);
199    data[invocation].u16.xyz = subgroupPartitionedXorNV(data[2].u16.xyz, ballot);
200    data[invocation].u16     = subgroupPartitionedXorNV(data[3].u16, ballot);
201
202    data[invocation].i64.x   = subgroupPartitionedAddNV(data[0].i64.x, ballot);
203    data[invocation].i64.xy  = subgroupPartitionedAddNV(data[1].i64.xy, ballot);
204    data[invocation].i64.xyz = subgroupPartitionedAddNV(data[2].i64.xyz, ballot);
205    data[invocation].i64     = subgroupPartitionedAddNV(data[3].i64, ballot);
206
207    data[invocation].i64.x   = subgroupPartitionedMulNV(data[0].i64.x, ballot);
208    data[invocation].i64.xy  = subgroupPartitionedMulNV(data[1].i64.xy, ballot);
209    data[invocation].i64.xyz = subgroupPartitionedMulNV(data[2].i64.xyz, ballot);
210    data[invocation].i64     = subgroupPartitionedMulNV(data[3].i64, ballot);
211
212    data[invocation].i64.x   = subgroupPartitionedMinNV(data[0].i64.x, ballot);
213    data[invocation].i64.xy  = subgroupPartitionedMinNV(data[1].i64.xy, ballot);
214    data[invocation].i64.xyz = subgroupPartitionedMinNV(data[2].i64.xyz, ballot);
215    data[invocation].i64     = subgroupPartitionedMinNV(data[3].i64, ballot);
216
217    data[invocation].i64.x   = subgroupPartitionedMaxNV(data[0].i64.x, ballot);
218    data[invocation].i64.xy  = subgroupPartitionedMaxNV(data[1].i64.xy, ballot);
219    data[invocation].i64.xyz = subgroupPartitionedMaxNV(data[2].i64.xyz, ballot);
220    data[invocation].i64     = subgroupPartitionedMaxNV(data[3].i64, ballot);
221
222    data[invocation].i64.x   = subgroupPartitionedAndNV(data[0].i64.x, ballot);
223    data[invocation].i64.xy  = subgroupPartitionedAndNV(data[1].i64.xy, ballot);
224    data[invocation].i64.xyz = subgroupPartitionedAndNV(data[2].i64.xyz, ballot);
225    data[invocation].i64     = subgroupPartitionedAndNV(data[3].i64, ballot);
226
227    data[invocation].i64.x   = subgroupPartitionedOrNV(data[0].i64.x, ballot);
228    data[invocation].i64.xy  = subgroupPartitionedOrNV(data[1].i64.xy, ballot);
229    data[invocation].i64.xyz = subgroupPartitionedOrNV(data[2].i64.xyz, ballot);
230    data[invocation].i64     = subgroupPartitionedOrNV(data[3].i64, ballot);
231
232    data[invocation].i64.x   = subgroupPartitionedXorNV(data[0].i64.x, ballot);
233    data[invocation].i64.xy  = subgroupPartitionedXorNV(data[1].i64.xy, ballot);
234    data[invocation].i64.xyz = subgroupPartitionedXorNV(data[2].i64.xyz, ballot);
235    data[invocation].i64     = subgroupPartitionedXorNV(data[3].i64, ballot);
236
237    data[invocation].u64.x   = subgroupPartitionedAddNV(data[0].u64.x, ballot);
238    data[invocation].u64.xy  = subgroupPartitionedAddNV(data[1].u64.xy, ballot);
239    data[invocation].u64.xyz = subgroupPartitionedAddNV(data[2].u64.xyz, ballot);
240    data[invocation].u64     = subgroupPartitionedAddNV(data[3].u64, ballot);
241
242    data[invocation].u64.x   = subgroupPartitionedMulNV(data[0].u64.x, ballot);
243    data[invocation].u64.xy  = subgroupPartitionedMulNV(data[1].u64.xy, ballot);
244    data[invocation].u64.xyz = subgroupPartitionedMulNV(data[2].u64.xyz, ballot);
245    data[invocation].u64     = subgroupPartitionedMulNV(data[3].u64, ballot);
246
247    data[invocation].u64.x   = subgroupPartitionedMinNV(data[0].u64.x, ballot);
248    data[invocation].u64.xy  = subgroupPartitionedMinNV(data[1].u64.xy, ballot);
249    data[invocation].u64.xyz = subgroupPartitionedMinNV(data[2].u64.xyz, ballot);
250    data[invocation].u64     = subgroupPartitionedMinNV(data[3].u64, ballot);
251
252    data[invocation].u64.x   = subgroupPartitionedMaxNV(data[0].u64.x, ballot);
253    data[invocation].u64.xy  = subgroupPartitionedMaxNV(data[1].u64.xy, ballot);
254    data[invocation].u64.xyz = subgroupPartitionedMaxNV(data[2].u64.xyz, ballot);
255    data[invocation].u64     = subgroupPartitionedMaxNV(data[3].u64, ballot);
256
257    data[invocation].u64.x   = subgroupPartitionedAndNV(data[0].u64.x, ballot);
258    data[invocation].u64.xy  = subgroupPartitionedAndNV(data[1].u64.xy, ballot);
259    data[invocation].u64.xyz = subgroupPartitionedAndNV(data[2].u64.xyz, ballot);
260    data[invocation].u64     = subgroupPartitionedAndNV(data[3].u64, ballot);
261
262    data[invocation].u64.x   = subgroupPartitionedOrNV(data[0].u64.x, ballot);
263    data[invocation].u64.xy  = subgroupPartitionedOrNV(data[1].u64.xy, ballot);
264    data[invocation].u64.xyz = subgroupPartitionedOrNV(data[2].u64.xyz, ballot);
265    data[invocation].u64     = subgroupPartitionedOrNV(data[3].u64, ballot);
266
267    data[invocation].u64.x   = subgroupPartitionedXorNV(data[0].u64.x, ballot);
268    data[invocation].u64.xy  = subgroupPartitionedXorNV(data[1].u64.xy, ballot);
269    data[invocation].u64.xyz = subgroupPartitionedXorNV(data[2].u64.xyz, ballot);
270    data[invocation].u64     = subgroupPartitionedXorNV(data[3].u64, ballot);
271
272    data[invocation].f16.x   = subgroupPartitionedAddNV(data[0].f16.x, ballot);
273    data[invocation].f16.xy  = subgroupPartitionedAddNV(data[1].f16.xy, ballot);
274    data[invocation].f16.xyz = subgroupPartitionedAddNV(data[2].f16.xyz, ballot);
275    data[invocation].f16     = subgroupPartitionedAddNV(data[3].f16, ballot);
276
277    data[invocation].f16.x   = subgroupPartitionedMulNV(data[0].f16.x, ballot);
278    data[invocation].f16.xy  = subgroupPartitionedMulNV(data[1].f16.xy, ballot);
279    data[invocation].f16.xyz = subgroupPartitionedMulNV(data[2].f16.xyz, ballot);
280    data[invocation].f16     = subgroupPartitionedMulNV(data[3].f16, ballot);
281
282    data[invocation].f16.x   = subgroupPartitionedMinNV(data[0].f16.x, ballot);
283    data[invocation].f16.xy  = subgroupPartitionedMinNV(data[1].f16.xy, ballot);
284    data[invocation].f16.xyz = subgroupPartitionedMinNV(data[2].f16.xyz, ballot);
285    data[invocation].f16     = subgroupPartitionedMinNV(data[3].f16, ballot);
286
287    data[invocation].f16.x   = subgroupPartitionedMaxNV(data[0].f16.x, ballot);
288    data[invocation].f16.xy  = subgroupPartitionedMaxNV(data[1].f16.xy, ballot);
289    data[invocation].f16.xyz = subgroupPartitionedMaxNV(data[2].f16.xyz, ballot);
290    data[invocation].f16     = subgroupPartitionedMaxNV(data[3].f16, ballot);
291}
292