1#!amber
2
3# Copyright 2020 Google LLC
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
18# A test for a bug found by the GraphicsFuzz project.
19
20# Short description: Equivalent shaders, one with extra access chains and load
21
22# The test passes because both shaders render the same image.
23
24SHADER vertex reference_vertex_shader PASSTHROUGH
25
26SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
27; SPIR-V
28; Version: 1.0
29; Generator: Khronos Glslang Reference Front End; 7
30; Bound: 1372
31; Schema: 0
32               OpCapability Shader
33          %1 = OpExtInstImport "GLSL.std.450"
34               OpMemoryModel Logical GLSL450
35               OpEntryPoint Fragment %4 "main" %254
36               OpExecutionMode %4 OriginUpperLeft
37               OpSource ESSL 320
38               OpName %4 "main"
39               OpName %7 "BST"
40               OpMemberName %7 0 "data"
41               OpMemberName %7 1 "leftIndex"
42               OpMemberName %7 2 "rightIndex"
43               OpName %47 "tree"
44               OpName %254 "_GLF_color"
45               OpDecorate %254 Location 0
46          %2 = OpTypeVoid
47          %3 = OpTypeFunction %2
48          %6 = OpTypeInt 32 1
49          %7 = OpTypeStruct %6 %6 %6
50          %8 = OpTypePointer Function %7
51          %9 = OpTypePointer Function %6
52         %24 = OpConstant %6 0
53         %27 = OpConstant %6 1
54         %28 = OpConstant %6 -1
55         %30 = OpConstant %6 2
56         %40 = OpTypeBool
57         %43 = OpTypeInt 32 0
58         %44 = OpConstant %43 10
59         %45 = OpTypeArray %7 %44
60        %141 = OpConstant %6 9
61        %151 = OpConstant %6 5
62        %158 = OpConstant %6 12
63        %165 = OpConstant %6 15
64        %172 = OpConstant %6 7
65        %179 = OpConstant %6 8
66        %192 = OpConstant %6 6
67        %199 = OpConstant %6 17
68        %206 = OpConstant %6 13
69        %219 = OpConstant %6 20
70        %251 = OpTypeFloat 32
71        %252 = OpTypeVector %251 4
72        %253 = OpTypePointer Output %252
73        %254 = OpVariable %253 Output
74        %255 = OpConstant %251 1
75        %256 = OpConstant %251 0
76        %257 = OpConstantComposite %252 %255 %256 %256 %255
77        %259 = OpConstantComposite %252 %256 %256 %255 %255
78        %262 = OpConstant %43 0
79        %263 = OpConstantFalse %40
80        %266 = OpConstantTrue %40
81       %1015 = OpTypePointer Function %45
82       %1318 = OpUndef %6
83       %1359 = OpConstantComposite %7 %141 %28 %28
84       %1360 = OpConstantComposite %7 %151 %28 %28
85       %1361 = OpConstantComposite %7 %158 %28 %28
86       %1362 = OpConstant %6 3
87       %1363 = OpConstantComposite %7 %165 %28 %28
88       %1364 = OpConstant %6 4
89       %1365 = OpConstantComposite %7 %172 %28 %28
90       %1366 = OpConstantComposite %7 %179 %28 %28
91       %1367 = OpConstantComposite %7 %30 %28 %28
92       %1368 = OpConstantComposite %7 %192 %28 %28
93       %1369 = OpConstantComposite %7 %199 %28 %28
94       %1370 = OpConstantComposite %7 %206 %28 %28
95          %4 = OpFunction %2 None %3
96          %5 = OpLabel
97         %47 = OpVariable %1015 Function
98        %148 = OpAccessChain %8 %47 %24
99               OpStore %148 %1359
100               OpSelectionMerge %347 None
101               OpSwitch %262 %288
102        %288 = OpLabel
103               OpBranch %289
104        %289 = OpLabel
105       %1212 = OpPhi %6 %24 %288 %1342 %343
106        %293 = OpSLessThanEqual %40 %1212 %27
107               OpLoopMerge %344 %343 None
108               OpBranchConditional %293 %294 %344
109        %294 = OpLabel
110        %297 = OpAccessChain %9 %47 %1212 %24
111        %298 = OpLoad %6 %297
112        %299 = OpSLessThanEqual %40 %151 %298
113               OpSelectionMerge %342 None
114               OpBranchConditional %299 %321 %300
115        %300 = OpLabel
116        %302 = OpAccessChain %9 %47 %1212 %30
117        %303 = OpLoad %6 %302
118        %304 = OpIEqual %40 %303 %28
119               OpSelectionMerge %320 None
120               OpBranchConditional %304 %309 %305
121        %305 = OpLabel
122        %308 = OpLoad %6 %302
123               OpBranch %343
124        %309 = OpLabel
125               OpStore %302 %27
126        %319 = OpAccessChain %8 %47 %27
127               OpStore %319 %1360
128               OpBranch %344
129        %320 = OpLabel
130               OpUnreachable
131        %321 = OpLabel
132        %323 = OpAccessChain %9 %47 %1212 %27
133        %324 = OpLoad %6 %323
134        %325 = OpIEqual %40 %324 %28
135               OpSelectionMerge %341 None
136               OpBranchConditional %325 %330 %326
137        %326 = OpLabel
138        %329 = OpLoad %6 %323
139               OpBranch %343
140        %330 = OpLabel
141               OpStore %323 %27
142        %340 = OpAccessChain %8 %47 %27
143               OpStore %340 %1360
144               OpBranch %344
145        %341 = OpLabel
146               OpUnreachable
147        %342 = OpLabel
148               OpUnreachable
149        %343 = OpLabel
150       %1342 = OpPhi %6 %308 %305 %329 %326
151               OpBranch %289
152        %344 = OpLabel
153       %1213 = OpPhi %40 %263 %289 %266 %309 %266 %330
154               OpSelectionMerge %346 None
155               OpBranchConditional %1213 %347 %346
156        %346 = OpLabel
157               OpBranch %347
158        %347 = OpLabel
159               OpSelectionMerge %424 None
160               OpSwitch %262 %365
161        %365 = OpLabel
162               OpBranch %366
163        %366 = OpLabel
164       %1220 = OpPhi %6 %24 %365 %1344 %420
165        %370 = OpSLessThanEqual %40 %1220 %30
166               OpLoopMerge %421 %420 None
167               OpBranchConditional %370 %371 %421
168        %371 = OpLabel
169        %374 = OpAccessChain %9 %47 %1220 %24
170        %375 = OpLoad %6 %374
171        %376 = OpSLessThanEqual %40 %158 %375
172               OpSelectionMerge %419 None
173               OpBranchConditional %376 %398 %377
174        %377 = OpLabel
175        %379 = OpAccessChain %9 %47 %1220 %30
176        %380 = OpLoad %6 %379
177        %381 = OpIEqual %40 %380 %28
178               OpSelectionMerge %397 None
179               OpBranchConditional %381 %386 %382
180        %382 = OpLabel
181        %385 = OpLoad %6 %379
182               OpBranch %420
183        %386 = OpLabel
184               OpStore %379 %30
185        %396 = OpAccessChain %8 %47 %30
186               OpStore %396 %1361
187               OpBranch %421
188        %397 = OpLabel
189               OpUnreachable
190        %398 = OpLabel
191        %400 = OpAccessChain %9 %47 %1220 %27
192        %401 = OpLoad %6 %400
193        %402 = OpIEqual %40 %401 %28
194               OpSelectionMerge %418 None
195               OpBranchConditional %402 %407 %403
196        %403 = OpLabel
197        %406 = OpLoad %6 %400
198               OpBranch %420
199        %407 = OpLabel
200               OpStore %400 %30
201        %417 = OpAccessChain %8 %47 %30
202               OpStore %417 %1361
203               OpBranch %421
204        %418 = OpLabel
205               OpUnreachable
206        %419 = OpLabel
207               OpUnreachable
208        %420 = OpLabel
209       %1344 = OpPhi %6 %385 %382 %406 %403
210               OpBranch %366
211        %421 = OpLabel
212       %1221 = OpPhi %40 %263 %366 %266 %386 %266 %407
213               OpSelectionMerge %423 None
214               OpBranchConditional %1221 %424 %423
215        %423 = OpLabel
216               OpBranch %424
217        %424 = OpLabel
218               OpSelectionMerge %501 None
219               OpSwitch %262 %442
220        %442 = OpLabel
221               OpBranch %443
222        %443 = OpLabel
223       %1228 = OpPhi %6 %24 %442 %1345 %497
224        %447 = OpSLessThanEqual %40 %1228 %1362
225               OpLoopMerge %498 %497 None
226               OpBranchConditional %447 %448 %498
227        %448 = OpLabel
228        %451 = OpAccessChain %9 %47 %1228 %24
229        %452 = OpLoad %6 %451
230        %453 = OpSLessThanEqual %40 %165 %452
231               OpSelectionMerge %496 None
232               OpBranchConditional %453 %475 %454
233        %454 = OpLabel
234        %456 = OpAccessChain %9 %47 %1228 %30
235        %457 = OpLoad %6 %456
236        %458 = OpIEqual %40 %457 %28
237               OpSelectionMerge %474 None
238               OpBranchConditional %458 %463 %459
239        %459 = OpLabel
240        %462 = OpLoad %6 %456
241               OpBranch %497
242        %463 = OpLabel
243               OpStore %456 %1362
244        %473 = OpAccessChain %8 %47 %1362
245               OpStore %473 %1363
246               OpBranch %498
247        %474 = OpLabel
248               OpUnreachable
249        %475 = OpLabel
250        %477 = OpAccessChain %9 %47 %1228 %27
251        %478 = OpLoad %6 %477
252        %479 = OpIEqual %40 %478 %28
253               OpSelectionMerge %495 None
254               OpBranchConditional %479 %484 %480
255        %480 = OpLabel
256        %483 = OpLoad %6 %477
257               OpBranch %497
258        %484 = OpLabel
259               OpStore %477 %1362
260        %494 = OpAccessChain %8 %47 %1362
261               OpStore %494 %1363
262               OpBranch %498
263        %495 = OpLabel
264               OpUnreachable
265        %496 = OpLabel
266               OpUnreachable
267        %497 = OpLabel
268       %1345 = OpPhi %6 %462 %459 %483 %480
269               OpBranch %443
270        %498 = OpLabel
271       %1229 = OpPhi %40 %263 %443 %266 %463 %266 %484
272               OpSelectionMerge %500 None
273               OpBranchConditional %1229 %501 %500
274        %500 = OpLabel
275               OpBranch %501
276        %501 = OpLabel
277               OpSelectionMerge %578 None
278               OpSwitch %262 %519
279        %519 = OpLabel
280               OpBranch %520
281        %520 = OpLabel
282       %1236 = OpPhi %6 %24 %519 %1346 %574
283        %524 = OpSLessThanEqual %40 %1236 %1364
284               OpLoopMerge %575 %574 None
285               OpBranchConditional %524 %525 %575
286        %525 = OpLabel
287        %528 = OpAccessChain %9 %47 %1236 %24
288        %529 = OpLoad %6 %528
289        %530 = OpSLessThanEqual %40 %172 %529
290               OpSelectionMerge %573 None
291               OpBranchConditional %530 %552 %531
292        %531 = OpLabel
293        %533 = OpAccessChain %9 %47 %1236 %30
294        %534 = OpLoad %6 %533
295        %535 = OpIEqual %40 %534 %28
296               OpSelectionMerge %551 None
297               OpBranchConditional %535 %540 %536
298        %536 = OpLabel
299        %539 = OpLoad %6 %533
300               OpBranch %574
301        %540 = OpLabel
302               OpStore %533 %1364
303        %550 = OpAccessChain %8 %47 %1364
304               OpStore %550 %1365
305               OpBranch %575
306        %551 = OpLabel
307               OpUnreachable
308        %552 = OpLabel
309        %554 = OpAccessChain %9 %47 %1236 %27
310        %555 = OpLoad %6 %554
311        %556 = OpIEqual %40 %555 %28
312               OpSelectionMerge %572 None
313               OpBranchConditional %556 %561 %557
314        %557 = OpLabel
315        %560 = OpLoad %6 %554
316               OpBranch %574
317        %561 = OpLabel
318               OpStore %554 %1364
319        %571 = OpAccessChain %8 %47 %1364
320               OpStore %571 %1365
321               OpBranch %575
322        %572 = OpLabel
323               OpUnreachable
324        %573 = OpLabel
325               OpUnreachable
326        %574 = OpLabel
327       %1346 = OpPhi %6 %539 %536 %560 %557
328               OpBranch %520
329        %575 = OpLabel
330       %1237 = OpPhi %40 %263 %520 %266 %540 %266 %561
331               OpSelectionMerge %577 None
332               OpBranchConditional %1237 %578 %577
333        %577 = OpLabel
334               OpBranch %578
335        %578 = OpLabel
336               OpSelectionMerge %655 None
337               OpSwitch %262 %596
338        %596 = OpLabel
339               OpBranch %597
340        %597 = OpLabel
341       %1244 = OpPhi %6 %24 %596 %1347 %651
342        %601 = OpSLessThanEqual %40 %1244 %151
343               OpLoopMerge %652 %651 None
344               OpBranchConditional %601 %602 %652
345        %602 = OpLabel
346        %605 = OpAccessChain %9 %47 %1244 %24
347        %606 = OpLoad %6 %605
348        %607 = OpSLessThanEqual %40 %179 %606
349               OpSelectionMerge %650 None
350               OpBranchConditional %607 %629 %608
351        %608 = OpLabel
352        %610 = OpAccessChain %9 %47 %1244 %30
353        %611 = OpLoad %6 %610
354        %612 = OpIEqual %40 %611 %28
355               OpSelectionMerge %628 None
356               OpBranchConditional %612 %617 %613
357        %613 = OpLabel
358        %616 = OpLoad %6 %610
359               OpBranch %651
360        %617 = OpLabel
361               OpStore %610 %151
362        %627 = OpAccessChain %8 %47 %151
363               OpStore %627 %1366
364               OpBranch %652
365        %628 = OpLabel
366               OpUnreachable
367        %629 = OpLabel
368        %631 = OpAccessChain %9 %47 %1244 %27
369        %632 = OpLoad %6 %631
370        %633 = OpIEqual %40 %632 %28
371               OpSelectionMerge %649 None
372               OpBranchConditional %633 %638 %634
373        %634 = OpLabel
374        %637 = OpLoad %6 %631
375               OpBranch %651
376        %638 = OpLabel
377               OpStore %631 %151
378        %648 = OpAccessChain %8 %47 %151
379               OpStore %648 %1366
380               OpBranch %652
381        %649 = OpLabel
382               OpUnreachable
383        %650 = OpLabel
384               OpUnreachable
385        %651 = OpLabel
386       %1347 = OpPhi %6 %616 %613 %637 %634
387               OpBranch %597
388        %652 = OpLabel
389       %1245 = OpPhi %40 %263 %597 %266 %617 %266 %638
390               OpSelectionMerge %654 None
391               OpBranchConditional %1245 %655 %654
392        %654 = OpLabel
393               OpBranch %655
394        %655 = OpLabel
395               OpSelectionMerge %732 None
396               OpSwitch %262 %673
397        %673 = OpLabel
398               OpBranch %674
399        %674 = OpLabel
400       %1252 = OpPhi %6 %24 %673 %1348 %728
401        %678 = OpSLessThanEqual %40 %1252 %192
402               OpLoopMerge %729 %728 None
403               OpBranchConditional %678 %679 %729
404        %679 = OpLabel
405        %682 = OpAccessChain %9 %47 %1252 %24
406        %683 = OpLoad %6 %682
407        %684 = OpSLessThanEqual %40 %30 %683
408               OpSelectionMerge %727 None
409               OpBranchConditional %684 %706 %685
410        %685 = OpLabel
411        %687 = OpAccessChain %9 %47 %1252 %30
412        %688 = OpLoad %6 %687
413        %689 = OpIEqual %40 %688 %28
414               OpSelectionMerge %705 None
415               OpBranchConditional %689 %694 %690
416        %690 = OpLabel
417        %693 = OpLoad %6 %687
418               OpBranch %728
419        %694 = OpLabel
420               OpStore %687 %192
421        %704 = OpAccessChain %8 %47 %192
422               OpStore %704 %1367
423               OpBranch %729
424        %705 = OpLabel
425               OpUnreachable
426        %706 = OpLabel
427        %708 = OpAccessChain %9 %47 %1252 %27
428        %709 = OpLoad %6 %708
429        %710 = OpIEqual %40 %709 %28
430               OpSelectionMerge %726 None
431               OpBranchConditional %710 %715 %711
432        %711 = OpLabel
433        %714 = OpLoad %6 %708
434               OpBranch %728
435        %715 = OpLabel
436               OpStore %708 %192
437        %725 = OpAccessChain %8 %47 %192
438               OpStore %725 %1367
439               OpBranch %729
440        %726 = OpLabel
441               OpUnreachable
442        %727 = OpLabel
443               OpUnreachable
444        %728 = OpLabel
445       %1348 = OpPhi %6 %693 %690 %714 %711
446               OpBranch %674
447        %729 = OpLabel
448       %1253 = OpPhi %40 %263 %674 %266 %694 %266 %715
449               OpSelectionMerge %731 None
450               OpBranchConditional %1253 %732 %731
451        %731 = OpLabel
452               OpBranch %732
453        %732 = OpLabel
454               OpSelectionMerge %809 None
455               OpSwitch %262 %750
456        %750 = OpLabel
457               OpBranch %751
458        %751 = OpLabel
459       %1260 = OpPhi %6 %24 %750 %1349 %805
460        %755 = OpSLessThanEqual %40 %1260 %172
461               OpLoopMerge %806 %805 None
462               OpBranchConditional %755 %756 %806
463        %756 = OpLabel
464        %759 = OpAccessChain %9 %47 %1260 %24
465        %760 = OpLoad %6 %759
466        %761 = OpSLessThanEqual %40 %192 %760
467               OpSelectionMerge %804 None
468               OpBranchConditional %761 %783 %762
469        %762 = OpLabel
470        %764 = OpAccessChain %9 %47 %1260 %30
471        %765 = OpLoad %6 %764
472        %766 = OpIEqual %40 %765 %28
473               OpSelectionMerge %782 None
474               OpBranchConditional %766 %771 %767
475        %767 = OpLabel
476        %770 = OpLoad %6 %764
477               OpBranch %805
478        %771 = OpLabel
479               OpStore %764 %172
480        %781 = OpAccessChain %8 %47 %172
481               OpStore %781 %1368
482               OpBranch %806
483        %782 = OpLabel
484               OpUnreachable
485        %783 = OpLabel
486        %785 = OpAccessChain %9 %47 %1260 %27
487        %786 = OpLoad %6 %785
488        %787 = OpIEqual %40 %786 %28
489               OpSelectionMerge %803 None
490               OpBranchConditional %787 %792 %788
491        %788 = OpLabel
492        %791 = OpLoad %6 %785
493               OpBranch %805
494        %792 = OpLabel
495               OpStore %785 %172
496        %802 = OpAccessChain %8 %47 %172
497               OpStore %802 %1368
498               OpBranch %806
499        %803 = OpLabel
500               OpUnreachable
501        %804 = OpLabel
502               OpUnreachable
503        %805 = OpLabel
504       %1349 = OpPhi %6 %770 %767 %791 %788
505               OpBranch %751
506        %806 = OpLabel
507       %1261 = OpPhi %40 %263 %751 %266 %771 %266 %792
508               OpSelectionMerge %808 None
509               OpBranchConditional %1261 %809 %808
510        %808 = OpLabel
511               OpBranch %809
512        %809 = OpLabel
513               OpSelectionMerge %886 None
514               OpSwitch %262 %827
515        %827 = OpLabel
516               OpBranch %828
517        %828 = OpLabel
518       %1268 = OpPhi %6 %24 %827 %1350 %882
519        %832 = OpSLessThanEqual %40 %1268 %179
520               OpLoopMerge %883 %882 None
521               OpBranchConditional %832 %833 %883
522        %833 = OpLabel
523        %836 = OpAccessChain %9 %47 %1268 %24
524        %837 = OpLoad %6 %836
525        %838 = OpSLessThanEqual %40 %199 %837
526               OpSelectionMerge %881 None
527               OpBranchConditional %838 %860 %839
528        %839 = OpLabel
529        %841 = OpAccessChain %9 %47 %1268 %30
530        %842 = OpLoad %6 %841
531        %843 = OpIEqual %40 %842 %28
532               OpSelectionMerge %859 None
533               OpBranchConditional %843 %848 %844
534        %844 = OpLabel
535        %847 = OpLoad %6 %841
536               OpBranch %882
537        %848 = OpLabel
538               OpStore %841 %179
539        %858 = OpAccessChain %8 %47 %179
540               OpStore %858 %1369
541               OpBranch %883
542        %859 = OpLabel
543               OpUnreachable
544        %860 = OpLabel
545        %862 = OpAccessChain %9 %47 %1268 %27
546        %863 = OpLoad %6 %862
547        %864 = OpIEqual %40 %863 %28
548               OpSelectionMerge %880 None
549               OpBranchConditional %864 %869 %865
550        %865 = OpLabel
551        %868 = OpLoad %6 %862
552               OpBranch %882
553        %869 = OpLabel
554               OpStore %862 %179
555        %879 = OpAccessChain %8 %47 %179
556               OpStore %879 %1369
557               OpBranch %883
558        %880 = OpLabel
559               OpUnreachable
560        %881 = OpLabel
561               OpUnreachable
562        %882 = OpLabel
563       %1350 = OpPhi %6 %847 %844 %868 %865
564               OpBranch %828
565        %883 = OpLabel
566       %1269 = OpPhi %40 %263 %828 %266 %848 %266 %869
567               OpSelectionMerge %885 None
568               OpBranchConditional %1269 %886 %885
569        %885 = OpLabel
570               OpBranch %886
571        %886 = OpLabel
572               OpSelectionMerge %963 None
573               OpSwitch %262 %904
574        %904 = OpLabel
575               OpBranch %905
576        %905 = OpLabel
577       %1276 = OpPhi %6 %24 %904 %1351 %959
578        %909 = OpSLessThanEqual %40 %1276 %141
579               OpLoopMerge %960 %959 None
580               OpBranchConditional %909 %910 %960
581        %910 = OpLabel
582        %913 = OpAccessChain %9 %47 %1276 %24
583        %914 = OpLoad %6 %913
584        %915 = OpSLessThanEqual %40 %206 %914
585               OpSelectionMerge %958 None
586               OpBranchConditional %915 %937 %916
587        %916 = OpLabel
588        %918 = OpAccessChain %9 %47 %1276 %30
589        %919 = OpLoad %6 %918
590        %920 = OpIEqual %40 %919 %28
591               OpSelectionMerge %936 None
592               OpBranchConditional %920 %925 %921
593        %921 = OpLabel
594        %924 = OpLoad %6 %918
595               OpBranch %959
596        %925 = OpLabel
597               OpStore %918 %141
598        %935 = OpAccessChain %8 %47 %141
599               OpStore %935 %1370
600               OpBranch %960
601        %936 = OpLabel
602               OpUnreachable
603        %937 = OpLabel
604        %939 = OpAccessChain %9 %47 %1276 %27
605        %940 = OpLoad %6 %939
606        %941 = OpIEqual %40 %940 %28
607               OpSelectionMerge %957 None
608               OpBranchConditional %941 %946 %942
609        %942 = OpLabel
610        %945 = OpLoad %6 %939
611               OpBranch %959
612        %946 = OpLabel
613               OpStore %939 %141
614        %956 = OpAccessChain %8 %47 %141
615               OpStore %956 %1370
616               OpBranch %960
617        %957 = OpLabel
618               OpUnreachable
619        %958 = OpLabel
620               OpUnreachable
621        %959 = OpLabel
622       %1351 = OpPhi %6 %924 %921 %945 %942
623               OpBranch %905
624        %960 = OpLabel
625       %1277 = OpPhi %40 %263 %905 %266 %925 %266 %946
626               OpSelectionMerge %962 None
627               OpBranchConditional %1277 %963 %962
628        %962 = OpLabel
629               OpBranch %963
630        %963 = OpLabel
631               OpBranch %213
632        %213 = OpLabel
633       %1290 = OpPhi %6 %1318 %963 %1287 %216
634       %1281 = OpPhi %6 %24 %963 %1352 %216
635       %1280 = OpPhi %6 %24 %963 %246 %216
636        %220 = OpSLessThan %40 %1280 %219
637               OpLoopMerge %215 %216 None
638               OpBranchConditional %220 %214 %215
639        %214 = OpLabel
640               OpSelectionMerge %1013 None
641               OpSwitch %262 %981
642        %981 = OpLabel
643               OpBranch %982
644        %982 = OpLabel
645       %1282 = OpPhi %6 %24 %981 %1371 %1009
646        %985 = OpINotEqual %40 %1282 %28
647               OpLoopMerge %1010 %1009 None
648               OpBranchConditional %985 %986 %1010
649        %986 = OpLabel
650        %988 = OpAccessChain %8 %47 %1282
651        %989 = OpLoad %7 %988
652       %1019 = OpCompositeExtract %6 %989 0
653       %1020 = OpCompositeExtract %6 %989 1
654       %1021 = OpCompositeExtract %6 %989 2
655        %993 = OpIEqual %40 %1019 %1280
656               OpSelectionMerge %996 None
657               OpBranchConditional %993 %994 %996
658        %994 = OpLabel
659               OpBranch %1010
660        %996 = OpLabel
661       %1000 = OpSGreaterThan %40 %1280 %1019
662       %1371 = OpSelect %6 %1000 %1021 %1020
663               OpBranch %1009
664       %1009 = OpLabel
665               OpBranch %982
666       %1010 = OpLabel
667       %1288 = OpPhi %6 %1290 %982 %1280 %994
668       %1284 = OpPhi %40 %263 %982 %266 %994
669               OpSelectionMerge %1012 None
670               OpBranchConditional %1284 %1013 %1012
671       %1012 = OpLabel
672               OpBranch %1013
673       %1013 = OpLabel
674       %1287 = OpPhi %6 %1288 %1010 %28 %1012
675               OpSelectionMerge %228 None
676               OpSwitch %1280 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226
677        %226 = OpLabel
678        %231 = OpIEqual %40 %1287 %1280
679               OpSelectionMerge %233 None
680               OpBranchConditional %231 %232 %233
681        %232 = OpLabel
682        %235 = OpIAdd %6 %1281 %27
683               OpBranch %233
684        %233 = OpLabel
685       %1353 = OpPhi %6 %1281 %226 %235 %232
686               OpBranch %228
687        %227 = OpLabel
688        %238 = OpIEqual %40 %1287 %28
689               OpSelectionMerge %240 None
690               OpBranchConditional %238 %239 %240
691        %239 = OpLabel
692        %242 = OpIAdd %6 %1281 %27
693               OpBranch %240
694        %240 = OpLabel
695       %1354 = OpPhi %6 %1281 %227 %242 %239
696               OpBranch %228
697        %228 = OpLabel
698       %1352 = OpPhi %6 %1353 %233 %1354 %240
699               OpBranch %216
700        %216 = OpLabel
701        %246 = OpIAdd %6 %1280 %27
702               OpBranch %213
703        %215 = OpLabel
704        %248 = OpIEqual %40 %1281 %219
705               OpSelectionMerge %250 None
706               OpBranchConditional %248 %249 %258
707        %258 = OpLabel
708               OpStore %254 %259
709               OpBranch %250
710        %249 = OpLabel
711               OpStore %254 %257
712               OpBranch %250
713        %250 = OpLabel
714               OpReturn
715               OpFunctionEnd
716END
717
718
719BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
720
721PIPELINE graphics reference_pipeline
722  ATTACH reference_vertex_shader
723  ATTACH reference_fragment_shader
724  FRAMEBUFFER_SIZE 256 256
725  BIND BUFFER reference_framebuffer AS color LOCATION 0
726END
727CLEAR_COLOR reference_pipeline 0 0 0 255
728
729CLEAR reference_pipeline
730RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
731
732
733SHADER vertex variant_vertex_shader PASSTHROUGH
734
735SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
736; SPIR-V
737; Version: 1.0
738; Generator: Khronos Glslang Reference Front End; 7
739; Bound: 2550
740; Schema: 0
741               OpCapability Shader
742          %1 = OpExtInstImport "GLSL.std.450"
743               OpMemoryModel Logical GLSL450
744               OpEntryPoint Fragment %4 "main" %254
745               OpExecutionMode %4 OriginUpperLeft
746               OpSource ESSL 320
747               OpName %4 "main"
748               OpName %7 "BST"
749               OpMemberName %7 0 "data"
750               OpMemberName %7 1 "leftIndex"
751               OpMemberName %7 2 "rightIndex"
752               OpName %47 "tree"
753               OpName %254 "_GLF_color"
754               OpDecorate %254 Location 0
755          %2 = OpTypeVoid
756          %3 = OpTypeFunction %2
757          %6 = OpTypeInt 32 1
758          %7 = OpTypeStruct %6 %6 %6
759          %8 = OpTypePointer Function %7
760          %9 = OpTypePointer Function %6
761         %24 = OpConstant %6 0
762         %27 = OpConstant %6 1
763         %28 = OpConstant %6 -1
764         %30 = OpConstant %6 2
765         %40 = OpTypeBool
766         %43 = OpTypeInt 32 0
767         %44 = OpConstant %43 10
768         %45 = OpTypeArray %7 %44
769        %141 = OpConstant %6 9
770        %151 = OpConstant %6 5
771        %158 = OpConstant %6 12
772        %165 = OpConstant %6 15
773        %172 = OpConstant %6 7
774        %179 = OpConstant %6 8
775        %192 = OpConstant %6 6
776        %199 = OpConstant %6 17
777        %206 = OpConstant %6 13
778        %219 = OpConstant %6 20
779        %251 = OpTypeFloat 32
780        %252 = OpTypeVector %251 4
781        %253 = OpTypePointer Output %252
782        %254 = OpVariable %253 Output
783        %255 = OpConstant %251 1
784        %256 = OpConstant %251 0
785        %257 = OpConstantComposite %252 %255 %256 %256 %255
786        %259 = OpConstantComposite %252 %256 %256 %255 %255
787        %262 = OpConstant %43 0
788        %263 = OpConstantFalse %40
789        %266 = OpConstantTrue %40
790       %1015 = OpTypePointer Function %45
791       %1318 = OpUndef %6
792       %1359 = OpConstantComposite %7 %141 %28 %28
793       %1360 = OpConstantComposite %7 %151 %28 %28
794       %1361 = OpConstantComposite %7 %158 %28 %28
795       %1362 = OpConstant %6 3
796       %1363 = OpConstantComposite %7 %165 %28 %28
797       %1364 = OpConstant %6 4
798       %1365 = OpConstantComposite %7 %172 %28 %28
799       %1366 = OpConstantComposite %7 %179 %28 %28
800       %1367 = OpConstantComposite %7 %30 %28 %28
801       %1368 = OpConstantComposite %7 %192 %28 %28
802       %1369 = OpConstantComposite %7 %199 %28 %28
803       %1370 = OpConstantComposite %7 %206 %28 %28
804       %1502 = OpConstant %6 15
805       %1505 = OpConstant %6 6
806       %2288 = OpConstant %43 3
807       %2300 = OpTypePointer Output %251
808          %4 = OpFunction %2 None %3
809          %5 = OpLabel
810         %47 = OpVariable %1015 Function
811        %148 = OpAccessChain %8 %47 %24
812               OpStore %148 %1359
813               OpSelectionMerge %347 None
814               OpSwitch %262 %288
815        %288 = OpLabel
816               OpBranch %289
817        %289 = OpLabel
818       %1212 = OpPhi %6 %24 %288 %1342 %343
819        %293 = OpSLessThanEqual %40 %1212 %27
820               OpLoopMerge %344 %343 None
821               OpBranchConditional %293 %294 %344
822        %294 = OpLabel
823        %297 = OpAccessChain %9 %47 %1212 %24
824        %298 = OpLoad %6 %297
825        %299 = OpSLessThanEqual %40 %151 %298
826               OpSelectionMerge %342 None
827               OpBranchConditional %299 %321 %300
828        %300 = OpLabel
829        %302 = OpAccessChain %9 %47 %1212 %30
830        %303 = OpLoad %6 %302
831        %304 = OpIEqual %40 %303 %28
832               OpSelectionMerge %320 None
833               OpBranchConditional %304 %309 %305
834        %305 = OpLabel
835        %308 = OpLoad %6 %302
836               OpBranch %343
837        %309 = OpLabel
838               OpStore %302 %27
839        %319 = OpAccessChain %8 %47 %27
840               OpStore %319 %1360
841               OpBranch %344
842        %320 = OpLabel
843               OpUnreachable
844        %321 = OpLabel
845        %323 = OpAccessChain %9 %47 %1212 %27
846        %324 = OpLoad %6 %323
847        %325 = OpIEqual %40 %324 %28
848               OpSelectionMerge %341 None
849               OpBranchConditional %325 %330 %326
850        %326 = OpLabel
851        %329 = OpLoad %6 %323
852               OpBranch %343
853        %330 = OpLabel
854               OpStore %323 %27
855        %340 = OpAccessChain %8 %47 %27
856               OpStore %340 %1360
857               OpBranch %344
858        %341 = OpLabel
859               OpUnreachable
860        %342 = OpLabel
861               OpUnreachable
862        %343 = OpLabel
863       %1342 = OpPhi %6 %308 %305 %329 %326
864               OpBranch %289
865        %344 = OpLabel
866       %1213 = OpPhi %40 %263 %289 %266 %309 %266 %330
867               OpSelectionMerge %346 None
868               OpBranchConditional %1213 %347 %346
869        %346 = OpLabel
870               OpBranch %347
871        %347 = OpLabel
872               OpSelectionMerge %424 None
873               OpSwitch %262 %365
874        %365 = OpLabel
875               OpBranch %366
876        %366 = OpLabel
877       %1220 = OpPhi %6 %24 %365 %1344 %420
878        %370 = OpSLessThanEqual %40 %1220 %30
879               OpLoopMerge %421 %420 None
880               OpBranchConditional %370 %371 %421
881        %371 = OpLabel
882        %374 = OpAccessChain %9 %47 %1220 %24
883        %375 = OpLoad %6 %374
884        %376 = OpSLessThanEqual %40 %158 %375
885               OpSelectionMerge %419 None
886               OpBranchConditional %376 %398 %377
887        %377 = OpLabel
888        %379 = OpAccessChain %9 %47 %1220 %30
889        %380 = OpLoad %6 %379
890        %381 = OpIEqual %40 %380 %28
891               OpSelectionMerge %397 None
892               OpBranchConditional %381 %386 %382
893        %382 = OpLabel
894        %385 = OpLoad %6 %379
895               OpBranch %420
896        %386 = OpLabel
897               OpStore %379 %30
898        %396 = OpAccessChain %8 %47 %30
899               OpStore %396 %1361
900               OpBranch %421
901        %397 = OpLabel
902               OpUnreachable
903        %398 = OpLabel
904        %400 = OpAccessChain %9 %47 %1220 %27
905        %401 = OpLoad %6 %400
906        %402 = OpIEqual %40 %401 %28
907               OpSelectionMerge %418 None
908               OpBranchConditional %402 %407 %403
909        %403 = OpLabel
910        %406 = OpLoad %6 %400
911               OpBranch %420
912        %407 = OpLabel
913               OpStore %400 %30
914        %417 = OpAccessChain %8 %47 %30
915               OpStore %417 %1361
916               OpBranch %421
917        %418 = OpLabel
918               OpUnreachable
919        %419 = OpLabel
920               OpUnreachable
921        %420 = OpLabel
922       %1344 = OpPhi %6 %385 %382 %406 %403
923               OpBranch %366
924        %421 = OpLabel
925       %1221 = OpPhi %40 %263 %366 %266 %386 %266 %407
926               OpSelectionMerge %423 None
927               OpBranchConditional %1221 %424 %423
928        %423 = OpLabel
929               OpBranch %424
930        %424 = OpLabel
931               OpSelectionMerge %501 None
932               OpSwitch %262 %442
933        %442 = OpLabel
934               OpBranch %443
935        %443 = OpLabel
936       %1228 = OpPhi %6 %24 %442 %1345 %497
937        %447 = OpSLessThanEqual %40 %1228 %1362
938               OpLoopMerge %498 %497 None
939               OpBranchConditional %447 %448 %498
940        %448 = OpLabel
941        %451 = OpAccessChain %9 %47 %1228 %24
942        %452 = OpLoad %6 %451
943        %453 = OpSLessThanEqual %40 %165 %452
944               OpSelectionMerge %496 None
945               OpBranchConditional %453 %475 %454
946        %454 = OpLabel
947        %456 = OpAccessChain %9 %47 %1228 %30
948        %457 = OpLoad %6 %456
949        %458 = OpIEqual %40 %457 %28
950               OpSelectionMerge %474 None
951               OpBranchConditional %458 %463 %459
952        %459 = OpLabel
953        %462 = OpLoad %6 %456
954               OpBranch %497
955        %463 = OpLabel
956               OpStore %456 %1362
957        %473 = OpAccessChain %8 %47 %1362
958               OpStore %473 %1363
959               OpBranch %498
960        %474 = OpLabel
961               OpUnreachable
962        %475 = OpLabel
963        %477 = OpAccessChain %9 %47 %1228 %27
964        %478 = OpLoad %6 %477
965        %479 = OpIEqual %40 %478 %28
966               OpSelectionMerge %495 None
967               OpBranchConditional %479 %484 %480
968        %480 = OpLabel
969        %483 = OpLoad %6 %477
970               OpBranch %497
971        %484 = OpLabel
972               OpStore %477 %1362
973        %494 = OpAccessChain %8 %47 %1362
974               OpStore %494 %1363
975               OpBranch %498
976        %495 = OpLabel
977               OpUnreachable
978        %496 = OpLabel
979               OpUnreachable
980        %497 = OpLabel
981       %1345 = OpPhi %6 %462 %459 %483 %480
982               OpBranch %443
983        %498 = OpLabel
984       %1229 = OpPhi %40 %263 %443 %266 %463 %266 %484
985               OpSelectionMerge %500 None
986               OpBranchConditional %1229 %501 %500
987        %500 = OpLabel
988               OpBranch %501
989        %501 = OpLabel
990               OpSelectionMerge %578 None
991               OpSwitch %262 %519
992        %519 = OpLabel
993               OpBranch %520
994        %520 = OpLabel
995       %1236 = OpPhi %6 %24 %519 %1346 %574
996        %524 = OpSLessThanEqual %40 %1236 %1364
997               OpLoopMerge %575 %574 None
998               OpBranchConditional %524 %525 %575
999        %525 = OpLabel
1000        %528 = OpAccessChain %9 %47 %1236 %24
1001        %529 = OpLoad %6 %528
1002        %530 = OpSLessThanEqual %40 %172 %529
1003               OpSelectionMerge %573 None
1004               OpBranchConditional %530 %552 %531
1005        %531 = OpLabel
1006        %533 = OpAccessChain %9 %47 %1236 %30
1007        %534 = OpLoad %6 %533
1008        %535 = OpIEqual %40 %534 %28
1009               OpSelectionMerge %551 None
1010               OpBranchConditional %535 %540 %536
1011        %536 = OpLabel
1012        %539 = OpLoad %6 %533
1013               OpBranch %574
1014        %540 = OpLabel
1015               OpStore %533 %1364
1016        %550 = OpAccessChain %8 %47 %1364
1017               OpStore %550 %1365
1018               OpBranch %575
1019        %551 = OpLabel
1020               OpUnreachable
1021        %552 = OpLabel
1022        %554 = OpAccessChain %9 %47 %1236 %27
1023        %555 = OpLoad %6 %554
1024        %556 = OpIEqual %40 %555 %28
1025               OpSelectionMerge %572 None
1026               OpBranchConditional %556 %561 %557
1027        %557 = OpLabel
1028        %560 = OpLoad %6 %554
1029               OpBranch %574
1030        %561 = OpLabel
1031               OpStore %554 %1364
1032        %571 = OpAccessChain %8 %47 %1364
1033               OpStore %571 %1365
1034               OpBranch %575
1035        %572 = OpLabel
1036               OpUnreachable
1037        %573 = OpLabel
1038               OpUnreachable
1039        %574 = OpLabel
1040       %1346 = OpPhi %6 %539 %536 %560 %557
1041               OpBranch %520
1042        %575 = OpLabel
1043       %1237 = OpPhi %40 %263 %520 %266 %540 %266 %561
1044               OpSelectionMerge %577 None
1045               OpBranchConditional %1237 %578 %577
1046        %577 = OpLabel
1047               OpBranch %578
1048        %578 = OpLabel
1049               OpSelectionMerge %655 None
1050               OpSwitch %262 %596
1051        %596 = OpLabel
1052               OpBranch %597
1053        %597 = OpLabel
1054       %1244 = OpPhi %6 %24 %596 %1347 %651
1055        %601 = OpSLessThanEqual %40 %1244 %151
1056               OpLoopMerge %652 %651 None
1057               OpBranchConditional %601 %602 %652
1058        %602 = OpLabel
1059        %605 = OpAccessChain %9 %47 %1244 %24
1060        %606 = OpLoad %6 %605
1061        %607 = OpSLessThanEqual %40 %179 %606
1062               OpSelectionMerge %650 None
1063               OpBranchConditional %607 %629 %608
1064        %608 = OpLabel
1065        %610 = OpAccessChain %9 %47 %1244 %30
1066        %611 = OpLoad %6 %610
1067        %612 = OpIEqual %40 %611 %28
1068               OpSelectionMerge %628 None
1069               OpBranchConditional %612 %617 %613
1070        %613 = OpLabel
1071        %616 = OpLoad %6 %610
1072               OpBranch %651
1073        %617 = OpLabel
1074               OpStore %610 %151
1075        %627 = OpAccessChain %8 %47 %151
1076               OpStore %627 %1366
1077               OpBranch %652
1078        %628 = OpLabel
1079               OpUnreachable
1080        %629 = OpLabel
1081        %631 = OpAccessChain %9 %47 %1244 %27
1082        %632 = OpLoad %6 %631
1083        %633 = OpIEqual %40 %632 %28
1084               OpSelectionMerge %649 None
1085               OpBranchConditional %633 %638 %634
1086        %634 = OpLabel
1087        %637 = OpLoad %6 %631
1088               OpBranch %651
1089        %638 = OpLabel
1090               OpStore %631 %151
1091        %648 = OpAccessChain %8 %47 %151
1092               OpStore %648 %1366
1093               OpBranch %652
1094        %649 = OpLabel
1095               OpUnreachable
1096        %650 = OpLabel
1097               OpUnreachable
1098        %651 = OpLabel
1099       %1347 = OpPhi %6 %616 %613 %637 %634
1100               OpBranch %597
1101        %652 = OpLabel
1102       %1245 = OpPhi %40 %263 %597 %266 %617 %266 %638
1103               OpSelectionMerge %654 None
1104               OpBranchConditional %1245 %655 %654
1105        %654 = OpLabel
1106               OpBranch %655
1107        %655 = OpLabel
1108               OpSelectionMerge %732 None
1109               OpSwitch %262 %673
1110        %673 = OpLabel
1111               OpBranch %674
1112        %674 = OpLabel
1113       %1252 = OpPhi %6 %24 %673 %1348 %728
1114        %678 = OpSLessThanEqual %40 %1252 %192
1115               OpLoopMerge %729 %728 None
1116               OpBranchConditional %678 %679 %729
1117        %679 = OpLabel
1118        %682 = OpAccessChain %9 %47 %1252 %24
1119        %683 = OpLoad %6 %682
1120        %684 = OpSLessThanEqual %40 %30 %683
1121               OpSelectionMerge %727 None
1122               OpBranchConditional %684 %706 %685
1123        %685 = OpLabel
1124        %687 = OpAccessChain %9 %47 %1252 %30
1125        %688 = OpLoad %6 %687
1126        %689 = OpIEqual %40 %688 %28
1127               OpSelectionMerge %705 None
1128               OpBranchConditional %689 %694 %690
1129        %690 = OpLabel
1130        %693 = OpLoad %6 %687
1131               OpBranch %728
1132        %694 = OpLabel
1133               OpStore %687 %192
1134        %704 = OpAccessChain %8 %47 %192
1135               OpStore %704 %1367
1136               OpBranch %729
1137        %705 = OpLabel
1138               OpUnreachable
1139        %706 = OpLabel
1140        %708 = OpAccessChain %9 %47 %1252 %27
1141        %709 = OpLoad %6 %708
1142        %710 = OpIEqual %40 %709 %28
1143               OpSelectionMerge %726 None
1144               OpBranchConditional %710 %715 %711
1145        %711 = OpLabel
1146        %714 = OpLoad %6 %708
1147               OpBranch %728
1148        %715 = OpLabel
1149               OpStore %708 %192
1150        %725 = OpAccessChain %8 %47 %192
1151               OpStore %725 %1367
1152               OpBranch %729
1153        %726 = OpLabel
1154               OpUnreachable
1155        %727 = OpLabel
1156               OpUnreachable
1157        %728 = OpLabel
1158       %1348 = OpPhi %6 %693 %690 %714 %711
1159               OpBranch %674
1160        %729 = OpLabel
1161       %1253 = OpPhi %40 %263 %674 %266 %694 %266 %715
1162               OpSelectionMerge %731 None
1163               OpBranchConditional %1253 %732 %731
1164        %731 = OpLabel
1165               OpBranch %732
1166        %732 = OpLabel
1167               OpSelectionMerge %809 None
1168               OpSwitch %262 %750
1169        %750 = OpLabel
1170               OpBranch %751
1171        %751 = OpLabel
1172       %1260 = OpPhi %6 %24 %750 %1349 %805
1173        %755 = OpSLessThanEqual %40 %1260 %172
1174               OpLoopMerge %806 %805 None
1175               OpBranchConditional %755 %756 %806
1176        %756 = OpLabel
1177        %759 = OpAccessChain %9 %47 %1260 %24
1178        %760 = OpLoad %6 %759
1179        %761 = OpSLessThanEqual %40 %192 %760
1180               OpSelectionMerge %804 None
1181               OpBranchConditional %761 %783 %762
1182        %762 = OpLabel
1183        %764 = OpAccessChain %9 %47 %1260 %30
1184        %765 = OpLoad %6 %764
1185        %766 = OpIEqual %40 %765 %28
1186               OpSelectionMerge %782 None
1187               OpBranchConditional %766 %771 %767
1188        %767 = OpLabel
1189        %770 = OpLoad %6 %764
1190               OpBranch %805
1191        %771 = OpLabel
1192               OpStore %764 %172
1193        %781 = OpAccessChain %8 %47 %172
1194               OpStore %781 %1368
1195               OpBranch %806
1196        %782 = OpLabel
1197               OpUnreachable
1198        %783 = OpLabel
1199        %785 = OpAccessChain %9 %47 %1260 %27
1200        %786 = OpLoad %6 %785
1201        %787 = OpIEqual %40 %786 %28
1202               OpSelectionMerge %803 None
1203               OpBranchConditional %787 %792 %788
1204        %788 = OpLabel
1205        %791 = OpLoad %6 %785
1206               OpBranch %805
1207        %792 = OpLabel
1208               OpStore %785 %172
1209        %802 = OpAccessChain %8 %47 %172
1210               OpStore %802 %1368
1211               OpBranch %806
1212        %803 = OpLabel
1213               OpUnreachable
1214        %804 = OpLabel
1215               OpUnreachable
1216        %805 = OpLabel
1217       %1349 = OpPhi %6 %770 %767 %791 %788
1218               OpBranch %751
1219        %806 = OpLabel
1220       %1261 = OpPhi %40 %263 %751 %266 %771 %266 %792
1221               OpSelectionMerge %808 None
1222               OpBranchConditional %1261 %809 %808
1223        %808 = OpLabel
1224               OpBranch %809
1225        %809 = OpLabel
1226               OpSelectionMerge %886 None
1227               OpSwitch %262 %827
1228        %827 = OpLabel
1229               OpBranch %828
1230        %828 = OpLabel
1231       %1268 = OpPhi %6 %24 %827 %1350 %882
1232        %832 = OpSLessThanEqual %40 %1268 %179
1233               OpLoopMerge %883 %882 None
1234               OpBranchConditional %832 %833 %883
1235        %833 = OpLabel
1236        %836 = OpAccessChain %9 %47 %1268 %24
1237        %837 = OpLoad %6 %836
1238        %838 = OpSLessThanEqual %40 %199 %837
1239               OpSelectionMerge %881 None
1240               OpBranchConditional %838 %860 %839
1241        %839 = OpLabel
1242        %841 = OpAccessChain %9 %47 %1268 %30
1243        %842 = OpLoad %6 %841
1244        %843 = OpIEqual %40 %842 %28
1245               OpSelectionMerge %859 None
1246               OpBranchConditional %843 %848 %844
1247        %844 = OpLabel
1248        %847 = OpLoad %6 %841
1249               OpBranch %882
1250        %848 = OpLabel
1251               OpStore %841 %179
1252        %858 = OpAccessChain %8 %47 %179
1253               OpStore %858 %1369
1254               OpBranch %883
1255        %859 = OpLabel
1256               OpUnreachable
1257        %860 = OpLabel
1258        %862 = OpAccessChain %9 %47 %1268 %27
1259        %863 = OpLoad %6 %862
1260        %864 = OpIEqual %40 %863 %28
1261               OpSelectionMerge %880 None
1262               OpBranchConditional %864 %869 %865
1263        %865 = OpLabel
1264        %868 = OpLoad %6 %862
1265               OpBranch %882
1266        %869 = OpLabel
1267               OpStore %862 %179
1268        %879 = OpAccessChain %8 %47 %179
1269               OpStore %879 %1369
1270               OpBranch %883
1271        %880 = OpLabel
1272               OpUnreachable
1273        %881 = OpLabel
1274               OpUnreachable
1275        %882 = OpLabel
1276       %1350 = OpPhi %6 %847 %844 %868 %865
1277               OpBranch %828
1278        %883 = OpLabel
1279       %1269 = OpPhi %40 %263 %828 %266 %848 %266 %869
1280               OpSelectionMerge %885 None
1281               OpBranchConditional %1269 %886 %885
1282        %885 = OpLabel
1283               OpBranch %886
1284        %886 = OpLabel
1285               OpSelectionMerge %963 None
1286               OpSwitch %262 %904
1287        %904 = OpLabel
1288               OpBranch %905
1289        %905 = OpLabel
1290       %1276 = OpPhi %6 %24 %904 %1351 %959
1291        %909 = OpSLessThanEqual %40 %1276 %141
1292               OpLoopMerge %960 %959 None
1293               OpBranchConditional %909 %910 %960
1294        %910 = OpLabel
1295        %913 = OpAccessChain %9 %47 %1276 %24
1296        %914 = OpLoad %6 %913
1297        %915 = OpSLessThanEqual %40 %206 %914
1298               OpSelectionMerge %958 None
1299               OpBranchConditional %915 %937 %916
1300        %916 = OpLabel
1301        %918 = OpAccessChain %9 %47 %1276 %30
1302        %919 = OpLoad %6 %918
1303        %920 = OpIEqual %40 %919 %28
1304               OpSelectionMerge %936 None
1305               OpBranchConditional %920 %925 %921
1306        %921 = OpLabel
1307        %924 = OpLoad %6 %918
1308               OpBranch %959
1309        %925 = OpLabel
1310               OpStore %918 %141
1311        %935 = OpAccessChain %8 %47 %141
1312               OpStore %935 %1370
1313               OpBranch %960
1314        %936 = OpLabel
1315               OpUnreachable
1316        %937 = OpLabel
1317        %939 = OpAccessChain %9 %47 %1276 %27
1318        %940 = OpLoad %6 %939
1319        %941 = OpIEqual %40 %940 %28
1320               OpSelectionMerge %957 None
1321               OpBranchConditional %941 %946 %942
1322        %942 = OpLabel
1323        %945 = OpLoad %6 %939
1324               OpBranch %959
1325        %946 = OpLabel
1326               OpStore %939 %141
1327        %956 = OpAccessChain %8 %47 %141
1328               OpStore %956 %1370
1329               OpBranch %960
1330        %957 = OpLabel
1331               OpUnreachable
1332        %958 = OpLabel
1333               OpUnreachable
1334        %959 = OpLabel
1335       %1351 = OpPhi %6 %924 %921 %945 %942
1336               OpBranch %905
1337        %960 = OpLabel
1338       %1277 = OpPhi %40 %263 %905 %266 %925 %266 %946
1339               OpSelectionMerge %962 None
1340               OpBranchConditional %1277 %963 %962
1341        %962 = OpLabel
1342               OpBranch %963
1343        %963 = OpLabel
1344               OpBranch %213
1345        %213 = OpLabel
1346       %1290 = OpPhi %6 %1318 %963 %1287 %216
1347       %1281 = OpPhi %6 %24 %963 %1352 %216
1348       %1280 = OpPhi %6 %24 %963 %246 %216
1349        %220 = OpSLessThan %40 %1280 %219
1350       %2223 = OpISub %6 %1505 %1502
1351       %2353 = OpULessThanEqual %40 %2288 %2288
1352       %2354 = OpSelect %43 %2353 %2288 %2288
1353       %2355 = OpAccessChain %2300 %254 %2354
1354               OpLoopMerge %215 %216 None
1355               OpBranchConditional %220 %214 %215
1356        %214 = OpLabel
1357               OpSelectionMerge %1013 None
1358               OpSwitch %262 %981
1359        %981 = OpLabel
1360               OpBranch %982
1361        %982 = OpLabel
1362       %1282 = OpPhi %6 %24 %981 %1371 %1009
1363        %985 = OpINotEqual %40 %1282 %28
1364               OpLoopMerge %1010 %1009 None
1365               OpBranchConditional %985 %986 %1010
1366        %986 = OpLabel
1367        %988 = OpAccessChain %8 %47 %1282
1368        %989 = OpLoad %7 %988
1369       %1019 = OpCompositeExtract %6 %989 0
1370       %1020 = OpCompositeExtract %6 %989 1
1371       %2356 = OpInBoundsAccessChain %2300 %2355
1372       %1021 = OpCompositeExtract %6 %989 2
1373        %993 = OpIEqual %40 %1019 %1280
1374               OpSelectionMerge %996 None
1375               OpBranchConditional %993 %994 %996
1376        %994 = OpLabel
1377               OpBranch %1010
1378        %996 = OpLabel
1379       %2549 = OpLoad %251 %2356
1380       %1487 = OpSLessThanEqual %40 %1280 %1019
1381       %1000 = OpLogicalNot %40 %1487
1382       %1371 = OpSelect %6 %1000 %1021 %1020
1383               OpBranch %1009
1384       %1009 = OpLabel
1385               OpBranch %982
1386       %1010 = OpLabel
1387       %1288 = OpPhi %6 %1290 %982 %1280 %994
1388       %1284 = OpPhi %40 %263 %982 %266 %994
1389               OpSelectionMerge %1012 None
1390               OpBranchConditional %1284 %1013 %1012
1391       %1012 = OpLabel
1392               OpBranch %1013
1393       %1013 = OpLabel
1394       %1287 = OpPhi %6 %1288 %1010 %28 %1012
1395               OpSelectionMerge %228 None
1396               OpSwitch %1280 %227 9 %226 5 %226 12 %226 15 %226 7 %226 8 %226 2 %226 6 %226 17 %226 13 %226
1397        %226 = OpLabel
1398        %231 = OpIEqual %40 %1287 %1280
1399               OpSelectionMerge %233 None
1400               OpBranchConditional %231 %232 %233
1401        %232 = OpLabel
1402        %235 = OpIAdd %6 %1281 %27
1403               OpBranch %233
1404        %233 = OpLabel
1405       %1353 = OpPhi %6 %1281 %226 %235 %232
1406               OpBranch %228
1407        %227 = OpLabel
1408        %238 = OpIEqual %40 %1287 %28
1409               OpSelectionMerge %240 None
1410               OpBranchConditional %238 %239 %240
1411        %239 = OpLabel
1412        %242 = OpIAdd %6 %1281 %27
1413               OpBranch %240
1414        %240 = OpLabel
1415       %1354 = OpPhi %6 %1281 %227 %242 %239
1416               OpBranch %228
1417        %228 = OpLabel
1418       %1352 = OpPhi %6 %1353 %233 %1354 %240
1419               OpBranch %216
1420        %216 = OpLabel
1421        %246 = OpIAdd %6 %1280 %27
1422               OpBranch %213
1423        %215 = OpLabel
1424        %248 = OpIEqual %40 %1281 %219
1425               OpSelectionMerge %250 None
1426               OpBranchConditional %248 %249 %258
1427        %258 = OpLabel
1428               OpStore %254 %259
1429               OpBranch %250
1430        %249 = OpLabel
1431               OpStore %254 %257
1432               OpBranch %250
1433        %250 = OpLabel
1434               OpReturn
1435               OpFunctionEnd
1436END
1437
1438
1439BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
1440
1441PIPELINE graphics variant_pipeline
1442  ATTACH variant_vertex_shader
1443  ATTACH variant_fragment_shader
1444  FRAMEBUFFER_SIZE 256 256
1445  BIND BUFFER variant_framebuffer AS color LOCATION 0
1446END
1447CLEAR_COLOR variant_pipeline 0 0 0 255
1448
1449CLEAR variant_pipeline
1450RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
1451
1452EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
1453