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