• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2
3# Copyright 2022 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 coverage-gap found by the GraphicsFuzz project.
19
20# Short description: A fragment shader that covers specific LLVM code paths
21
22# The test passes because the shader always writes red.
23
24SHADER vertex variant_vertex_shader PASSTHROUGH
25
26# variant_fragment_shader is derived from the following GLSL:
27# #version 320 es
28# #define _int_3 _GLF_uniform_int_values[0]
29# #define _int_1 _GLF_uniform_int_values[1]
30# #define _int_2 _GLF_uniform_int_values[2]
31# #define _int_4 _GLF_uniform_int_values[3]
32# #define _int_14 _GLF_uniform_int_values[4]
33# #define _int_15 _GLF_uniform_int_values[5]
34# #define _int_16 _GLF_uniform_int_values[6]
35# #define _int_17 _GLF_uniform_int_values[7]
36# #define _int_18 _GLF_uniform_int_values[8]
37# #define _int_19 _GLF_uniform_int_values[9]
38# #define _int_10 _GLF_uniform_int_values[10]
39# #define _int_0 _GLF_uniform_int_values[11]
40# #define _int_9 _GLF_uniform_int_values[12]
41# #define _int_5 _GLF_uniform_int_values[13]
42# #define _int_6 _GLF_uniform_int_values[14]
43# #define _int_7 _GLF_uniform_int_values[15]
44# #define _int_8 _GLF_uniform_int_values[16]
45# #define _float_1_0 _GLF_uniform_float_values[0]
46#
47# precision highp float;
48# precision highp int;
49#
50# // Contents of _GLF_uniform_float_values: 1.0
51# layout(set = 0, binding = 0) uniform buf0
52# {
53#     float _GLF_uniform_float_values[1];
54# };
55#
56# // Contents of _GLF_uniform_int_values: [3, 1, 2, 4, 14, 15, 16, 17, 18, 19, 10, 0, 9, 5, 6, 7, 8]
57# layout(set = 0, binding = 1) uniform buf1
58# {
59#     int _GLF_uniform_int_values[17];
60# };
61#
62# // Contents of two: 2.0
63# layout(set = 0, binding = 2) uniform buf2
64# {
65#     float two;
66# };
67#
68# struct S
69# {
70#     int data;
71#     int leftIndex;
72#     int rightIndex;
73# };
74#
75# layout(location = 0) out vec4 _GLF_color;
76#
77# int data0[10] = int[10](0, 1, 2, 3, 4, 5, 6, 7, 8, 9), data1[10] = int[10](10, 11, 12, 13, 14, 15, 16, 17, 18, 19);
78#
79# void func0(int from, int mid, int to)
80# {
81#     int k = _int_1, i = 1, j = _int_1;
82#
83#     while(i <= mid)
84#     {
85#         if(i <= j)
86#         {
87#             _GLF_color = vec4(_int_1);
88#
89#             int a = - _int_1;
90#
91#             // Iterates once.
92#             while(a != _int_1)
93#             {
94#                 a = S[10](S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3), S(_int_1, _int_2, _int_3))[clamp(a, _int_0, _int_9)].data;
95#             }
96#         }
97#         else
98#         {
99#             data1[k++] = data0[j++];
100#         }
101#
102#         i++;
103#     }
104#
105#     while(i < 5 && k < _int_10)
106#     {
107#         data1[k++] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9)[i++];
108#     }
109#
110#     for(int i = from; i <= to - 1; i++)
111#     {
112#         data0[i] = data1[i];
113#     }
114# }
115#
116# int func1()
117# {
118#     int a = _int_1;
119#
120#     for(int i = 1; i < 10; i *= 2)
121#     {
122#         for(int j = 1; j < 10; j += i)
123#         {
124#             func0(i, j, min(i + j, 10));
125#         }
126#
127#         while(a < _int_5)
128#         {
129#             // v becomes (0, 0).
130#             ivec2 v = ivec2(vec2(_float_1_0) / two);
131#
132#             // This loop is never iterated.
133#             while(v.x + v.y > _int_2)
134#             {
135#             }
136#
137#             a++;
138#         }
139#     }
140#     return a;
141# }
142#
143# void main()
144# {
145#     _GLF_color = vec4(_int_0);
146#
147#     // Always true.
148#     if(func1() == _int_5)
149#     {
150#         _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
151#     }
152#
153#     /*
154#     This python script was used to generate the reference values:
155#
156#     data0 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
157#     data1 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
158#
159#     def func0(x, y, z):
160#         global data0
161#         global data1
162#         k = 1
163#         i = 1
164#         j = 1
165#
166#         while i <= y:
167#             if i > j:
168#                 data1[k] = data0[j]
169#                 k = k + 1
170#                 j = j + 1
171#             i = i + 1
172#
173#         while i < 5 and k < 10:
174#             data1[k] = i
175#             k = k + 1
176#             i = i + 1
177#
178#        for i in range(x, z):
179#             data0[i] = data1[i]
180#
181#     def func1():
182#         a = 1
183#         i = 1
184#
185#         while i < 10:
186#             j = 1
187#             while j < 10:
188#                 func0(i, j, min(i + j, 10))
189#                 j = i + j
190#             while a < 5:
191#                 a = a + 1
192#             i = 2 * i
193#         return a
194#
195#        print(func1())
196#        print(data0)
197#        print(data1)
198#     */
199#
200#     int ref0[10] = int[10](_int_0, _int_2, _int_3, _int_4, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19);
201#     int ref1[10] = int[10](_int_10, _int_2, _int_3, _int_4, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19);
202#
203#     // Verify the global arrays against reference and set output to zero if the check fails.
204#     for(int i = _int_0; i < _int_10; i++)
205#     {
206#         if(data0[i] != ref0[i] || data1[i] != ref1[i])
207#         {
208#             _GLF_color = vec4(_int_0);
209#         }
210#     }
211# }
212SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
213; SPIR-V
214; Version: 1.0
215; Generator: Khronos Glslang Reference Front End; 10
216; Bound: 437
217; Schema: 0
218               OpCapability Shader
219          %1 = OpExtInstImport "GLSL.std.450"
220               OpMemoryModel Logical GLSL450
221               OpEntryPoint Fragment %4 "main" %75
222               OpExecutionMode %4 OriginUpperLeft
223               OpSource ESSL 320
224               OpName %4 "main"
225               OpName %12 "func0(i1;i1;i1;"
226               OpName %9 "from"
227               OpName %10 "mid"
228               OpName %11 "to"
229               OpName %15 "func1("
230               OpName %21 "data0"
231               OpName %33 "data1"
232               OpName %45 "k"
233               OpName %48 "buf1"
234               OpMemberName %48 0 "_GLF_uniform_int_values"
235               OpName %50 ""
236               OpName %54 "i"
237               OpName %55 "j"
238               OpName %75 "_GLF_color"
239               OpName %80 "a"
240               OpName %99 "S"
241               OpMemberName %99 0 "data"
242               OpMemberName %99 1 "leftIndex"
243               OpMemberName %99 2 "rightIndex"
244               OpName %173 "indexable"
245               OpName %227 "indexable"
246               OpName %231 "i"
247               OpName %249 "a"
248               OpName %252 "i"
249               OpName %260 "j"
250               OpName %272 "param"
251               OpName %274 "param"
252               OpName %276 "param"
253               OpName %292 "v"
254               OpName %295 "buf0"
255               OpMemberName %295 0 "_GLF_uniform_float_values"
256               OpName %297 ""
257               OpName %303 "buf2"
258               OpMemberName %303 0 "two"
259               OpName %305 ""
260               OpName %355 "ref0"
261               OpName %377 "ref1"
262               OpName %399 "i"
263               OpDecorate %47 ArrayStride 16
264               OpMemberDecorate %48 0 Offset 0
265               OpDecorate %48 Block
266               OpDecorate %50 DescriptorSet 0
267               OpDecorate %50 Binding 1
268               OpDecorate %75 Location 0
269               OpDecorate %294 ArrayStride 16
270               OpMemberDecorate %295 0 Offset 0
271               OpDecorate %295 Block
272               OpDecorate %297 DescriptorSet 0
273               OpDecorate %297 Binding 0
274               OpMemberDecorate %303 0 Offset 0
275               OpDecorate %303 Block
276               OpDecorate %305 DescriptorSet 0
277               OpDecorate %305 Binding 2
278          %2 = OpTypeVoid
279          %3 = OpTypeFunction %2
280          %6 = OpTypeInt 32 1
281          %7 = OpTypePointer Function %6
282          %8 = OpTypeFunction %2 %7 %7 %7
283         %14 = OpTypeFunction %6
284         %17 = OpTypeInt 32 0
285         %18 = OpConstant %17 10
286         %19 = OpTypeArray %6 %18
287         %20 = OpTypePointer Private %19
288         %21 = OpVariable %20 Private
289         %22 = OpConstant %6 0
290         %23 = OpConstant %6 1
291         %24 = OpConstant %6 2
292         %25 = OpConstant %6 3
293         %26 = OpConstant %6 4
294         %27 = OpConstant %6 5
295         %28 = OpConstant %6 6
296         %29 = OpConstant %6 7
297         %30 = OpConstant %6 8
298         %31 = OpConstant %6 9
299         %32 = OpConstantComposite %19 %22 %23 %24 %25 %26 %27 %28 %29 %30 %31
300         %33 = OpVariable %20 Private
301         %34 = OpConstant %6 10
302         %35 = OpConstant %6 11
303         %36 = OpConstant %6 12
304         %37 = OpConstant %6 13
305         %38 = OpConstant %6 14
306         %39 = OpConstant %6 15
307         %40 = OpConstant %6 16
308         %41 = OpConstant %6 17
309         %42 = OpConstant %6 18
310         %43 = OpConstant %6 19
311         %44 = OpConstantComposite %19 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43
312         %46 = OpConstant %17 17
313         %47 = OpTypeArray %6 %46
314         %48 = OpTypeStruct %47
315         %49 = OpTypePointer Uniform %48
316         %50 = OpVariable %49 Uniform
317         %51 = OpTypePointer Uniform %6
318         %65 = OpTypeBool
319         %72 = OpTypeFloat 32
320         %73 = OpTypeVector %72 4
321         %74 = OpTypePointer Output %73
322         %75 = OpVariable %74 Output
323         %99 = OpTypeStruct %6 %6 %6
324        %164 = OpTypeArray %99 %18
325        %172 = OpTypePointer Function %164
326        %181 = OpTypePointer Private %6
327        %226 = OpTypePointer Function %19
328        %290 = OpTypeVector %6 2
329        %291 = OpTypePointer Function %290
330        %293 = OpConstant %17 1
331        %294 = OpTypeArray %72 %293
332        %295 = OpTypeStruct %294
333        %296 = OpTypePointer Uniform %295
334        %297 = OpVariable %296 Uniform
335        %298 = OpTypePointer Uniform %72
336        %301 = OpTypeVector %72 2
337        %303 = OpTypeStruct %72
338        %304 = OpTypePointer Uniform %303
339        %305 = OpVariable %304 Uniform
340        %316 = OpConstant %17 0
341          %4 = OpFunction %2 None %3
342          %5 = OpLabel
343        %355 = OpVariable %226 Function
344        %377 = OpVariable %226 Function
345        %399 = OpVariable %7 Function
346               OpStore %21 %32
347               OpStore %33 %44
348        %332 = OpAccessChain %51 %50 %22 %35
349        %333 = OpLoad %6 %332
350        %334 = OpConvertSToF %72 %333
351        %335 = OpCompositeConstruct %73 %334 %334 %334 %334
352               OpStore %75 %335
353        %336 = OpFunctionCall %6 %15
354        %337 = OpAccessChain %51 %50 %22 %37
355        %338 = OpLoad %6 %337
356        %339 = OpIEqual %65 %336 %338
357               OpSelectionMerge %341 None
358               OpBranchConditional %339 %340 %341
359        %340 = OpLabel
360        %342 = OpAccessChain %51 %50 %22 %23
361        %343 = OpLoad %6 %342
362        %344 = OpConvertSToF %72 %343
363        %345 = OpAccessChain %51 %50 %22 %35
364        %346 = OpLoad %6 %345
365        %347 = OpConvertSToF %72 %346
366        %348 = OpAccessChain %51 %50 %22 %35
367        %349 = OpLoad %6 %348
368        %350 = OpConvertSToF %72 %349
369        %351 = OpAccessChain %51 %50 %22 %23
370        %352 = OpLoad %6 %351
371        %353 = OpConvertSToF %72 %352
372        %354 = OpCompositeConstruct %73 %344 %347 %350 %353
373               OpStore %75 %354
374               OpBranch %341
375        %341 = OpLabel
376        %356 = OpAccessChain %51 %50 %22 %35
377        %357 = OpLoad %6 %356
378        %358 = OpAccessChain %51 %50 %22 %24
379        %359 = OpLoad %6 %358
380        %360 = OpAccessChain %51 %50 %22 %22
381        %361 = OpLoad %6 %360
382        %362 = OpAccessChain %51 %50 %22 %25
383        %363 = OpLoad %6 %362
384        %364 = OpAccessChain %51 %50 %22 %26
385        %365 = OpLoad %6 %364
386        %366 = OpAccessChain %51 %50 %22 %27
387        %367 = OpLoad %6 %366
388        %368 = OpAccessChain %51 %50 %22 %28
389        %369 = OpLoad %6 %368
390        %370 = OpAccessChain %51 %50 %22 %29
391        %371 = OpLoad %6 %370
392        %372 = OpAccessChain %51 %50 %22 %30
393        %373 = OpLoad %6 %372
394        %374 = OpAccessChain %51 %50 %22 %31
395        %375 = OpLoad %6 %374
396        %376 = OpCompositeConstruct %19 %357 %359 %361 %363 %365 %367 %369 %371 %373 %375
397               OpStore %355 %376
398        %378 = OpAccessChain %51 %50 %22 %34
399        %379 = OpLoad %6 %378
400        %380 = OpAccessChain %51 %50 %22 %24
401        %381 = OpLoad %6 %380
402        %382 = OpAccessChain %51 %50 %22 %22
403        %383 = OpLoad %6 %382
404        %384 = OpAccessChain %51 %50 %22 %25
405        %385 = OpLoad %6 %384
406        %386 = OpAccessChain %51 %50 %22 %26
407        %387 = OpLoad %6 %386
408        %388 = OpAccessChain %51 %50 %22 %27
409        %389 = OpLoad %6 %388
410        %390 = OpAccessChain %51 %50 %22 %28
411        %391 = OpLoad %6 %390
412        %392 = OpAccessChain %51 %50 %22 %29
413        %393 = OpLoad %6 %392
414        %394 = OpAccessChain %51 %50 %22 %30
415        %395 = OpLoad %6 %394
416        %396 = OpAccessChain %51 %50 %22 %31
417        %397 = OpLoad %6 %396
418        %398 = OpCompositeConstruct %19 %379 %381 %383 %385 %387 %389 %391 %393 %395 %397
419               OpStore %377 %398
420        %400 = OpAccessChain %51 %50 %22 %35
421        %401 = OpLoad %6 %400
422               OpStore %399 %401
423               OpBranch %402
424        %402 = OpLabel
425               OpLoopMerge %404 %405 None
426               OpBranch %406
427        %406 = OpLabel
428        %407 = OpLoad %6 %399
429        %408 = OpAccessChain %51 %50 %22 %34
430        %409 = OpLoad %6 %408
431        %410 = OpSLessThan %65 %407 %409
432               OpBranchConditional %410 %403 %404
433        %403 = OpLabel
434        %411 = OpLoad %6 %399
435        %412 = OpAccessChain %181 %21 %411
436        %413 = OpLoad %6 %412
437        %414 = OpLoad %6 %399
438        %415 = OpAccessChain %7 %355 %414
439        %416 = OpLoad %6 %415
440        %417 = OpINotEqual %65 %413 %416
441        %418 = OpLogicalNot %65 %417
442               OpSelectionMerge %420 None
443               OpBranchConditional %418 %419 %420
444        %419 = OpLabel
445        %421 = OpLoad %6 %399
446        %422 = OpAccessChain %181 %33 %421
447        %423 = OpLoad %6 %422
448        %424 = OpLoad %6 %399
449        %425 = OpAccessChain %7 %377 %424
450        %426 = OpLoad %6 %425
451        %427 = OpINotEqual %65 %423 %426
452               OpBranch %420
453        %420 = OpLabel
454        %428 = OpPhi %65 %417 %403 %427 %419
455               OpSelectionMerge %430 None
456               OpBranchConditional %428 %429 %430
457        %429 = OpLabel
458        %431 = OpAccessChain %51 %50 %22 %35
459        %432 = OpLoad %6 %431
460        %433 = OpConvertSToF %72 %432
461        %434 = OpCompositeConstruct %73 %433 %433 %433 %433
462               OpStore %75 %434
463               OpBranch %430
464        %430 = OpLabel
465               OpBranch %405
466        %405 = OpLabel
467        %435 = OpLoad %6 %399
468        %436 = OpIAdd %6 %435 %23
469               OpStore %399 %436
470               OpBranch %402
471        %404 = OpLabel
472               OpReturn
473               OpFunctionEnd
474         %12 = OpFunction %2 None %8
475          %9 = OpFunctionParameter %7
476         %10 = OpFunctionParameter %7
477         %11 = OpFunctionParameter %7
478         %13 = OpLabel
479         %45 = OpVariable %7 Function
480         %54 = OpVariable %7 Function
481         %55 = OpVariable %7 Function
482         %80 = OpVariable %7 Function
483        %173 = OpVariable %172 Function
484        %227 = OpVariable %226 Function
485        %231 = OpVariable %7 Function
486         %52 = OpAccessChain %51 %50 %22 %23
487         %53 = OpLoad %6 %52
488               OpStore %45 %53
489               OpStore %54 %23
490         %56 = OpAccessChain %51 %50 %22 %23
491         %57 = OpLoad %6 %56
492               OpStore %55 %57
493               OpBranch %58
494         %58 = OpLabel
495               OpLoopMerge %60 %61 None
496               OpBranch %62
497         %62 = OpLabel
498         %63 = OpLoad %6 %54
499         %64 = OpLoad %6 %10
500         %66 = OpSLessThanEqual %65 %63 %64
501               OpBranchConditional %66 %59 %60
502         %59 = OpLabel
503         %67 = OpLoad %6 %54
504         %68 = OpLoad %6 %55
505         %69 = OpSLessThanEqual %65 %67 %68
506               OpSelectionMerge %71 None
507               OpBranchConditional %69 %70 %176
508         %70 = OpLabel
509         %76 = OpAccessChain %51 %50 %22 %23
510         %77 = OpLoad %6 %76
511         %78 = OpConvertSToF %72 %77
512         %79 = OpCompositeConstruct %73 %78 %78 %78 %78
513               OpStore %75 %79
514         %81 = OpAccessChain %51 %50 %22 %23
515         %82 = OpLoad %6 %81
516         %83 = OpSNegate %6 %82
517               OpStore %80 %83
518               OpBranch %84
519         %84 = OpLabel
520               OpLoopMerge %86 %87 None
521               OpBranch %88
522         %88 = OpLabel
523         %89 = OpLoad %6 %80
524         %90 = OpAccessChain %51 %50 %22 %23
525         %91 = OpLoad %6 %90
526         %92 = OpINotEqual %65 %89 %91
527               OpBranchConditional %92 %85 %86
528         %85 = OpLabel
529         %93 = OpAccessChain %51 %50 %22 %23
530         %94 = OpLoad %6 %93
531         %95 = OpAccessChain %51 %50 %22 %24
532         %96 = OpLoad %6 %95
533         %97 = OpAccessChain %51 %50 %22 %22
534         %98 = OpLoad %6 %97
535        %100 = OpCompositeConstruct %99 %94 %96 %98
536        %101 = OpAccessChain %51 %50 %22 %23
537        %102 = OpLoad %6 %101
538        %103 = OpAccessChain %51 %50 %22 %24
539        %104 = OpLoad %6 %103
540        %105 = OpAccessChain %51 %50 %22 %22
541        %106 = OpLoad %6 %105
542        %107 = OpCompositeConstruct %99 %102 %104 %106
543        %108 = OpAccessChain %51 %50 %22 %23
544        %109 = OpLoad %6 %108
545        %110 = OpAccessChain %51 %50 %22 %24
546        %111 = OpLoad %6 %110
547        %112 = OpAccessChain %51 %50 %22 %22
548        %113 = OpLoad %6 %112
549        %114 = OpCompositeConstruct %99 %109 %111 %113
550        %115 = OpAccessChain %51 %50 %22 %23
551        %116 = OpLoad %6 %115
552        %117 = OpAccessChain %51 %50 %22 %24
553        %118 = OpLoad %6 %117
554        %119 = OpAccessChain %51 %50 %22 %22
555        %120 = OpLoad %6 %119
556        %121 = OpCompositeConstruct %99 %116 %118 %120
557        %122 = OpAccessChain %51 %50 %22 %23
558        %123 = OpLoad %6 %122
559        %124 = OpAccessChain %51 %50 %22 %24
560        %125 = OpLoad %6 %124
561        %126 = OpAccessChain %51 %50 %22 %22
562        %127 = OpLoad %6 %126
563        %128 = OpCompositeConstruct %99 %123 %125 %127
564        %129 = OpAccessChain %51 %50 %22 %23
565        %130 = OpLoad %6 %129
566        %131 = OpAccessChain %51 %50 %22 %24
567        %132 = OpLoad %6 %131
568        %133 = OpAccessChain %51 %50 %22 %22
569        %134 = OpLoad %6 %133
570        %135 = OpCompositeConstruct %99 %130 %132 %134
571        %136 = OpAccessChain %51 %50 %22 %23
572        %137 = OpLoad %6 %136
573        %138 = OpAccessChain %51 %50 %22 %24
574        %139 = OpLoad %6 %138
575        %140 = OpAccessChain %51 %50 %22 %22
576        %141 = OpLoad %6 %140
577        %142 = OpCompositeConstruct %99 %137 %139 %141
578        %143 = OpAccessChain %51 %50 %22 %23
579        %144 = OpLoad %6 %143
580        %145 = OpAccessChain %51 %50 %22 %24
581        %146 = OpLoad %6 %145
582        %147 = OpAccessChain %51 %50 %22 %22
583        %148 = OpLoad %6 %147
584        %149 = OpCompositeConstruct %99 %144 %146 %148
585        %150 = OpAccessChain %51 %50 %22 %23
586        %151 = OpLoad %6 %150
587        %152 = OpAccessChain %51 %50 %22 %24
588        %153 = OpLoad %6 %152
589        %154 = OpAccessChain %51 %50 %22 %22
590        %155 = OpLoad %6 %154
591        %156 = OpCompositeConstruct %99 %151 %153 %155
592        %157 = OpAccessChain %51 %50 %22 %23
593        %158 = OpLoad %6 %157
594        %159 = OpAccessChain %51 %50 %22 %24
595        %160 = OpLoad %6 %159
596        %161 = OpAccessChain %51 %50 %22 %22
597        %162 = OpLoad %6 %161
598        %163 = OpCompositeConstruct %99 %158 %160 %162
599        %165 = OpCompositeConstruct %164 %100 %107 %114 %121 %128 %135 %142 %149 %156 %163
600        %166 = OpLoad %6 %80
601        %167 = OpAccessChain %51 %50 %22 %35
602        %168 = OpLoad %6 %167
603        %169 = OpAccessChain %51 %50 %22 %36
604        %170 = OpLoad %6 %169
605        %171 = OpExtInst %6 %1 SClamp %166 %168 %170
606               OpStore %173 %165
607        %174 = OpAccessChain %7 %173 %171 %22
608        %175 = OpLoad %6 %174
609               OpStore %80 %175
610               OpBranch %87
611         %87 = OpLabel
612               OpBranch %84
613         %86 = OpLabel
614               OpBranch %71
615        %176 = OpLabel
616        %177 = OpLoad %6 %45
617        %178 = OpIAdd %6 %177 %23
618               OpStore %45 %178
619        %179 = OpLoad %6 %55
620        %180 = OpIAdd %6 %179 %23
621               OpStore %55 %180
622        %182 = OpAccessChain %181 %21 %179
623        %183 = OpLoad %6 %182
624        %184 = OpAccessChain %181 %33 %177
625               OpStore %184 %183
626               OpBranch %71
627         %71 = OpLabel
628        %185 = OpLoad %6 %54
629        %186 = OpIAdd %6 %185 %23
630               OpStore %54 %186
631               OpBranch %61
632         %61 = OpLabel
633               OpBranch %58
634         %60 = OpLabel
635               OpBranch %187
636        %187 = OpLabel
637               OpLoopMerge %189 %190 None
638               OpBranch %191
639        %191 = OpLabel
640        %192 = OpLoad %6 %54
641        %193 = OpSLessThan %65 %192 %27
642               OpSelectionMerge %195 None
643               OpBranchConditional %193 %194 %195
644        %194 = OpLabel
645        %196 = OpLoad %6 %45
646        %197 = OpAccessChain %51 %50 %22 %34
647        %198 = OpLoad %6 %197
648        %199 = OpSLessThan %65 %196 %198
649               OpBranch %195
650        %195 = OpLabel
651        %200 = OpPhi %65 %193 %191 %199 %194
652               OpBranchConditional %200 %188 %189
653        %188 = OpLabel
654        %201 = OpLoad %6 %45
655        %202 = OpIAdd %6 %201 %23
656               OpStore %45 %202
657        %203 = OpAccessChain %51 %50 %22 %35
658        %204 = OpLoad %6 %203
659        %205 = OpAccessChain %51 %50 %22 %23
660        %206 = OpLoad %6 %205
661        %207 = OpAccessChain %51 %50 %22 %24
662        %208 = OpLoad %6 %207
663        %209 = OpAccessChain %51 %50 %22 %22
664        %210 = OpLoad %6 %209
665        %211 = OpAccessChain %51 %50 %22 %25
666        %212 = OpLoad %6 %211
667        %213 = OpAccessChain %51 %50 %22 %37
668        %214 = OpLoad %6 %213
669        %215 = OpAccessChain %51 %50 %22 %38
670        %216 = OpLoad %6 %215
671        %217 = OpAccessChain %51 %50 %22 %39
672        %218 = OpLoad %6 %217
673        %219 = OpAccessChain %51 %50 %22 %40
674        %220 = OpLoad %6 %219
675        %221 = OpAccessChain %51 %50 %22 %36
676        %222 = OpLoad %6 %221
677        %223 = OpCompositeConstruct %19 %204 %206 %208 %210 %212 %214 %216 %218 %220 %222
678        %224 = OpLoad %6 %54
679        %225 = OpIAdd %6 %224 %23
680               OpStore %54 %225
681               OpStore %227 %223
682        %228 = OpAccessChain %7 %227 %224
683        %229 = OpLoad %6 %228
684        %230 = OpAccessChain %181 %33 %201
685               OpStore %230 %229
686               OpBranch %190
687        %190 = OpLabel
688               OpBranch %187
689        %189 = OpLabel
690        %232 = OpLoad %6 %9
691               OpStore %231 %232
692               OpBranch %233
693        %233 = OpLabel
694               OpLoopMerge %235 %236 None
695               OpBranch %237
696        %237 = OpLabel
697        %238 = OpLoad %6 %231
698        %239 = OpLoad %6 %11
699        %240 = OpISub %6 %239 %23
700        %241 = OpSLessThanEqual %65 %238 %240
701               OpBranchConditional %241 %234 %235
702        %234 = OpLabel
703        %242 = OpLoad %6 %231
704        %243 = OpLoad %6 %231
705        %244 = OpAccessChain %181 %33 %243
706        %245 = OpLoad %6 %244
707        %246 = OpAccessChain %181 %21 %242
708               OpStore %246 %245
709               OpBranch %236
710        %236 = OpLabel
711        %247 = OpLoad %6 %231
712        %248 = OpIAdd %6 %247 %23
713               OpStore %231 %248
714               OpBranch %233
715        %235 = OpLabel
716               OpReturn
717               OpFunctionEnd
718         %15 = OpFunction %6 None %14
719         %16 = OpLabel
720        %249 = OpVariable %7 Function
721        %252 = OpVariable %7 Function
722        %260 = OpVariable %7 Function
723        %272 = OpVariable %7 Function
724        %274 = OpVariable %7 Function
725        %276 = OpVariable %7 Function
726        %292 = OpVariable %291 Function
727        %250 = OpAccessChain %51 %50 %22 %23
728        %251 = OpLoad %6 %250
729               OpStore %249 %251
730               OpStore %252 %23
731               OpBranch %253
732        %253 = OpLabel
733               OpLoopMerge %255 %256 None
734               OpBranch %257
735        %257 = OpLabel
736        %258 = OpLoad %6 %252
737        %259 = OpSLessThan %65 %258 %34
738               OpBranchConditional %259 %254 %255
739        %254 = OpLabel
740               OpStore %260 %23
741               OpBranch %261
742        %261 = OpLabel
743               OpLoopMerge %263 %264 None
744               OpBranch %265
745        %265 = OpLabel
746        %266 = OpLoad %6 %260
747        %267 = OpSLessThan %65 %266 %34
748               OpBranchConditional %267 %262 %263
749        %262 = OpLabel
750        %268 = OpLoad %6 %252
751        %269 = OpLoad %6 %260
752        %270 = OpIAdd %6 %268 %269
753        %271 = OpExtInst %6 %1 SMin %270 %34
754        %273 = OpLoad %6 %252
755               OpStore %272 %273
756        %275 = OpLoad %6 %260
757               OpStore %274 %275
758               OpStore %276 %271
759        %277 = OpFunctionCall %2 %12 %272 %274 %276
760               OpBranch %264
761        %264 = OpLabel
762        %278 = OpLoad %6 %252
763        %279 = OpLoad %6 %260
764        %280 = OpIAdd %6 %279 %278
765               OpStore %260 %280
766               OpBranch %261
767        %263 = OpLabel
768               OpBranch %281
769        %281 = OpLabel
770               OpLoopMerge %283 %284 None
771               OpBranch %285
772        %285 = OpLabel
773        %286 = OpLoad %6 %249
774        %287 = OpAccessChain %51 %50 %22 %37
775        %288 = OpLoad %6 %287
776        %289 = OpSLessThan %65 %286 %288
777               OpBranchConditional %289 %282 %283
778        %282 = OpLabel
779        %299 = OpAccessChain %298 %297 %22 %22
780        %300 = OpLoad %72 %299
781        %302 = OpCompositeConstruct %301 %300 %300
782        %306 = OpAccessChain %298 %305 %22
783        %307 = OpLoad %72 %306
784        %308 = OpCompositeConstruct %301 %307 %307
785        %309 = OpFDiv %301 %302 %308
786        %310 = OpConvertFToS %290 %309
787               OpStore %292 %310
788               OpBranch %311
789        %311 = OpLabel
790               OpLoopMerge %313 %314 None
791               OpBranch %315
792        %315 = OpLabel
793        %317 = OpAccessChain %7 %292 %316
794        %318 = OpLoad %6 %317
795        %319 = OpAccessChain %7 %292 %293
796        %320 = OpLoad %6 %319
797        %321 = OpIAdd %6 %318 %320
798        %322 = OpAccessChain %51 %50 %22 %24
799        %323 = OpLoad %6 %322
800        %324 = OpSGreaterThan %65 %321 %323
801               OpBranchConditional %324 %312 %313
802        %312 = OpLabel
803               OpBranch %314
804        %314 = OpLabel
805               OpBranch %311
806        %313 = OpLabel
807        %325 = OpLoad %6 %249
808        %326 = OpIAdd %6 %325 %23
809               OpStore %249 %326
810               OpBranch %284
811        %284 = OpLabel
812               OpBranch %281
813        %283 = OpLabel
814               OpBranch %256
815        %256 = OpLabel
816        %327 = OpLoad %6 %252
817        %328 = OpIMul %6 %327 %24
818               OpStore %252 %328
819               OpBranch %253
820        %255 = OpLabel
821        %329 = OpLoad %6 %249
822               OpReturnValue %329
823               OpFunctionEnd
824END
825
826# uniforms for variant
827
828# two
829BUFFER variant_two DATA_TYPE float STD140 DATA
830 2.0
831END
832# _GLF_uniform_int_values
833BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
834 3 1 2 4 14 15 16 17 18 19 10 0 9 5 6 7 8
835END
836# _GLF_uniform_float_values
837BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
838 1.0
839END
840
841BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
842
843PIPELINE graphics variant_pipeline
844  ATTACH variant_vertex_shader
845  ATTACH variant_fragment_shader
846  FRAMEBUFFER_SIZE 32 32
847  BIND BUFFER variant_framebuffer AS color LOCATION 0
848  BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 2
849  BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
850  BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0
851END
852CLEAR_COLOR variant_pipeline 0 0 0 255
853
854CLEAR variant_pipeline
855RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
856
857EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255
858