blob: c5237977a778b9c52850ec64a46d1ee5fd700a7b [file] [log] [blame]
Alastair Donaldsonf7e73d42021-07-23 13:10:12 +00001 OpCapability Shader
2 %1 = OpExtInstImport "GLSL.std.450"
3 OpMemoryModel Logical GLSL450
4 OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color
5 OpExecutionMode %main OriginUpperLeft
6 OpSource ESSL 320
7 OpName %main "main"
8 OpName %swap_i1_i1_ "swap(i1;i1;"
9 OpName %i "i"
10 OpName %j "j"
11 OpName %performPartition_i1_i1_ "performPartition(i1;i1;"
12 OpName %l "l"
13 OpName %h "h"
14 OpName %quicksort_ "quicksort("
15 OpName %temp "temp"
16 OpName %QuicksortObject "QuicksortObject"
17 OpMemberName %QuicksortObject 0 "numbers"
18 OpName %obj "obj"
19 OpName %pivot "pivot"
20 OpName %i_0 "i"
21 OpName %j_0 "j"
22 OpName %param "param"
23 OpName %param_0 "param"
24 OpName %param_1 "param"
25 OpName %param_2 "param"
26 OpName %l_0 "l"
27 OpName %h_0 "h"
28 OpName %top "top"
29 OpName %stack "stack"
30 OpName %int_a "int_a"
31 OpName %gl_FragCoord "gl_FragCoord"
32 OpName %clamp_a "clamp_a"
33 OpName %p "p"
34 OpName %param_3 "param"
35 OpName %param_4 "param"
36 OpName %i_1 "i"
37 OpName %uv "uv"
38 OpName %buf0 "buf0"
39 OpMemberName %buf0 0 "resolution"
40 OpName %_ ""
41 OpName %color "color"
42 OpName %_GLF_color "_GLF_color"
43 OpDecorate %gl_FragCoord BuiltIn FragCoord
44 OpMemberDecorate %buf0 0 Offset 0
45 OpDecorate %buf0 Block
46 OpDecorate %_ DescriptorSet 0
47 OpDecorate %_ Binding 0
48 OpDecorate %_GLF_color Location 0
49 %void = OpTypeVoid
50 %37 = OpTypeFunction %void
51 %int = OpTypeInt 32 1
52%_ptr_Function_int = OpTypePointer Function %int
53 %40 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int
54 %41 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int
55 %uint = OpTypeInt 32 0
56 %uint_10 = OpConstant %uint 10
57%_arr_int_uint_10 = OpTypeArray %int %uint_10
58%QuicksortObject = OpTypeStruct %_arr_int_uint_10
59%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject
60 %obj = OpVariable %_ptr_Private_QuicksortObject Private
61 %int_0 = OpConstant %int 0
62%_ptr_Private_int = OpTypePointer Private %int
63 %int_1 = OpConstant %int 1
64 %bool = OpTypeBool
65 %int_9 = OpConstant %int 9
66 %int_n1 = OpConstant %int -1
67%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
68 %float = OpTypeFloat 32
69 %v4float = OpTypeVector %float 4
70%_ptr_Input_v4float = OpTypePointer Input %v4float
71%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
72 %uint_1 = OpConstant %uint 1
73%_ptr_Input_float = OpTypePointer Input %float
74 %float_0 = OpConstant %float 0
75 %false = OpConstantFalse %bool
76 %int_10 = OpConstant %int 10
77 %v2float = OpTypeVector %float 2
78%_ptr_Function_v2float = OpTypePointer Function %v2float
79 %buf0 = OpTypeStruct %v2float
80%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
81 %_ = OpVariable %_ptr_Uniform_buf0 Uniform
82%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
83 %v3float = OpTypeVector %float 3
84%_ptr_Function_v3float = OpTypePointer Function %v3float
85 %float_1 = OpConstant %float 1
86 %float_2 = OpConstant %float 2
87 %float_3 = OpConstant %float 3
88 %70 = OpConstantComposite %v3float %float_1 %float_2 %float_3
89 %uint_0 = OpConstant %uint 0
90%_ptr_Function_float = OpTypePointer Function %float
91 %float_0_25 = OpConstant %float 0.25
92 %float_0_5 = OpConstant %float 0.5
93 %int_2 = OpConstant %int 2
94 %float_0_75 = OpConstant %float 0.75
95 %int_3 = OpConstant %int 3
96 %uint_2 = OpConstant %uint 2
97 %int_4 = OpConstant %int 4
98 %int_5 = OpConstant %int 5
99 %int_6 = OpConstant %int 6
100 %int_7 = OpConstant %int 7
101 %int_8 = OpConstant %int 8
102%_ptr_Output_v4float = OpTypePointer Output %v4float
103 %_GLF_color = OpVariable %_ptr_Output_v4float Output
104 %main = OpFunction %void None %37
105 %85 = OpLabel
106 %i_1 = OpVariable %_ptr_Function_int Function
107 %uv = OpVariable %_ptr_Function_v2float Function
108 %color = OpVariable %_ptr_Function_v3float Function
109 OpStore %i_1 %int_0
110 OpBranch %86
111 %86 = OpLabel
112 OpLoopMerge %87 %88 None
113 OpBranch %89
114 %89 = OpLabel
115 %90 = OpLoad %int %i_1
116 %91 = OpSLessThan %bool %90 %int_10
117 OpBranchConditional %91 %92 %87
118 %92 = OpLabel
119 %93 = OpLoad %int %i_1
120 %94 = OpLoad %int %i_1
121 %95 = OpISub %int %int_10 %94
122 %96 = OpAccessChain %_ptr_Private_int %obj %int_0 %93
123 OpStore %96 %95
124 %97 = OpLoad %int %i_1
125 %98 = OpLoad %int %i_1
126 %99 = OpAccessChain %_ptr_Private_int %obj %int_0 %98
127 %100 = OpLoad %int %99
128 %101 = OpLoad %int %i_1
129 %102 = OpAccessChain %_ptr_Private_int %obj %int_0 %101
130 %103 = OpLoad %int %102
131 %104 = OpIMul %int %100 %103
132 %105 = OpAccessChain %_ptr_Private_int %obj %int_0 %97
133 OpStore %105 %104
134 OpBranch %88
135 %88 = OpLabel
136 %106 = OpLoad %int %i_1
137 %107 = OpIAdd %int %106 %int_1
138 OpStore %i_1 %107
139 OpBranch %86
140 %87 = OpLabel
141 %108 = OpFunctionCall %void %quicksort_
142 %109 = OpLoad %v4float %gl_FragCoord
143 %110 = OpVectorShuffle %v2float %109 %109 0 1
144 %111 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0
145 %112 = OpLoad %v2float %111
146 %113 = OpFDiv %v2float %110 %112
147 OpStore %uv %113
148 OpStore %color %70
149 %114 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0
150 %115 = OpLoad %int %114
151 %116 = OpConvertSToF %float %115
152 %117 = OpAccessChain %_ptr_Function_float %color %uint_0
153 %118 = OpLoad %float %117
154 %119 = OpFAdd %float %118 %116
155 %120 = OpAccessChain %_ptr_Function_float %color %uint_0
156 OpStore %120 %119
157 %121 = OpAccessChain %_ptr_Function_float %uv %uint_0
158 %122 = OpLoad %float %121
159 %123 = OpFOrdGreaterThan %bool %122 %float_0_25
160 OpSelectionMerge %124 None
161 OpBranchConditional %123 %125 %124
162 %125 = OpLabel
163 %126 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1
164 %127 = OpLoad %int %126
165 %128 = OpConvertSToF %float %127
166 %129 = OpAccessChain %_ptr_Function_float %color %uint_0
167 %130 = OpLoad %float %129
168 %131 = OpFAdd %float %130 %128
169 %132 = OpAccessChain %_ptr_Function_float %color %uint_0
170 OpStore %132 %131
171 OpBranch %124
172 %124 = OpLabel
173 %133 = OpAccessChain %_ptr_Function_float %uv %uint_0
174 %134 = OpLoad %float %133
175 %135 = OpFOrdGreaterThan %bool %134 %float_0_5
176 OpSelectionMerge %136 None
177 OpBranchConditional %135 %137 %136
178 %137 = OpLabel
179 %138 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2
180 %139 = OpLoad %int %138
181 %140 = OpConvertSToF %float %139
182 %141 = OpAccessChain %_ptr_Function_float %color %uint_1
183 %142 = OpLoad %float %141
184 %143 = OpFAdd %float %142 %140
185 %144 = OpAccessChain %_ptr_Function_float %color %uint_1
186 OpStore %144 %143
187 OpBranch %136
188 %136 = OpLabel
189 %145 = OpAccessChain %_ptr_Function_float %uv %uint_0
190 %146 = OpLoad %float %145
191 %147 = OpFOrdGreaterThan %bool %146 %float_0_75
192 OpSelectionMerge %148 None
193 OpBranchConditional %147 %149 %148
194 %149 = OpLabel
195 %150 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3
196 %151 = OpLoad %int %150
197 %152 = OpConvertSToF %float %151
198 %153 = OpAccessChain %_ptr_Function_float %color %uint_2
199 %154 = OpLoad %float %153
200 %155 = OpFAdd %float %154 %152
201 %156 = OpAccessChain %_ptr_Function_float %color %uint_2
202 OpStore %156 %155
203 OpBranch %148
204 %148 = OpLabel
205 %157 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4
206 %158 = OpLoad %int %157
207 %159 = OpConvertSToF %float %158
208 %160 = OpAccessChain %_ptr_Function_float %color %uint_1
209 %161 = OpLoad %float %160
210 %162 = OpFAdd %float %161 %159
211 %163 = OpAccessChain %_ptr_Function_float %color %uint_1
212 OpStore %163 %162
213 %164 = OpAccessChain %_ptr_Function_float %uv %uint_1
214 %165 = OpLoad %float %164
215 %166 = OpFOrdGreaterThan %bool %165 %float_0_25
216 OpSelectionMerge %167 None
217 OpBranchConditional %166 %168 %167
218 %168 = OpLabel
219 %169 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5
220 %170 = OpLoad %int %169
221 %171 = OpConvertSToF %float %170
222 %172 = OpAccessChain %_ptr_Function_float %color %uint_0
223 %173 = OpLoad %float %172
224 %174 = OpFAdd %float %173 %171
225 %175 = OpAccessChain %_ptr_Function_float %color %uint_0
226 OpStore %175 %174
227 OpBranch %167
228 %167 = OpLabel
229 %176 = OpAccessChain %_ptr_Function_float %uv %uint_1
230 %177 = OpLoad %float %176
231 %178 = OpFOrdGreaterThan %bool %177 %float_0_5
232 OpSelectionMerge %179 None
233 OpBranchConditional %178 %180 %179
234 %180 = OpLabel
235 %181 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6
236 %182 = OpLoad %int %181
237 %183 = OpConvertSToF %float %182
238 %184 = OpAccessChain %_ptr_Function_float %color %uint_1
239 %185 = OpLoad %float %184
240 %186 = OpFAdd %float %185 %183
241 %187 = OpAccessChain %_ptr_Function_float %color %uint_1
242 OpStore %187 %186
243 OpBranch %179
244 %179 = OpLabel
245 %188 = OpAccessChain %_ptr_Function_float %uv %uint_1
246 %189 = OpLoad %float %188
247 %190 = OpFOrdGreaterThan %bool %189 %float_0_75
248 OpSelectionMerge %191 None
249 OpBranchConditional %190 %192 %191
250 %192 = OpLabel
251 %193 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7
252 %194 = OpLoad %int %193
253 %195 = OpConvertSToF %float %194
254 %196 = OpAccessChain %_ptr_Function_float %color %uint_2
255 %197 = OpLoad %float %196
256 %198 = OpFAdd %float %197 %195
257 %199 = OpAccessChain %_ptr_Function_float %color %uint_2
258 OpStore %199 %198
259 OpBranch %191
260 %191 = OpLabel
261 %200 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8
262 %201 = OpLoad %int %200
263 %202 = OpConvertSToF %float %201
264 %203 = OpAccessChain %_ptr_Function_float %color %uint_2
265 %204 = OpLoad %float %203
266 %205 = OpFAdd %float %204 %202
267 %206 = OpAccessChain %_ptr_Function_float %color %uint_2
268 OpStore %206 %205
269 %207 = OpAccessChain %_ptr_Function_float %uv %uint_0
270 %208 = OpLoad %float %207
271 %209 = OpAccessChain %_ptr_Function_float %uv %uint_1
272 %210 = OpLoad %float %209
273 %211 = OpFSub %float %208 %210
274 %212 = OpExtInst %float %1 FAbs %211
275 %213 = OpFOrdLessThan %bool %212 %float_0_25
276 OpSelectionMerge %214 None
277 OpBranchConditional %213 %215 %214
278 %215 = OpLabel
279 %216 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9
280 %217 = OpLoad %int %216
281 %218 = OpConvertSToF %float %217
282 %219 = OpAccessChain %_ptr_Function_float %color %uint_0
283 %220 = OpLoad %float %219
284 %221 = OpFAdd %float %220 %218
285 %222 = OpAccessChain %_ptr_Function_float %color %uint_0
286 OpStore %222 %221
287 OpBranch %214
288 %214 = OpLabel
289 %223 = OpLoad %v3float %color
290 %224 = OpExtInst %v3float %1 Normalize %223
291 %225 = OpCompositeExtract %float %224 0
292 %226 = OpCompositeExtract %float %224 1
293 %227 = OpCompositeExtract %float %224 2
294 %228 = OpCompositeConstruct %v4float %225 %226 %227 %float_1
295 OpStore %_GLF_color %228
296 OpReturn
297 OpFunctionEnd
298%swap_i1_i1_ = OpFunction %void None %40
299 %i = OpFunctionParameter %_ptr_Function_int
300 %j = OpFunctionParameter %_ptr_Function_int
301 %229 = OpLabel
302 %temp = OpVariable %_ptr_Function_int Function
303 %230 = OpLoad %int %i
304 %231 = OpAccessChain %_ptr_Private_int %obj %int_0 %230
305 %232 = OpLoad %int %231
306 OpStore %temp %232
307 %233 = OpLoad %int %i
308 %234 = OpLoad %int %j
309 %235 = OpAccessChain %_ptr_Private_int %obj %int_0 %234
310 %236 = OpLoad %int %235
311 %237 = OpAccessChain %_ptr_Private_int %obj %int_0 %233
312 OpStore %237 %236
313 %238 = OpLoad %int %j
314 %239 = OpLoad %int %temp
315 %240 = OpAccessChain %_ptr_Private_int %obj %int_0 %238
316 OpStore %240 %239
317 OpReturn
318 OpFunctionEnd
319%performPartition_i1_i1_ = OpFunction %int None %41
320 %l = OpFunctionParameter %_ptr_Function_int
321 %h = OpFunctionParameter %_ptr_Function_int
322 %241 = OpLabel
323 %pivot = OpVariable %_ptr_Function_int Function
324 %i_0 = OpVariable %_ptr_Function_int Function
325 %j_0 = OpVariable %_ptr_Function_int Function
326 %param = OpVariable %_ptr_Function_int Function
327 %param_0 = OpVariable %_ptr_Function_int Function
328 %param_1 = OpVariable %_ptr_Function_int Function
329 %param_2 = OpVariable %_ptr_Function_int Function
330 %242 = OpLoad %int %h
331 %243 = OpAccessChain %_ptr_Private_int %obj %int_0 %242
332 %244 = OpLoad %int %243
333 OpStore %pivot %244
334 %245 = OpLoad %int %l
335 %246 = OpISub %int %245 %int_1
336 OpStore %i_0 %246
337 %247 = OpLoad %int %l
338 OpStore %j_0 %247
339 OpBranch %248
340 %248 = OpLabel
341 OpLoopMerge %249 %250 None
342 OpBranch %251
343 %251 = OpLabel
344 %252 = OpLoad %int %j_0
345 %253 = OpLoad %int %h
346 %254 = OpISub %int %253 %int_1
347 %255 = OpSLessThanEqual %bool %252 %254
348 OpBranchConditional %255 %256 %249
349 %256 = OpLabel
350 %257 = OpLoad %int %j_0
351 %258 = OpAccessChain %_ptr_Private_int %obj %int_0 %257
352 %259 = OpLoad %int %258
353 %260 = OpLoad %int %pivot
354 %261 = OpSLessThanEqual %bool %259 %260
355 OpSelectionMerge %262 None
356 OpBranchConditional %261 %263 %262
357 %263 = OpLabel
358 %264 = OpLoad %int %i_0
359 %265 = OpIAdd %int %264 %int_1
360 OpStore %i_0 %265
361 %266 = OpLoad %int %i_0
362 OpStore %param %266
363 %267 = OpLoad %int %j_0
364 OpStore %param_0 %267
365 %268 = OpFunctionCall %void %swap_i1_i1_ %param %param_0
366 OpBranch %262
367 %262 = OpLabel
368 OpBranch %250
369 %250 = OpLabel
370 %269 = OpLoad %int %j_0
371 %270 = OpIAdd %int %269 %int_1
372 OpStore %j_0 %270
373 OpBranch %248
374 %249 = OpLabel
375 %271 = OpLoad %int %i_0
376 %272 = OpIAdd %int %271 %int_1
377 OpStore %i_0 %272
378 %273 = OpLoad %int %i_0
379 OpStore %param_1 %273
380 %274 = OpLoad %int %h
381 OpStore %param_2 %274
382 %275 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2
383 %276 = OpLoad %int %i_0
384 OpReturnValue %276
385 OpFunctionEnd
386 %quicksort_ = OpFunction %void None %37
387 %277 = OpLabel
388 %l_0 = OpVariable %_ptr_Function_int Function
389 %h_0 = OpVariable %_ptr_Function_int Function
390 %top = OpVariable %_ptr_Function_int Function
391 %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function
392 %int_a = OpVariable %_ptr_Function_int Function
393 %278 = OpVariable %_ptr_Function_int Function
394 %279 = OpVariable %_ptr_Function_int Function
395 %clamp_a = OpVariable %_ptr_Function_int Function
396 %p = OpVariable %_ptr_Function_int Function
397 %param_3 = OpVariable %_ptr_Function_int Function
398 %param_4 = OpVariable %_ptr_Function_int Function
399 OpStore %l_0 %int_0
400 OpStore %h_0 %int_9
401 OpStore %top %int_n1
402 %280 = OpLoad %int %top
403 %281 = OpIAdd %int %280 %int_1
404 OpStore %top %281
405 %282 = OpLoad %int %l_0
406 %283 = OpAccessChain %_ptr_Function_int %stack %281
407 OpStore %283 %282
408 %284 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
409 %285 = OpLoad %float %284
410 %286 = OpFOrdGreaterThanEqual %bool %285 %float_0
411 OpSelectionMerge %287 None
412 OpBranchConditional %286 %288 %289
413 %288 = OpLabel
414 %290 = OpLoad %int %h_0
415 OpSelectionMerge %291 None
416 OpBranchConditional %false %292 %293
417 %292 = OpLabel
418 OpStore %279 %int_1
419 OpBranch %291
420 %293 = OpLabel
421 %294 = OpLoad %int %h_0
422 %295 = OpShiftLeftLogical %int %294 %int_0
423 OpStore %279 %295
424 OpBranch %291
425 %291 = OpLabel
426 %296 = OpLoad %int %279
427 %297 = OpBitwiseOr %int %290 %296
428 OpStore %278 %297
429 OpBranch %287
430 %289 = OpLabel
431 OpStore %278 %int_1
432 OpBranch %287
433 %287 = OpLabel
434 %298 = OpLoad %int %278
435 OpStore %int_a %298
436 %299 = OpLoad %int %h_0
437 %300 = OpLoad %int %h_0
438 %301 = OpLoad %int %int_a
439 %302 = OpExtInst %int %1 SClamp %299 %300 %301
440 OpStore %clamp_a %302
441 %303 = OpLoad %int %top
442 %304 = OpIAdd %int %303 %int_1
443 OpStore %top %304
444 %305 = OpLoad %int %clamp_a
445 %306 = OpSDiv %int %305 %int_1
446 %307 = OpAccessChain %_ptr_Function_int %stack %304
447 OpStore %307 %306
448 OpBranch %308
449 %308 = OpLabel
450 OpLoopMerge %309 %310 None
451 OpBranch %311
452 %311 = OpLabel
453 %312 = OpLoad %int %top
454 %313 = OpSGreaterThanEqual %bool %312 %int_0
455 OpBranchConditional %313 %314 %309
456 %314 = OpLabel
457 %315 = OpLoad %int %top
458 %316 = OpISub %int %315 %int_1
459 OpStore %top %316
460 %317 = OpAccessChain %_ptr_Function_int %stack %315
461 %318 = OpLoad %int %317
462 OpStore %h_0 %318
463 %319 = OpLoad %int %top
464 %320 = OpISub %int %319 %int_1
465 OpStore %top %320
466 %321 = OpAccessChain %_ptr_Function_int %stack %319
467 %322 = OpLoad %int %321
468 OpStore %l_0 %322
469 %323 = OpLoad %int %l_0
470 OpStore %param_3 %323
471 %324 = OpLoad %int %h_0
472 OpStore %param_4 %324
473 %325 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4
474 OpStore %p %325
475 %326 = OpLoad %int %p
476 %327 = OpISub %int %326 %int_1
477 %328 = OpLoad %int %l_0
478 %329 = OpSGreaterThan %bool %327 %328
479 OpSelectionMerge %330 None
480 OpBranchConditional %329 %331 %330
481 %331 = OpLabel
482 %332 = OpLoad %int %top
483 %333 = OpIAdd %int %332 %int_1
484 OpStore %top %333
485 %334 = OpLoad %int %l_0
486 %335 = OpAccessChain %_ptr_Function_int %stack %333
487 OpStore %335 %334
488 %336 = OpLoad %int %top
489 %337 = OpIAdd %int %336 %int_1
490 OpStore %top %337
491 %338 = OpLoad %int %p
492 %339 = OpISub %int %338 %int_1
493 %340 = OpAccessChain %_ptr_Function_int %stack %337
494 OpStore %340 %339
495 OpBranch %330
496 %330 = OpLabel
497 %341 = OpLoad %int %p
498 %342 = OpIAdd %int %341 %int_1
499 %343 = OpLoad %int %h_0
500 %344 = OpSLessThan %bool %342 %343
501 OpSelectionMerge %345 None
502 OpBranchConditional %344 %346 %345
503 %346 = OpLabel
504 %347 = OpLoad %int %top
505 %348 = OpIAdd %int %347 %int_1
506 OpStore %top %348
507 %349 = OpLoad %int %p
508 %350 = OpIAdd %int %349 %int_1
509 %351 = OpAccessChain %_ptr_Function_int %stack %348
510 OpStore %351 %350
511 %352 = OpLoad %int %top
512 %353 = OpIAdd %int %352 %int_1
513 OpStore %top %353
514 %354 = OpLoad %int %h_0
515 %355 = OpAccessChain %_ptr_Function_int %stack %353
516 OpStore %355 %354
517 OpBranch %345
518 %345 = OpLabel
519 OpBranch %310
520 %310 = OpLabel
521 OpBranch %308
522 %309 = OpLabel
523 OpReturn
524 OpFunctionEnd