Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / spv-stable-maze-O-memory-accesses.amber
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 extra memory accesses
21
22 # The test passes because both shaders render the same image.
23
24 SHADER vertex reference_vertex_shader PASSTHROUGH
25
26 SHADER 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: 653
31 ; Schema: 0
32                OpCapability Shader
33           %1 = OpExtInstImport "GLSL.std.450"
34                OpMemoryModel Logical GLSL450
35                OpEntryPoint Fragment %4 "main" %12 %435
36                OpExecutionMode %4 OriginUpperLeft
37                OpSource ESSL 320
38                OpName %4 "main"
39                OpName %12 "gl_FragCoord"
40                OpName %15 "buf0"
41                OpMemberName %15 0 "resolution"
42                OpName %17 ""
43                OpName %55 "map"
44                OpName %435 "_GLF_color"
45                OpDecorate %12 BuiltIn FragCoord
46                OpMemberDecorate %15 0 Offset 0
47                OpDecorate %15 Block
48                OpDecorate %17 DescriptorSet 0
49                OpDecorate %17 Binding 0
50                OpDecorate %435 Location 0
51           %2 = OpTypeVoid
52           %3 = OpTypeFunction %2
53           %6 = OpTypeFloat 32
54           %7 = OpTypeVector %6 2
55          %10 = OpTypeVector %6 4
56          %11 = OpTypePointer Input %10
57          %12 = OpVariable %11 Input
58          %15 = OpTypeStruct %7
59          %16 = OpTypePointer Uniform %15
60          %17 = OpVariable %16 Uniform
61          %18 = OpTypeInt 32 1
62          %19 = OpConstant %18 0
63          %20 = OpTypePointer Uniform %7
64          %24 = OpTypeVector %18 2
65          %27 = OpTypeInt 32 0
66          %28 = OpConstant %27 0
67          %32 = OpConstant %6 16
68          %41 = OpTypePointer Function %18
69          %49 = OpConstant %18 256
70          %50 = OpTypeBool
71          %52 = OpConstant %27 256
72          %53 = OpTypeArray %18 %52
73          %60 = OpConstant %18 1
74          %63 = OpConstantComposite %24 %19 %19
75          %66 = OpConstantTrue %50
76          %82 = OpConstant %18 2
77          %86 = OpConstant %18 16
78         %119 = OpConstant %18 14
79         %162 = OpConstantFalse %50
80         %169 = OpConstant %18 8
81         %434 = OpTypePointer Output %10
82         %435 = OpVariable %434 Output
83         %436 = OpConstant %6 1
84         %437 = OpConstantComposite %10 %436 %436 %436 %436
85         %440 = OpConstant %6 0
86         %441 = OpConstantComposite %10 %440 %440 %440 %436
87         %447 = OpTypePointer Function %53
88         %648 = OpConstant %18 32
89         %649 = OpUndef %24
90           %4 = OpFunction %2 None %3
91           %5 = OpLabel
92          %55 = OpVariable %447 Function
93                OpSelectionMerge %442 None
94                OpSwitch %28 %443
95         %443 = OpLabel
96          %13 = OpLoad %10 %12
97          %14 = OpVectorShuffle %7 %13 %13 0 1
98          %21 = OpAccessChain %20 %17 %19
99          %22 = OpLoad %7 %21
100          %23 = OpFDiv %7 %14 %22
101          %31 = OpCompositeExtract %6 %23 0
102          %33 = OpFMul %6 %31 %32
103          %34 = OpConvertFToS %18 %33
104          %37 = OpCompositeExtract %6 %23 1
105          %38 = OpFMul %6 %37 %32
106          %39 = OpConvertFToS %18 %38
107                OpBranch %43
108          %43 = OpLabel
109         %518 = OpPhi %18 %19 %443 %61 %44
110          %51 = OpSLessThan %50 %518 %49
111                OpLoopMerge %45 %44 None
112                OpBranchConditional %51 %44 %45
113          %44 = OpLabel
114          %58 = OpAccessChain %41 %55 %518
115                OpStore %58 %19
116          %61 = OpIAdd %18 %518 %60
117                OpBranch %43
118          %45 = OpLabel
119                OpBranch %68
120          %68 = OpLabel
121         %591 = OpPhi %50 %66 %45 %569 %71
122         %520 = OpPhi %24 %63 %45 %637 %71
123         %519 = OpPhi %18 %19 %45 %621 %71
124                OpLoopMerge %70 %71 None
125                OpBranch %69
126          %69 = OpLabel
127          %73 = OpIAdd %18 %519 %60
128          %76 = OpCompositeExtract %18 %520 0
129          %77 = OpSGreaterThan %50 %76 %19
130                OpSelectionMerge %79 None
131                OpBranchConditional %77 %78 %79
132          %78 = OpLabel
133          %83 = OpISub %18 %76 %82
134          %85 = OpCompositeExtract %18 %520 1
135          %87 = OpIMul %18 %85 %86
136          %88 = OpIAdd %18 %83 %87
137          %89 = OpAccessChain %41 %55 %88
138          %90 = OpLoad %18 %89
139          %91 = OpIEqual %50 %90 %19
140                OpBranch %79
141          %79 = OpLabel
142          %92 = OpPhi %50 %77 %69 %91 %78
143         %650 = OpSelect %18 %92 %60 %19
144          %98 = OpCompositeExtract %18 %520 1
145          %99 = OpSGreaterThan %50 %98 %19
146                OpSelectionMerge %101 None
147                OpBranchConditional %99 %100 %101
148         %100 = OpLabel
149         %106 = OpISub %18 %98 %82
150         %107 = OpIMul %18 %106 %86
151         %108 = OpIAdd %18 %76 %107
152         %109 = OpAccessChain %41 %55 %108
153         %110 = OpLoad %18 %109
154         %111 = OpIEqual %50 %110 %19
155                OpBranch %101
156         %101 = OpLabel
157         %112 = OpPhi %50 %99 %79 %111 %100
158                OpSelectionMerge %114 None
159                OpBranchConditional %112 %113 %114
160         %113 = OpLabel
161         %116 = OpIAdd %18 %650 %60
162                OpBranch %114
163         %114 = OpLabel
164         %529 = OpPhi %18 %650 %101 %116 %113
165         %120 = OpSLessThan %50 %76 %119
166                OpSelectionMerge %122 None
167                OpBranchConditional %120 %121 %122
168         %121 = OpLabel
169         %125 = OpIAdd %18 %76 %82
170         %128 = OpIMul %18 %98 %86
171         %129 = OpIAdd %18 %125 %128
172         %130 = OpAccessChain %41 %55 %129
173         %131 = OpLoad %18 %130
174         %132 = OpIEqual %50 %131 %19
175                OpBranch %122
176         %122 = OpLabel
177         %133 = OpPhi %50 %120 %114 %132 %121
178                OpSelectionMerge %135 None
179                OpBranchConditional %133 %134 %135
180         %134 = OpLabel
181         %137 = OpIAdd %18 %529 %60
182                OpBranch %135
183         %135 = OpLabel
184         %533 = OpPhi %18 %529 %122 %137 %134
185         %140 = OpSLessThan %50 %98 %119
186                OpSelectionMerge %142 None
187                OpBranchConditional %140 %141 %142
188         %141 = OpLabel
189         %147 = OpIAdd %18 %98 %82
190         %148 = OpIMul %18 %147 %86
191         %149 = OpIAdd %18 %76 %148
192         %150 = OpAccessChain %41 %55 %149
193         %151 = OpLoad %18 %150
194         %152 = OpIEqual %50 %151 %19
195                OpBranch %142
196         %142 = OpLabel
197         %153 = OpPhi %50 %140 %135 %152 %141
198                OpSelectionMerge %155 None
199                OpBranchConditional %153 %154 %155
200         %154 = OpLabel
201         %157 = OpIAdd %18 %533 %60
202                OpBranch %155
203         %155 = OpLabel
204         %534 = OpPhi %18 %533 %142 %157 %154
205         %159 = OpIEqual %50 %534 %19
206                OpSelectionMerge %161 None
207                OpBranchConditional %159 %160 %207
208         %160 = OpLabel
209                OpBranch %163
210         %163 = OpLabel
211         %570 = OpPhi %50 %162 %160 %639 %166
212         %568 = OpPhi %24 %520 %160 %619 %166
213         %567 = OpPhi %18 %19 %160 %199 %166
214         %170 = OpSLessThan %50 %567 %169
215                OpLoopMerge %165 %166 None
216                OpBranchConditional %170 %164 %165
217         %164 = OpLabel
218                OpBranch %172
219         %172 = OpLabel
220         %619 = OpPhi %24 %568 %164 %644 %175
221         %617 = OpPhi %18 %19 %164 %197 %175
222         %639 = OpPhi %50 %570 %164 %651 %175
223         %178 = OpSLessThan %50 %617 %169
224                OpLoopMerge %174 %175 None
225                OpBranchConditional %178 %173 %174
226         %173 = OpLabel
227         %180 = OpIMul %18 %617 %82
228         %182 = OpIMul %18 %567 %82
229         %183 = OpIMul %18 %567 %648
230         %184 = OpIAdd %18 %180 %183
231         %185 = OpAccessChain %41 %55 %184
232         %186 = OpLoad %18 %185
233         %187 = OpIEqual %50 %186 %19
234                OpSelectionMerge %189 None
235                OpBranchConditional %187 %188 %189
236         %188 = OpLabel
237         %463 = OpCompositeInsert %24 %180 %649 0
238         %465 = OpCompositeInsert %24 %182 %463 1
239                OpBranch %189
240         %189 = OpLabel
241         %644 = OpPhi %24 %619 %173 %465 %188
242         %651 = OpSelect %50 %187 %66 %639
243                OpBranch %175
244         %175 = OpLabel
245         %197 = OpIAdd %18 %617 %60
246                OpBranch %172
247         %174 = OpLabel
248                OpBranch %166
249         %166 = OpLabel
250         %199 = OpIAdd %18 %567 %60
251                OpBranch %163
252         %165 = OpLabel
253         %201 = OpCompositeExtract %18 %568 0
254         %203 = OpCompositeExtract %18 %568 1
255         %204 = OpIMul %18 %203 %86
256         %205 = OpIAdd %18 %201 %204
257         %206 = OpAccessChain %41 %55 %205
258                OpStore %206 %60
259                OpBranch %161
260         %207 = OpLabel
261         %211 = OpSMod %18 %73 %534
262         %214 = OpIAdd %18 %73 %534
263         %216 = OpSGreaterThanEqual %50 %211 %19
264         %652 = OpSelect %50 %216 %77 %216
265                OpSelectionMerge %224 None
266                OpBranchConditional %652 %223 %224
267         %223 = OpLabel
268         %227 = OpISub %18 %76 %82
269         %230 = OpIMul %18 %98 %86
270         %231 = OpIAdd %18 %227 %230
271         %232 = OpAccessChain %41 %55 %231
272         %233 = OpLoad %18 %232
273         %234 = OpIEqual %50 %233 %19
274                OpBranch %224
275         %224 = OpLabel
276         %235 = OpPhi %50 %652 %207 %234 %223
277                OpSelectionMerge %237 None
278                OpBranchConditional %235 %236 %237
279         %236 = OpLabel
280         %239 = OpISub %18 %211 %60
281         %244 = OpIMul %18 %98 %86
282         %245 = OpIAdd %18 %76 %244
283         %246 = OpAccessChain %41 %55 %245
284                OpStore %246 %60
285         %249 = OpISub %18 %76 %60
286         %253 = OpIAdd %18 %249 %244
287         %254 = OpAccessChain %41 %55 %253
288                OpStore %254 %60
289         %257 = OpISub %18 %76 %82
290         %261 = OpIAdd %18 %257 %244
291         %262 = OpAccessChain %41 %55 %261
292                OpStore %262 %60
293         %479 = OpCompositeInsert %24 %257 %520 0
294                OpBranch %237
295         %237 = OpLabel
296         %550 = OpPhi %24 %520 %224 %479 %236
297         %549 = OpPhi %18 %211 %224 %239 %236
298         %268 = OpSGreaterThanEqual %50 %549 %19
299                OpSelectionMerge %270 None
300                OpBranchConditional %268 %269 %270
301         %269 = OpLabel
302         %272 = OpCompositeExtract %18 %550 1
303         %273 = OpSGreaterThan %50 %272 %19
304                OpBranch %270
305         %270 = OpLabel
306         %274 = OpPhi %50 %268 %237 %273 %269
307                OpSelectionMerge %276 None
308                OpBranchConditional %274 %275 %276
309         %275 = OpLabel
310         %278 = OpCompositeExtract %18 %550 0
311         %280 = OpCompositeExtract %18 %550 1
312         %281 = OpISub %18 %280 %82
313         %282 = OpIMul %18 %281 %86
314         %283 = OpIAdd %18 %278 %282
315         %284 = OpAccessChain %41 %55 %283
316         %285 = OpLoad %18 %284
317         %286 = OpIEqual %50 %285 %19
318                OpBranch %276
319         %276 = OpLabel
320         %287 = OpPhi %50 %274 %270 %286 %275
321                OpSelectionMerge %289 None
322                OpBranchConditional %287 %288 %289
323         %288 = OpLabel
324         %291 = OpISub %18 %549 %60
325         %293 = OpCompositeExtract %18 %550 0
326         %295 = OpCompositeExtract %18 %550 1
327         %296 = OpIMul %18 %295 %86
328         %297 = OpIAdd %18 %293 %296
329         %298 = OpAccessChain %41 %55 %297
330                OpStore %298 %60
331         %303 = OpISub %18 %295 %60
332         %304 = OpIMul %18 %303 %86
333         %305 = OpIAdd %18 %293 %304
334         %306 = OpAccessChain %41 %55 %305
335                OpStore %306 %60
336         %311 = OpISub %18 %295 %82
337         %312 = OpIMul %18 %311 %86
338         %313 = OpIAdd %18 %293 %312
339         %314 = OpAccessChain %41 %55 %313
340                OpStore %314 %60
341         %491 = OpCompositeInsert %24 %311 %550 1
342                OpBranch %289
343         %289 = OpLabel
344         %556 = OpPhi %24 %550 %276 %491 %288
345         %555 = OpPhi %18 %549 %276 %291 %288
346         %320 = OpSGreaterThanEqual %50 %555 %19
347                OpSelectionMerge %322 None
348                OpBranchConditional %320 %321 %322
349         %321 = OpLabel
350         %324 = OpCompositeExtract %18 %556 0
351         %325 = OpSLessThan %50 %324 %119
352                OpBranch %322
353         %322 = OpLabel
354         %326 = OpPhi %50 %320 %289 %325 %321
355                OpSelectionMerge %328 None
356                OpBranchConditional %326 %327 %328
357         %327 = OpLabel
358         %330 = OpCompositeExtract %18 %556 0
359         %331 = OpIAdd %18 %330 %82
360         %333 = OpCompositeExtract %18 %556 1
361         %334 = OpIMul %18 %333 %86
362         %335 = OpIAdd %18 %331 %334
363         %336 = OpAccessChain %41 %55 %335
364         %337 = OpLoad %18 %336
365         %338 = OpIEqual %50 %337 %19
366                OpBranch %328
367         %328 = OpLabel
368         %339 = OpPhi %50 %326 %322 %338 %327
369                OpSelectionMerge %341 None
370                OpBranchConditional %339 %340 %341
371         %340 = OpLabel
372         %343 = OpISub %18 %555 %60
373         %345 = OpCompositeExtract %18 %556 0
374         %347 = OpCompositeExtract %18 %556 1
375         %348 = OpIMul %18 %347 %86
376         %349 = OpIAdd %18 %345 %348
377         %350 = OpAccessChain %41 %55 %349
378                OpStore %350 %60
379         %353 = OpIAdd %18 %345 %60
380         %357 = OpIAdd %18 %353 %348
381         %358 = OpAccessChain %41 %55 %357
382                OpStore %358 %60
383         %361 = OpIAdd %18 %345 %82
384         %365 = OpIAdd %18 %361 %348
385         %366 = OpAccessChain %41 %55 %365
386                OpStore %366 %60
387         %503 = OpCompositeInsert %24 %361 %556 0
388                OpBranch %341
389         %341 = OpLabel
390         %562 = OpPhi %24 %556 %328 %503 %340
391         %561 = OpPhi %18 %555 %328 %343 %340
392         %372 = OpSGreaterThanEqual %50 %561 %19
393                OpSelectionMerge %374 None
394                OpBranchConditional %372 %373 %374
395         %373 = OpLabel
396         %376 = OpCompositeExtract %18 %562 1
397         %377 = OpSLessThan %50 %376 %119
398                OpBranch %374
399         %374 = OpLabel
400         %378 = OpPhi %50 %372 %341 %377 %373
401                OpSelectionMerge %380 None
402                OpBranchConditional %378 %379 %380
403         %379 = OpLabel
404         %382 = OpCompositeExtract %18 %562 0
405         %384 = OpCompositeExtract %18 %562 1
406         %385 = OpIAdd %18 %384 %82
407         %386 = OpIMul %18 %385 %86
408         %387 = OpIAdd %18 %382 %386
409         %388 = OpAccessChain %41 %55 %387
410         %389 = OpLoad %18 %388
411         %390 = OpIEqual %50 %389 %19
412                OpBranch %380
413         %380 = OpLabel
414         %391 = OpPhi %50 %378 %374 %390 %379
415                OpSelectionMerge %393 None
416                OpBranchConditional %391 %392 %393
417         %392 = OpLabel
418         %397 = OpCompositeExtract %18 %562 0
419         %399 = OpCompositeExtract %18 %562 1
420         %400 = OpIMul %18 %399 %86
421         %401 = OpIAdd %18 %397 %400
422         %402 = OpAccessChain %41 %55 %401
423                OpStore %402 %60
424         %407 = OpIAdd %18 %399 %60
425         %408 = OpIMul %18 %407 %86
426         %409 = OpIAdd %18 %397 %408
427         %410 = OpAccessChain %41 %55 %409
428                OpStore %410 %60
429         %415 = OpIAdd %18 %399 %82
430         %416 = OpIMul %18 %415 %86
431         %417 = OpIAdd %18 %397 %416
432         %418 = OpAccessChain %41 %55 %417
433                OpStore %418 %60
434         %515 = OpCompositeInsert %24 %415 %562 1
435                OpBranch %393
436         %393 = OpLabel
437         %638 = OpPhi %24 %562 %380 %515 %392
438                OpBranch %161
439         %161 = OpLabel
440         %637 = OpPhi %24 %568 %165 %638 %393
441         %621 = OpPhi %18 %73 %165 %214 %393
442         %569 = OpPhi %50 %570 %165 %591 %393
443         %425 = OpIMul %18 %39 %86
444         %428 = OpIAdd %18 %425 %34
445         %429 = OpAccessChain %41 %55 %428
446         %430 = OpLoad %18 %429
447         %431 = OpIEqual %50 %430 %60
448                OpSelectionMerge %433 None
449                OpBranchConditional %431 %432 %433
450         %432 = OpLabel
451                OpStore %435 %437
452                OpBranch %70
453         %433 = OpLabel
454                OpBranch %71
455          %71 = OpLabel
456                OpBranchConditional %569 %68 %70
457          %70 = OpLabel
458         %592 = OpPhi %50 %66 %432 %162 %71
459                OpSelectionMerge %445 None
460                OpBranchConditional %592 %442 %445
461         %445 = OpLabel
462                OpStore %435 %441
463                OpBranch %442
464         %442 = OpLabel
465                OpReturn
466                OpFunctionEnd
467 END
468
469 # uniforms for reference
470
471 # resolution
472 BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
473  32.0 32.0
474 END
475
476 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
477
478 PIPELINE graphics reference_pipeline
479   ATTACH reference_vertex_shader
480   ATTACH reference_fragment_shader
481   FRAMEBUFFER_SIZE 32 32
482   BIND BUFFER reference_framebuffer AS color LOCATION 0
483   BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
484 END
485 CLEAR_COLOR reference_pipeline 0 0 0 255
486
487 CLEAR reference_pipeline
488 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 32
489
490
491 SHADER vertex variant_vertex_shader PASSTHROUGH
492
493 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
494 ; SPIR-V
495 ; Version: 1.0
496 ; Generator: Khronos Glslang Reference Front End; 7
497 ; Bound: 822
498 ; Schema: 0
499                OpCapability Shader
500           %1 = OpExtInstImport "GLSL.std.450"
501                OpMemoryModel Logical GLSL450
502                OpEntryPoint Fragment %4 "main" %12 %435
503                OpExecutionMode %4 OriginUpperLeft
504                OpSource ESSL 320
505                OpName %4 "main"
506                OpName %12 "gl_FragCoord"
507                OpName %15 "buf0"
508                OpMemberName %15 0 "resolution"
509                OpName %17 ""
510                OpName %55 "map"
511                OpName %435 "_GLF_color"
512                OpDecorate %12 BuiltIn FragCoord
513                OpMemberDecorate %15 0 Offset 0
514                OpDecorate %15 Block
515                OpDecorate %17 DescriptorSet 0
516                OpDecorate %17 Binding 0
517                OpDecorate %435 Location 0
518           %2 = OpTypeVoid
519           %3 = OpTypeFunction %2
520           %6 = OpTypeFloat 32
521           %7 = OpTypeVector %6 2
522          %10 = OpTypeVector %6 4
523          %11 = OpTypePointer Input %10
524          %12 = OpVariable %11 Input
525          %15 = OpTypeStruct %7
526          %16 = OpTypePointer Uniform %15
527          %17 = OpVariable %16 Uniform
528          %18 = OpTypeInt 32 1
529          %19 = OpConstant %18 0
530          %20 = OpTypePointer Uniform %7
531          %24 = OpTypeVector %18 2
532          %27 = OpTypeInt 32 0
533          %28 = OpConstant %27 0
534          %32 = OpConstant %6 16
535          %41 = OpTypePointer Function %18
536          %49 = OpConstant %18 256
537          %50 = OpTypeBool
538          %52 = OpConstant %27 256
539          %53 = OpTypeArray %18 %52
540          %60 = OpConstant %18 1
541          %63 = OpConstantComposite %24 %19 %19
542          %66 = OpConstantTrue %50
543          %82 = OpConstant %18 2
544          %86 = OpConstant %18 16
545         %119 = OpConstant %18 14
546         %162 = OpConstantFalse %50
547         %169 = OpConstant %18 8
548         %434 = OpTypePointer Output %10
549         %435 = OpVariable %434 Output
550         %436 = OpConstant %6 1
551         %437 = OpConstantComposite %10 %436 %436 %436 %436
552         %440 = OpConstant %6 0
553         %441 = OpConstantComposite %10 %440 %440 %440 %436
554         %447 = OpTypePointer Function %53
555         %648 = OpConstant %18 32
556         %649 = OpUndef %24
557         %753 = OpTypePointer Private %24
558         %754 = OpVariable %753 Private %63
559         %759 = OpTypePointer Private %18
560           %4 = OpFunction %2 None %3
561           %5 = OpLabel
562          %55 = OpVariable %447 Function
563                OpSelectionMerge %442 None
564                OpSwitch %28 %443
565         %443 = OpLabel
566          %13 = OpLoad %10 %12
567          %14 = OpVectorShuffle %7 %13 %13 0 1
568          %21 = OpAccessChain %20 %17 %19
569          %22 = OpLoad %7 %21
570          %23 = OpFDiv %7 %14 %22
571          %31 = OpCompositeExtract %6 %23 0
572          %33 = OpFMul %6 %31 %32
573          %34 = OpConvertFToS %18 %33
574          %37 = OpCompositeExtract %6 %23 1
575          %38 = OpFMul %6 %37 %32
576          %39 = OpConvertFToS %18 %38
577         %813 = OpULessThanEqual %50 %19 %60
578         %814 = OpSelect %18 %813 %19 %60
579         %815 = OpAccessChain %759 %754 %814
580                OpBranch %43
581          %43 = OpLabel
582         %518 = OpPhi %18 %19 %443 %61 %44
583          %51 = OpSLessThan %50 %518 %49
584                OpLoopMerge %45 %44 None
585                OpBranchConditional %51 %44 %45
586          %44 = OpLabel
587          %58 = OpAccessChain %41 %55 %518
588                OpStore %58 %19
589          %61 = OpIAdd %18 %518 %60
590                OpBranch %43
591          %45 = OpLabel
592                OpBranch %68
593          %68 = OpLabel
594         %591 = OpPhi %50 %66 %45 %569 %71
595         %520 = OpPhi %24 %63 %45 %637 %71
596         %519 = OpPhi %18 %19 %45 %621 %71
597         %821 = OpAccessChain %759 %815
598                OpLoopMerge %70 %71 None
599                OpBranch %69
600          %69 = OpLabel
601          %73 = OpIAdd %18 %519 %60
602                OpStore %754 %520
603         %755 = OpLoad %24 %754
604          %76 = OpCompositeExtract %18 %520 0
605          %77 = OpSGreaterThan %50 %76 %19
606                OpSelectionMerge %79 None
607                OpBranchConditional %77 %78 %79
608          %78 = OpLabel
609          %83 = OpISub %18 %76 %82
610          %85 = OpCompositeExtract %18 %520 1
611          %87 = OpIMul %18 %85 %86
612          %88 = OpIAdd %18 %83 %87
613          %89 = OpAccessChain %41 %55 %88
614          %90 = OpLoad %18 %89
615          %91 = OpIEqual %50 %90 %19
616                OpBranch %79
617          %79 = OpLabel
618          %92 = OpPhi %50 %77 %69 %91 %78
619         %650 = OpSelect %18 %92 %60 %19
620          %98 = OpCompositeExtract %18 %520 1
621          %99 = OpSGreaterThan %50 %98 %19
622                OpSelectionMerge %101 None
623                OpBranchConditional %99 %100 %101
624         %100 = OpLabel
625         %106 = OpISub %18 %98 %82
626         %107 = OpIMul %18 %106 %86
627         %108 = OpIAdd %18 %76 %107
628         %109 = OpAccessChain %41 %55 %108
629         %110 = OpLoad %18 %109
630         %111 = OpIEqual %50 %110 %19
631                OpBranch %101
632         %101 = OpLabel
633         %112 = OpPhi %50 %99 %79 %111 %100
634                OpSelectionMerge %114 None
635                OpBranchConditional %112 %113 %114
636         %113 = OpLabel
637         %116 = OpIAdd %18 %650 %60
638                OpBranch %114
639         %114 = OpLabel
640         %529 = OpPhi %18 %650 %101 %116 %113
641         %120 = OpSLessThan %50 %76 %119
642                OpSelectionMerge %122 None
643                OpBranchConditional %120 %121 %122
644         %121 = OpLabel
645         %125 = OpIAdd %18 %76 %82
646         %128 = OpIMul %18 %98 %86
647         %129 = OpIAdd %18 %125 %128
648         %130 = OpAccessChain %41 %55 %129
649         %131 = OpLoad %18 %130
650         %132 = OpIEqual %50 %131 %19
651                OpBranch %122
652         %122 = OpLabel
653         %133 = OpPhi %50 %120 %114 %132 %121
654                OpSelectionMerge %135 None
655                OpBranchConditional %133 %134 %135
656         %134 = OpLabel
657         %137 = OpIAdd %18 %529 %60
658                OpBranch %135
659         %135 = OpLabel
660         %533 = OpPhi %18 %529 %122 %137 %134
661         %140 = OpSLessThan %50 %98 %119
662                OpSelectionMerge %142 None
663                OpBranchConditional %140 %141 %142
664         %141 = OpLabel
665         %147 = OpIAdd %18 %98 %82
666         %148 = OpIMul %18 %147 %86
667         %149 = OpIAdd %18 %76 %148
668         %150 = OpAccessChain %41 %55 %149
669         %151 = OpLoad %18 %150
670         %152 = OpIEqual %50 %151 %19
671                OpBranch %142
672         %142 = OpLabel
673         %153 = OpPhi %50 %140 %135 %152 %141
674                OpSelectionMerge %155 None
675                OpBranchConditional %153 %154 %155
676         %154 = OpLabel
677         %157 = OpIAdd %18 %533 %60
678                OpBranch %155
679         %155 = OpLabel
680         %534 = OpPhi %18 %533 %142 %157 %154
681         %159 = OpIEqual %50 %534 %19
682                OpSelectionMerge %161 None
683                OpBranchConditional %159 %160 %207
684         %160 = OpLabel
685                OpBranch %163
686         %163 = OpLabel
687         %570 = OpPhi %50 %162 %160 %639 %166
688         %568 = OpPhi %24 %520 %160 %619 %166
689         %567 = OpPhi %18 %19 %160 %199 %166
690         %170 = OpSLessThan %50 %567 %169
691                OpLoopMerge %165 %166 None
692                OpBranchConditional %170 %164 %165
693         %164 = OpLabel
694                OpBranch %172
695         %172 = OpLabel
696         %619 = OpPhi %24 %568 %164 %644 %175
697         %617 = OpPhi %18 %19 %164 %197 %175
698         %639 = OpPhi %50 %570 %164 %651 %175
699         %178 = OpSLessThan %50 %617 %169
700                OpLoopMerge %174 %175 None
701                OpBranchConditional %178 %173 %174
702         %173 = OpLabel
703         %180 = OpIMul %18 %617 %82
704         %182 = OpIMul %18 %567 %82
705         %183 = OpIMul %18 %567 %648
706         %184 = OpIAdd %18 %180 %183
707         %185 = OpAccessChain %41 %55 %184
708         %186 = OpLoad %18 %185
709         %187 = OpIEqual %50 %186 %19
710                OpSelectionMerge %189 None
711                OpBranchConditional %187 %188 %189
712         %188 = OpLabel
713         %463 = OpCompositeInsert %24 %180 %649 0
714         %465 = OpCompositeInsert %24 %182 %463 1
715                OpBranch %189
716         %189 = OpLabel
717         %644 = OpPhi %24 %619 %173 %465 %188
718         %651 = OpSelect %50 %187 %66 %639
719                OpBranch %175
720         %175 = OpLabel
721         %197 = OpIAdd %18 %617 %60
722                OpBranch %172
723         %174 = OpLabel
724                OpBranch %166
725         %166 = OpLabel
726         %199 = OpIAdd %18 %567 %60
727                OpBranch %163
728         %165 = OpLabel
729         %201 = OpCompositeExtract %18 %568 0
730         %203 = OpCompositeExtract %18 %568 1
731         %204 = OpIMul %18 %203 %86
732         %205 = OpIAdd %18 %201 %204
733         %206 = OpAccessChain %41 %55 %205
734                OpStore %206 %60
735                OpBranch %161
736         %207 = OpLabel
737         %211 = OpSMod %18 %73 %534
738         %214 = OpIAdd %18 %73 %534
739         %216 = OpSGreaterThanEqual %50 %211 %19
740         %652 = OpSelect %50 %216 %77 %216
741                OpSelectionMerge %224 None
742                OpBranchConditional %652 %223 %224
743         %223 = OpLabel
744         %227 = OpISub %18 %76 %82
745         %230 = OpIMul %18 %98 %86
746         %231 = OpIAdd %18 %227 %230
747         %232 = OpAccessChain %41 %55 %231
748         %233 = OpLoad %18 %232
749         %234 = OpIEqual %50 %233 %19
750                OpBranch %224
751         %224 = OpLabel
752         %235 = OpPhi %50 %652 %207 %234 %223
753                OpSelectionMerge %237 None
754                OpBranchConditional %235 %236 %237
755         %236 = OpLabel
756         %239 = OpISub %18 %211 %60
757         %244 = OpIMul %18 %98 %86
758         %245 = OpIAdd %18 %76 %244
759         %246 = OpAccessChain %41 %55 %245
760                OpStore %246 %60
761         %249 = OpISub %18 %76 %60
762         %253 = OpIAdd %18 %249 %244
763         %254 = OpAccessChain %41 %55 %253
764                OpStore %254 %60
765         %257 = OpISub %18 %76 %82
766         %261 = OpIAdd %18 %257 %244
767         %262 = OpAccessChain %41 %55 %261
768                OpStore %262 %60
769         %479 = OpCompositeInsert %24 %257 %520 0
770                OpBranch %237
771         %237 = OpLabel
772         %550 = OpPhi %24 %520 %224 %479 %236
773         %549 = OpPhi %18 %211 %224 %239 %236
774         %268 = OpSGreaterThanEqual %50 %549 %19
775                OpSelectionMerge %270 None
776                OpBranchConditional %268 %269 %270
777         %269 = OpLabel
778         %272 = OpCompositeExtract %18 %550 1
779         %273 = OpSGreaterThan %50 %272 %19
780                OpBranch %270
781         %270 = OpLabel
782         %274 = OpPhi %50 %268 %237 %273 %269
783                OpSelectionMerge %276 None
784                OpBranchConditional %274 %275 %276
785         %275 = OpLabel
786         %278 = OpCompositeExtract %18 %550 0
787         %280 = OpCompositeExtract %18 %550 1
788         %281 = OpISub %18 %280 %82
789         %282 = OpIMul %18 %281 %86
790         %283 = OpIAdd %18 %278 %282
791         %284 = OpAccessChain %41 %55 %283
792         %285 = OpLoad %18 %284
793         %286 = OpIEqual %50 %285 %19
794                OpBranch %276
795         %276 = OpLabel
796         %287 = OpPhi %50 %274 %270 %286 %275
797                OpSelectionMerge %289 None
798                OpBranchConditional %287 %288 %289
799         %288 = OpLabel
800         %291 = OpISub %18 %549 %60
801         %293 = OpCompositeExtract %18 %550 0
802         %295 = OpCompositeExtract %18 %550 1
803         %296 = OpIMul %18 %295 %86
804         %297 = OpIAdd %18 %293 %296
805         %298 = OpAccessChain %41 %55 %297
806                OpStore %298 %60
807         %303 = OpISub %18 %295 %60
808         %304 = OpIMul %18 %303 %86
809         %305 = OpIAdd %18 %293 %304
810         %306 = OpAccessChain %41 %55 %305
811                OpStore %306 %60
812         %311 = OpISub %18 %295 %82
813         %312 = OpIMul %18 %311 %86
814         %313 = OpIAdd %18 %293 %312
815         %314 = OpAccessChain %41 %55 %313
816                OpStore %314 %60
817         %491 = OpCompositeInsert %24 %311 %550 1
818                OpBranch %289
819         %289 = OpLabel
820         %556 = OpPhi %24 %550 %276 %491 %288
821         %555 = OpPhi %18 %549 %276 %291 %288
822         %320 = OpSGreaterThanEqual %50 %555 %19
823                OpSelectionMerge %322 None
824                OpBranchConditional %320 %321 %322
825         %321 = OpLabel
826         %324 = OpCompositeExtract %18 %556 0
827         %325 = OpSLessThan %50 %324 %119
828                OpBranch %322
829         %322 = OpLabel
830         %326 = OpPhi %50 %320 %289 %325 %321
831                OpSelectionMerge %328 None
832                OpBranchConditional %326 %327 %328
833         %327 = OpLabel
834         %330 = OpCompositeExtract %18 %556 0
835         %331 = OpIAdd %18 %330 %82
836         %333 = OpCompositeExtract %18 %556 1
837         %334 = OpIMul %18 %333 %86
838         %335 = OpIAdd %18 %331 %334
839         %336 = OpAccessChain %41 %55 %335
840         %337 = OpLoad %18 %336
841         %338 = OpIEqual %50 %337 %19
842                OpBranch %328
843         %328 = OpLabel
844         %339 = OpPhi %50 %326 %322 %338 %327
845                OpSelectionMerge %341 None
846                OpBranchConditional %339 %340 %341
847         %340 = OpLabel
848         %343 = OpISub %18 %555 %60
849         %345 = OpCompositeExtract %18 %556 0
850         %347 = OpCompositeExtract %18 %556 1
851         %348 = OpIMul %18 %347 %86
852         %349 = OpIAdd %18 %345 %348
853         %350 = OpAccessChain %41 %55 %349
854                OpStore %350 %60
855         %353 = OpIAdd %18 %345 %60
856         %357 = OpIAdd %18 %353 %348
857         %358 = OpAccessChain %41 %55 %357
858                OpStore %358 %60
859         %361 = OpIAdd %18 %345 %82
860         %365 = OpIAdd %18 %361 %348
861         %366 = OpAccessChain %41 %55 %365
862                OpStore %366 %60
863         %503 = OpCompositeInsert %24 %361 %556 0
864                OpBranch %341
865         %341 = OpLabel
866         %562 = OpPhi %24 %556 %328 %503 %340
867         %561 = OpPhi %18 %555 %328 %343 %340
868         %372 = OpSGreaterThanEqual %50 %561 %19
869                OpSelectionMerge %374 None
870                OpBranchConditional %372 %373 %374
871         %373 = OpLabel
872         %376 = OpCompositeExtract %18 %562 1
873         %377 = OpSLessThan %50 %376 %119
874                OpBranch %374
875         %374 = OpLabel
876         %378 = OpPhi %50 %372 %341 %377 %373
877                OpSelectionMerge %380 None
878                OpBranchConditional %378 %379 %380
879         %379 = OpLabel
880         %382 = OpCompositeExtract %18 %562 0
881         %384 = OpCompositeExtract %18 %562 1
882         %385 = OpIAdd %18 %384 %82
883         %386 = OpIMul %18 %385 %86
884         %387 = OpIAdd %18 %382 %386
885         %388 = OpAccessChain %41 %55 %387
886         %389 = OpLoad %18 %388
887         %390 = OpIEqual %50 %389 %19
888                OpBranch %380
889         %380 = OpLabel
890         %391 = OpPhi %50 %378 %374 %390 %379
891                OpSelectionMerge %393 None
892                OpBranchConditional %391 %392 %393
893         %392 = OpLabel
894         %397 = OpCompositeExtract %18 %562 0
895         %399 = OpCompositeExtract %18 %562 1
896         %400 = OpIMul %18 %399 %86
897         %401 = OpIAdd %18 %397 %400
898         %402 = OpAccessChain %41 %55 %401
899                OpStore %402 %60
900         %407 = OpIAdd %18 %399 %60
901         %408 = OpIMul %18 %407 %86
902         %409 = OpIAdd %18 %397 %408
903         %410 = OpAccessChain %41 %55 %409
904                OpStore %410 %60
905         %415 = OpIAdd %18 %399 %82
906         %416 = OpIMul %18 %415 %86
907         %417 = OpIAdd %18 %397 %416
908         %418 = OpAccessChain %41 %55 %417
909                OpStore %418 %60
910         %515 = OpCompositeInsert %24 %415 %562 1
911                OpBranch %393
912         %393 = OpLabel
913         %638 = OpPhi %24 %562 %380 %515 %392
914                OpBranch %161
915         %161 = OpLabel
916         %637 = OpPhi %24 %568 %165 %638 %393
917         %621 = OpPhi %18 %73 %165 %214 %393
918         %569 = OpPhi %50 %570 %165 %591 %393
919         %425 = OpIMul %18 %39 %86
920         %428 = OpIAdd %18 %425 %34
921         %429 = OpAccessChain %41 %55 %428
922         %430 = OpLoad %18 %429
923         %431 = OpIEqual %50 %430 %60
924                OpSelectionMerge %433 None
925                OpBranchConditional %431 %432 %433
926         %432 = OpLabel
927                OpStore %435 %437
928                OpBranch %70
929         %433 = OpLabel
930                OpBranch %71
931          %71 = OpLabel
932                OpBranchConditional %569 %68 %70
933          %70 = OpLabel
934         %592 = OpPhi %50 %66 %432 %162 %71
935                OpSelectionMerge %445 None
936                OpBranchConditional %592 %442 %445
937         %445 = OpLabel
938                OpStore %435 %441
939                OpBranch %442
940         %442 = OpLabel
941                OpReturn
942                OpFunctionEnd
943 END
944
945 # uniforms for variant
946
947 # resolution
948 BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
949  32.0 32.0
950 END
951
952 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
953
954 PIPELINE graphics variant_pipeline
955   ATTACH variant_vertex_shader
956   ATTACH variant_fragment_shader
957   FRAMEBUFFER_SIZE 32 32
958   BIND BUFFER variant_framebuffer AS color LOCATION 0
959   BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
960 END
961 CLEAR_COLOR variant_pipeline 0 0 0 255
962
963 CLEAR variant_pipeline
964 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
965
966 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005