3 # Copyright 2020 Google LLC
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # A test for a bug found by the GraphicsFuzz project.
20 # Short description: A fragment shader with for loop and always false if
22 # The test passes because both shaders render the same image.
24 # Optimized using spirv-opt with the following arguments:
26 # spirv-opt commit hash: 717e7877cac15d393fd3bb1bd872679de8b59add
30 SHADER vertex reference_vertex_shader PASSTHROUGH
32 # reference_fragment_shader is derived from the following GLSL:
34 # precision highp float;
36 # precision highp int;
38 # layout(location = 0) out vec4 _GLF_color;
40 # layout(set = 0, binding = 0) uniform buf0
42 # vec2 injectionSwitch;
46 # int data[10], temp[10];
48 # void merge(int from, int mid, int to)
50 # int k = from, i = from, j = mid + 1;
51 # while (i <= mid && j <= to)
53 # if (data[i] < data[j])
55 # temp[k++] = data[i++];
59 # temp[k++] = data[j++];
62 # while (i < N && i <= mid)
64 # temp[k++] = data[i++];
66 # for (int i = from; i <= to; i++)
75 # for (int m = 1; m <= high; m = 2 * m)
77 # for (int i = low; i < high; i += 2 * m)
80 # int mid = i + m - 1;
81 # int to = min(i + 2 * m - 1, high);
82 # merge(from, mid, to);
88 # int i = int(injectionSwitch.x);
126 # for (int j = 0; j < 10; j++)
132 # if (int(gl_FragCoord[1]) < 30)
134 # grey = 0.5 + float(data[0]) / 10.0;
138 # if (int(gl_FragCoord[1]) < 60)
140 # grey = 0.5 + float(data[1]) / 10.0;
144 # if (int(gl_FragCoord[1]) < 90)
146 # grey = 0.5 + float(data[2]) / 10.0;
150 # if (int(gl_FragCoord[1]) < 120)
152 # grey = 0.5 + float(data[3]) / 10.0;
156 # if (int(gl_FragCoord[1]) < 150)
162 # if (int(gl_FragCoord[1]) < 180)
164 # grey = 0.5 + float(data[5]) / 10.0;
168 # if (int(gl_FragCoord[1]) < 210)
170 # grey = 0.5 + float(data[6]) / 10.0;
174 # if (int(gl_FragCoord[1]) < 240)
176 # grey = 0.5 + float(data[7]) / 10.0;
180 # if (int(gl_FragCoord[1]) < 270)
182 # grey = 0.5 + float(data[8]) / 10.0;
196 # _GLF_color = vec4(vec3(grey), 1.0);
198 SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
201 ; Generator: Khronos Glslang Reference Front End; 10
205 %1 = OpExtInstImport "GLSL.std.450"
206 OpMemoryModel Logical GLSL450
207 OpEntryPoint Fragment %4 "main" %243 %369
208 OpExecutionMode %4 OriginUpperLeft
214 OpMemberName %159 0 "injectionSwitch"
216 OpName %243 "gl_FragCoord"
217 OpName %369 "_GLF_color"
218 OpMemberDecorate %159 0 Offset 0
219 OpDecorate %159 Block
220 OpDecorate %161 DescriptorSet 0
221 OpDecorate %161 Binding 0
222 OpDecorate %243 BuiltIn FragCoord
223 OpDecorate %369 Location 0
225 %3 = OpTypeFunction %2
227 %7 = OpTypePointer Function %6
228 %22 = OpConstant %6 1
231 %38 = OpConstant %37 10
232 %39 = OpTypeArray %6 %38
233 %74 = OpConstant %6 10
234 %105 = OpConstant %6 0
235 %107 = OpConstant %6 9
236 %136 = OpConstant %6 2
237 %157 = OpTypeFloat 32
238 %158 = OpTypeVector %157 2
239 %159 = OpTypeStruct %158
240 %160 = OpTypePointer Uniform %159
241 %161 = OpVariable %160 Uniform
242 %162 = OpConstant %37 0
243 %163 = OpTypePointer Uniform %157
244 %184 = OpConstant %6 4
245 %188 = OpConstant %6 3
246 %201 = OpConstant %6 -1
247 %205 = OpConstant %6 -2
248 %209 = OpConstant %6 -3
249 %213 = OpConstant %6 -4
250 %217 = OpConstant %6 -5
251 %241 = OpTypeVector %157 4
252 %242 = OpTypePointer Input %241
253 %243 = OpVariable %242 Input
254 %244 = OpConstant %37 1
255 %245 = OpTypePointer Input %157
256 %249 = OpConstant %6 30
257 %255 = OpConstant %157 0.5
258 %266 = OpConstant %6 60
259 %279 = OpConstant %6 90
260 %292 = OpConstant %6 120
261 %305 = OpConstant %6 150
262 %314 = OpConstant %6 180
263 %318 = OpConstant %6 5
264 %328 = OpConstant %6 210
265 %332 = OpConstant %6 6
266 %342 = OpConstant %6 240
267 %346 = OpConstant %6 7
268 %356 = OpConstant %6 270
269 %360 = OpConstant %6 8
270 %368 = OpTypePointer Output %241
271 %369 = OpVariable %368 Output
272 %373 = OpConstant %157 1
273 %507 = OpTypePointer Function %39
274 %539 = OpConstant %157 0.100000001
275 %4 = OpFunction %2 None %3
277 %52 = OpVariable %507 Function
278 %41 = OpVariable %507 Function
279 %164 = OpAccessChain %163 %161 %105 %162
280 %165 = OpLoad %157 %164
281 %166 = OpConvertFToS %6 %165
284 %508 = OpPhi %6 %166 %5 %222 %170
285 OpLoopMerge %169 %170 None
288 OpSelectionMerge %182 None
289 OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
291 %185 = OpAccessChain %7 %41 %508
295 %189 = OpAccessChain %7 %41 %508
299 %192 = OpAccessChain %7 %41 %508
303 %195 = OpAccessChain %7 %41 %508
307 %198 = OpAccessChain %7 %41 %508
311 %202 = OpAccessChain %7 %41 %508
315 %206 = OpAccessChain %7 %41 %508
319 %210 = OpAccessChain %7 %41 %508
323 %214 = OpAccessChain %7 %41 %508
327 %218 = OpAccessChain %7 %41 %508
331 %222 = OpIAdd %6 %508 %22
334 %224 = OpSLessThan %31 %222 %74
335 OpBranchConditional %224 %167 %169
339 %510 = OpPhi %6 %105 %169 %239 %227
340 %232 = OpSLessThan %31 %510 %74
341 OpLoopMerge %228 %227 None
342 OpBranchConditional %232 %227 %228
344 %235 = OpAccessChain %7 %41 %510
345 %236 = OpLoad %6 %235
346 %237 = OpAccessChain %7 %52 %510
348 %239 = OpIAdd %6 %510 %22
353 %511 = OpPhi %6 %22 %228 %426 %424
354 %393 = OpSLessThanEqual %31 %511 %107
355 OpLoopMerge %427 %424 None
356 OpBranchConditional %393 %394 %427
360 %519 = OpPhi %6 %105 %394 %410 %418
361 %400 = OpSLessThan %31 %519 %107
362 OpLoopMerge %423 %418 None
363 OpBranchConditional %400 %401 %423
365 %405 = OpIAdd %6 %519 %511
366 %406 = OpISub %6 %405 %22
367 %409 = OpIMul %6 %136 %511
368 %410 = OpIAdd %6 %519 %409
369 %411 = OpISub %6 %410 %22
370 %413 = OpExtInst %6 %1 SMin %411 %107
373 %532 = OpPhi %6 %519 %401 %456 %471
374 %522 = OpPhi %6 %405 %401 %534 %471
375 %521 = OpPhi %6 %519 %401 %533 %471
376 %441 = OpSLessThanEqual %31 %521 %406
377 %444 = OpSLessThanEqual %31 %522 %413
378 %445 = OpLogicalAnd %31 %441 %444
379 OpLoopMerge %472 %471 None
380 OpBranchConditional %445 %446 %472
382 %448 = OpAccessChain %7 %41 %521
383 %449 = OpLoad %6 %448
384 %451 = OpAccessChain %7 %41 %522
385 %452 = OpLoad %6 %451
386 %453 = OpSLessThan %31 %449 %452
387 %456 = OpIAdd %6 %532 %22
388 OpSelectionMerge %470 None
389 OpBranchConditional %453 %454 %462
391 %458 = OpIAdd %6 %521 %22
392 %460 = OpLoad %6 %448
393 %461 = OpAccessChain %7 %52 %532
397 %466 = OpIAdd %6 %522 %22
398 %468 = OpLoad %6 %451
399 %469 = OpAccessChain %7 %52 %532
403 %534 = OpPhi %6 %522 %454 %466 %462
404 %533 = OpPhi %6 %458 %454 %521 %462
411 %531 = OpPhi %6 %532 %472 %483 %481
412 %523 = OpPhi %6 %521 %472 %485 %481
413 %476 = OpSLessThan %31 %523 %74
414 %479 = OpSLessThanEqual %31 %523 %406
415 %480 = OpLogicalAnd %31 %476 %479
416 OpLoopMerge %490 %481 None
417 OpBranchConditional %480 %481 %490
419 %483 = OpIAdd %6 %531 %22
420 %485 = OpIAdd %6 %523 %22
421 %486 = OpAccessChain %7 %41 %523
422 %487 = OpLoad %6 %486
423 %488 = OpAccessChain %7 %52 %531
429 %524 = OpPhi %6 %519 %490 %505 %497
430 %496 = OpSLessThanEqual %31 %524 %413
431 OpLoopMerge %506 %497 None
432 OpBranchConditional %496 %497 %506
434 %500 = OpAccessChain %7 %52 %524
435 %501 = OpLoad %6 %500
436 %502 = OpAccessChain %7 %41 %524
438 %505 = OpIAdd %6 %524 %22
447 %426 = OpIMul %6 %136 %511
450 %246 = OpAccessChain %245 %243 %244
451 %247 = OpLoad %157 %246
452 %248 = OpConvertFToS %6 %247
453 %250 = OpSLessThan %31 %248 %249
454 OpSelectionMerge %252 None
455 OpBranchConditional %250 %251 %262
457 %256 = OpAccessChain %7 %41 %105
458 %257 = OpLoad %6 %256
459 %258 = OpConvertSToF %157 %257
460 %260 = OpFMul %157 %258 %539
461 %261 = OpFAdd %157 %255 %260
464 %267 = OpSLessThan %31 %248 %266
465 OpSelectionMerge %269 None
466 OpBranchConditional %267 %268 %275
468 %270 = OpAccessChain %7 %41 %22
469 %271 = OpLoad %6 %270
470 %272 = OpConvertSToF %157 %271
471 %273 = OpFMul %157 %272 %539
472 %274 = OpFAdd %157 %255 %273
475 %280 = OpSLessThan %31 %248 %279
476 OpSelectionMerge %282 None
477 OpBranchConditional %280 %281 %288
479 %283 = OpAccessChain %7 %41 %136
480 %284 = OpLoad %6 %283
481 %285 = OpConvertSToF %157 %284
482 %286 = OpFMul %157 %285 %539
483 %287 = OpFAdd %157 %255 %286
486 %293 = OpSLessThan %31 %248 %292
487 OpSelectionMerge %295 None
488 OpBranchConditional %293 %294 %301
490 %296 = OpAccessChain %7 %41 %188
491 %297 = OpLoad %6 %296
492 %298 = OpConvertSToF %157 %297
493 %299 = OpFMul %157 %298 %539
494 %300 = OpFAdd %157 %255 %299
497 %306 = OpSLessThan %31 %248 %305
498 OpSelectionMerge %308 None
499 OpBranchConditional %306 %307 %310
503 %315 = OpSLessThan %31 %248 %314
504 OpSelectionMerge %317 None
505 OpBranchConditional %315 %316 %324
507 %319 = OpAccessChain %7 %41 %318
508 %320 = OpLoad %6 %319
509 %321 = OpConvertSToF %157 %320
510 %322 = OpFMul %157 %321 %539
511 %323 = OpFAdd %157 %255 %322
514 %329 = OpSLessThan %31 %248 %328
515 OpSelectionMerge %331 None
516 OpBranchConditional %329 %330 %338
518 %333 = OpAccessChain %7 %41 %332
519 %334 = OpLoad %6 %333
520 %335 = OpConvertSToF %157 %334
521 %336 = OpFMul %157 %335 %539
522 %337 = OpFAdd %157 %255 %336
525 %343 = OpSLessThan %31 %248 %342
526 OpSelectionMerge %345 None
527 OpBranchConditional %343 %344 %352
529 %347 = OpAccessChain %7 %41 %346
530 %348 = OpLoad %6 %347
531 %349 = OpConvertSToF %157 %348
532 %350 = OpFMul %157 %349 %539
533 %351 = OpFAdd %157 %255 %350
536 %357 = OpSLessThan %31 %248 %356
537 OpSelectionMerge %358 None
538 OpBranchConditional %357 %358 %366
540 %361 = OpAccessChain %7 %41 %360
541 %362 = OpLoad %6 %361
542 %363 = OpConvertSToF %157 %362
543 %364 = OpFMul %157 %363 %539
544 %365 = OpFAdd %157 %255 %364
549 %518 = OpPhi %157 %351 %344 %365 %358
552 %517 = OpPhi %157 %337 %330 %518 %345
555 %516 = OpPhi %157 %323 %316 %517 %331
560 %515 = OpPhi %157 %300 %294 %516 %308
563 %514 = OpPhi %157 %287 %281 %515 %295
566 %513 = OpPhi %157 %274 %268 %514 %282
569 %512 = OpPhi %157 %261 %251 %513 %269
570 %377 = OpCompositeConstruct %241 %512 %512 %512 %373
576 # uniforms for reference
579 BUFFER reference_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
583 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
585 PIPELINE graphics reference_pipeline
586 ATTACH reference_vertex_shader
587 ATTACH reference_fragment_shader
588 FRAMEBUFFER_SIZE 256 256
589 BIND BUFFER reference_framebuffer AS color LOCATION 0
590 BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
592 CLEAR_COLOR reference_pipeline 0 0 0 255
594 CLEAR reference_pipeline
595 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
598 SHADER vertex variant_vertex_shader PASSTHROUGH
600 # variant_fragment_shader is derived from the following GLSL:
602 # precision highp float;
604 # precision highp int;
606 # layout(location = 0) out vec4 _GLF_color;
608 # layout(set = 0, binding = 0) uniform buf0
610 # vec2 injectionSwitch; // x == 0.0, y == 1.0
614 # int data[10], temp[10];
616 # void merge(int from, int mid, int to)
618 # int k = from, i = from, j = mid + 1;
619 # while (i <= mid && j <= to)
621 # if (data[i] < data[j])
623 # temp[k++] = data[i++];
627 # temp[k++] = data[j++];
630 # while (i < N && i <= mid)
632 # temp[k++] = data[i++];
634 # for (int i = from; i <= to; i++)
643 # for (int m = 1; m <= high; m = 2 * m)
645 # for (int i = low; i < high; i += 2 * m)
648 # int mid = i + m - 1;
649 # int to = min(i + 2 * m - 1, high);
650 # merge(from, mid, to);
656 # int i = int(injectionSwitch.x);
694 # for (int j = 0; j < 10; j++)
700 # if (int(gl_FragCoord[1]) < 30)
702 # grey = 0.5 + float(data[0]) / 10.0;
706 # if (int(gl_FragCoord[1]) < 60)
708 # grey = 0.5 + float(data[1]) / 10.0;
712 # if (int(gl_FragCoord[1]) < 90)
714 # grey = 0.5 + float(data[2]) / 10.0;
718 # if (int(gl_FragCoord[1]) < 120)
720 # grey = 0.5 + float(data[3]) / 10.0;
724 # if (int(gl_FragCoord[1]) < 150)
730 # if (int(gl_FragCoord[1]) < 180)
732 # grey = 0.5 + float(data[5]) / 10.0;
736 # if (int(gl_FragCoord[1]) < 210)
738 # grey = 0.5 + float(data[6]) / 10.0;
742 # if (int(gl_FragCoord[1]) < 240)
744 # grey = 0.5 + float(data[7]) / 10.0;
748 # if (int(gl_FragCoord[1]) < 270)
750 # grey = 0.5 + float(data[8]) / 10.0;
759 # // Code block bellow should not affect output image.
761 # if (injectionSwitch.x > injectionSwitch.y)
763 # _GLF_color = vec4(1.0);
765 # vec2 a = vec2(1.0, 1.0);
766 # for (int i = 0; i <= 32; i++)
772 # if (injectionSwitch.x > injectionSwitch.y)
786 # _GLF_color = vec4(vec3(grey), 1.0);
788 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
791 ; Generator: Khronos Glslang Reference Front End; 10
795 %1 = OpExtInstImport "GLSL.std.450"
796 OpMemoryModel Logical GLSL450
797 OpEntryPoint Fragment %4 "main" %243 %376
798 OpExecutionMode %4 OriginUpperLeft
804 OpMemberName %159 0 "injectionSwitch"
806 OpName %243 "gl_FragCoord"
807 OpName %376 "_GLF_color"
808 OpMemberDecorate %159 0 Offset 0
809 OpDecorate %159 Block
810 OpDecorate %161 DescriptorSet 0
811 OpDecorate %161 Binding 0
812 OpDecorate %243 BuiltIn FragCoord
813 OpDecorate %376 Location 0
815 %3 = OpTypeFunction %2
817 %7 = OpTypePointer Function %6
818 %22 = OpConstant %6 1
821 %38 = OpConstant %37 10
822 %39 = OpTypeArray %6 %38
823 %74 = OpConstant %6 10
824 %105 = OpConstant %6 0
825 %107 = OpConstant %6 9
826 %136 = OpConstant %6 2
827 %157 = OpTypeFloat 32
828 %158 = OpTypeVector %157 2
829 %159 = OpTypeStruct %158
830 %160 = OpTypePointer Uniform %159
831 %161 = OpVariable %160 Uniform
832 %162 = OpConstant %37 0
833 %163 = OpTypePointer Uniform %157
834 %184 = OpConstant %6 4
835 %188 = OpConstant %6 3
836 %201 = OpConstant %6 -1
837 %205 = OpConstant %6 -2
838 %209 = OpConstant %6 -3
839 %213 = OpConstant %6 -4
840 %217 = OpConstant %6 -5
841 %241 = OpTypeVector %157 4
842 %242 = OpTypePointer Input %241
843 %243 = OpVariable %242 Input
844 %244 = OpConstant %37 1
845 %245 = OpTypePointer Input %157
846 %249 = OpConstant %6 30
847 %255 = OpConstant %157 0.5
848 %266 = OpConstant %6 60
849 %279 = OpConstant %6 90
850 %292 = OpConstant %6 120
851 %305 = OpConstant %6 150
852 %314 = OpConstant %6 180
853 %318 = OpConstant %6 5
854 %328 = OpConstant %6 210
855 %332 = OpConstant %6 6
856 %342 = OpConstant %6 240
857 %346 = OpConstant %6 7
858 %356 = OpConstant %6 270
859 %360 = OpConstant %6 8
860 %375 = OpTypePointer Output %241
861 %376 = OpVariable %375 Output
862 %377 = OpConstant %157 1
863 %378 = OpConstantComposite %241 %377 %377 %377 %377
864 %381 = OpConstantComposite %158 %377 %377
865 %389 = OpConstant %6 32
866 %393 = OpConstant %157 0
867 %552 = OpTypePointer Function %39
868 %601 = OpConstant %157 0.100000001
869 %4 = OpFunction %2 None %3
871 %52 = OpVariable %552 Function
872 %41 = OpVariable %552 Function
873 %164 = OpAccessChain %163 %161 %105 %162
874 %165 = OpLoad %157 %164
875 %166 = OpConvertFToS %6 %165
878 %561 = OpPhi %6 %166 %5 %222 %170
879 OpLoopMerge %169 %170 None
882 OpSelectionMerge %182 None
883 OpSwitch %561 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
885 %185 = OpAccessChain %7 %41 %561
889 %189 = OpAccessChain %7 %41 %561
893 %192 = OpAccessChain %7 %41 %561
897 %195 = OpAccessChain %7 %41 %561
901 %198 = OpAccessChain %7 %41 %561
905 %202 = OpAccessChain %7 %41 %561
909 %206 = OpAccessChain %7 %41 %561
913 %210 = OpAccessChain %7 %41 %561
917 %214 = OpAccessChain %7 %41 %561
921 %218 = OpAccessChain %7 %41 %561
925 %222 = OpIAdd %6 %561 %22
928 %224 = OpSLessThan %31 %222 %74
929 OpBranchConditional %224 %167 %169
933 %563 = OpPhi %6 %105 %169 %239 %227
934 %232 = OpSLessThan %31 %563 %74
935 OpLoopMerge %228 %227 None
936 OpBranchConditional %232 %227 %228
938 %235 = OpAccessChain %7 %41 %563
939 %236 = OpLoad %6 %235
940 %237 = OpAccessChain %7 %52 %563
942 %239 = OpIAdd %6 %563 %22
947 %564 = OpPhi %6 %22 %228 %471 %469
948 %438 = OpSLessThanEqual %31 %564 %107
949 OpLoopMerge %472 %469 None
950 OpBranchConditional %438 %439 %472
954 %579 = OpPhi %6 %105 %439 %455 %463
955 %445 = OpSLessThan %31 %579 %107
956 OpLoopMerge %468 %463 None
957 OpBranchConditional %445 %446 %468
959 %450 = OpIAdd %6 %579 %564
960 %451 = OpISub %6 %450 %22
961 %454 = OpIMul %6 %136 %564
962 %455 = OpIAdd %6 %579 %454
963 %456 = OpISub %6 %455 %22
964 %458 = OpExtInst %6 %1 SMin %456 %107
967 %592 = OpPhi %6 %579 %446 %501 %516
968 %582 = OpPhi %6 %450 %446 %594 %516
969 %581 = OpPhi %6 %579 %446 %593 %516
970 %486 = OpSLessThanEqual %31 %581 %451
971 %489 = OpSLessThanEqual %31 %582 %458
972 %490 = OpLogicalAnd %31 %486 %489
973 OpLoopMerge %517 %516 None
974 OpBranchConditional %490 %491 %517
976 %493 = OpAccessChain %7 %41 %581
977 %494 = OpLoad %6 %493
978 %496 = OpAccessChain %7 %41 %582
979 %497 = OpLoad %6 %496
980 %498 = OpSLessThan %31 %494 %497
981 %501 = OpIAdd %6 %592 %22
982 OpSelectionMerge %515 None
983 OpBranchConditional %498 %499 %507
985 %503 = OpIAdd %6 %581 %22
986 %505 = OpLoad %6 %493
987 %506 = OpAccessChain %7 %52 %592
991 %511 = OpIAdd %6 %582 %22
992 %513 = OpLoad %6 %496
993 %514 = OpAccessChain %7 %52 %592
997 %594 = OpPhi %6 %582 %499 %511 %507
998 %593 = OpPhi %6 %503 %499 %581 %507
1005 %591 = OpPhi %6 %592 %517 %528 %526
1006 %583 = OpPhi %6 %581 %517 %530 %526
1007 %521 = OpSLessThan %31 %583 %74
1008 %524 = OpSLessThanEqual %31 %583 %451
1009 %525 = OpLogicalAnd %31 %521 %524
1010 OpLoopMerge %535 %526 None
1011 OpBranchConditional %525 %526 %535
1013 %528 = OpIAdd %6 %591 %22
1014 %530 = OpIAdd %6 %583 %22
1015 %531 = OpAccessChain %7 %41 %583
1016 %532 = OpLoad %6 %531
1017 %533 = OpAccessChain %7 %52 %591
1023 %584 = OpPhi %6 %579 %535 %550 %542
1024 %541 = OpSLessThanEqual %31 %584 %458
1025 OpLoopMerge %551 %542 None
1026 OpBranchConditional %541 %542 %551
1028 %545 = OpAccessChain %7 %52 %584
1029 %546 = OpLoad %6 %545
1030 %547 = OpAccessChain %7 %41 %584
1032 %550 = OpIAdd %6 %584 %22
1041 %471 = OpIMul %6 %136 %564
1044 %246 = OpAccessChain %245 %243 %244
1045 %247 = OpLoad %157 %246
1046 %248 = OpConvertFToS %6 %247
1047 %250 = OpSLessThan %31 %248 %249
1048 OpSelectionMerge %252 None
1049 OpBranchConditional %250 %251 %262
1051 %256 = OpAccessChain %7 %41 %105
1052 %257 = OpLoad %6 %256
1053 %258 = OpConvertSToF %157 %257
1054 %260 = OpFMul %157 %258 %601
1055 %261 = OpFAdd %157 %255 %260
1058 %267 = OpSLessThan %31 %248 %266
1059 OpSelectionMerge %269 None
1060 OpBranchConditional %267 %268 %275
1062 %270 = OpAccessChain %7 %41 %22
1063 %271 = OpLoad %6 %270
1064 %272 = OpConvertSToF %157 %271
1065 %273 = OpFMul %157 %272 %601
1066 %274 = OpFAdd %157 %255 %273
1069 %280 = OpSLessThan %31 %248 %279
1070 OpSelectionMerge %282 None
1071 OpBranchConditional %280 %281 %288
1073 %283 = OpAccessChain %7 %41 %136
1074 %284 = OpLoad %6 %283
1075 %285 = OpConvertSToF %157 %284
1076 %286 = OpFMul %157 %285 %601
1077 %287 = OpFAdd %157 %255 %286
1080 %293 = OpSLessThan %31 %248 %292
1081 OpSelectionMerge %295 None
1082 OpBranchConditional %293 %294 %301
1084 %296 = OpAccessChain %7 %41 %188
1085 %297 = OpLoad %6 %296
1086 %298 = OpConvertSToF %157 %297
1087 %299 = OpFMul %157 %298 %601
1088 %300 = OpFAdd %157 %255 %299
1091 %306 = OpSLessThan %31 %248 %305
1092 OpSelectionMerge %308 None
1093 OpBranchConditional %306 %307 %310
1097 %315 = OpSLessThan %31 %248 %314
1098 OpSelectionMerge %317 None
1099 OpBranchConditional %315 %316 %324
1101 %319 = OpAccessChain %7 %41 %318
1102 %320 = OpLoad %6 %319
1103 %321 = OpConvertSToF %157 %320
1104 %322 = OpFMul %157 %321 %601
1105 %323 = OpFAdd %157 %255 %322
1108 %329 = OpSLessThan %31 %248 %328
1109 OpSelectionMerge %331 None
1110 OpBranchConditional %329 %330 %338
1112 %333 = OpAccessChain %7 %41 %332
1113 %334 = OpLoad %6 %333
1114 %335 = OpConvertSToF %157 %334
1115 %336 = OpFMul %157 %335 %601
1116 %337 = OpFAdd %157 %255 %336
1119 %343 = OpSLessThan %31 %248 %342
1120 OpSelectionMerge %345 None
1121 OpBranchConditional %343 %344 %352
1123 %347 = OpAccessChain %7 %41 %346
1124 %348 = OpLoad %6 %347
1125 %349 = OpConvertSToF %157 %348
1126 %350 = OpFMul %157 %349 %601
1127 %351 = OpFAdd %157 %255 %350
1130 %357 = OpSLessThan %31 %248 %356
1131 OpSelectionMerge %358 None
1132 OpBranchConditional %357 %358 %366
1134 %361 = OpAccessChain %7 %41 %360
1135 %362 = OpLoad %6 %361
1136 %363 = OpConvertSToF %157 %362
1137 %364 = OpFMul %157 %363 %601
1138 %365 = OpFAdd %157 %255 %364
1143 %577 = OpPhi %157 %351 %344 %365 %358
1146 %576 = OpPhi %157 %337 %330 %577 %345
1149 %575 = OpPhi %157 %323 %316 %576 %331
1150 %370 = OpAccessChain %163 %161 %105 %244
1151 %371 = OpLoad %157 %370
1152 %372 = OpFOrdGreaterThan %31 %165 %371
1153 OpSelectionMerge %374 None
1154 OpBranchConditional %372 %373 %374
1161 %566 = OpPhi %158 %381 %374 %560 %386
1162 %565 = OpPhi %6 %105 %374 %415 %386
1163 %390 = OpSLessThanEqual %31 %565 %389
1164 OpLoopMerge %385 %386 None
1165 OpBranchConditional %390 %384 %385
1167 %392 = OpCompositeExtract %157 %566 0
1168 %394 = OpFOrdLessThan %31 %392 %393
1169 OpSelectionMerge %396 None
1170 OpBranchConditional %394 %395 %396
1172 OpSelectionMerge %403 None
1173 OpBranchConditional %372 %402 %403
1177 %406 = OpCompositeExtract %157 %566 1
1178 %407 = OpFAdd %157 %406 %377
1179 %556 = OpCompositeInsert %158 %407 %566 1
1182 %567 = OpPhi %158 %566 %384 %556 %403
1183 %409 = OpCompositeExtract %157 %567 1
1184 %411 = OpCompositeExtract %157 %567 0
1185 %412 = OpFAdd %157 %411 %409
1186 %560 = OpCompositeInsert %158 %412 %567 0
1189 %415 = OpIAdd %6 %565 %22
1196 %572 = OpPhi %157 %300 %294 %575 %308
1199 %571 = OpPhi %157 %287 %281 %572 %295
1202 %570 = OpPhi %157 %274 %268 %571 %282
1205 %569 = OpPhi %157 %261 %251 %570 %269
1206 %422 = OpCompositeConstruct %241 %569 %569 %569 %377
1212 # uniforms for variant
1215 BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
1219 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
1221 PIPELINE graphics variant_pipeline
1222 ATTACH variant_vertex_shader
1223 ATTACH variant_fragment_shader
1224 FRAMEBUFFER_SIZE 256 256
1225 BIND BUFFER variant_framebuffer AS color LOCATION 0
1226 BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
1228 CLEAR_COLOR variant_pipeline 0 0 0 255
1230 CLEAR variant_pipeline
1231 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
1233 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005