Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-loop-min-max-clamp-increment-only-first-iteration.amber
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
24 SHADER vertex texgen_vert PASSTHROUGH
25
26 SHADER fragment texgen_frag GLSL
27 #version 430
28 precision highp float;
29
30 layout(location = 0) out vec4 _GLF_color;
31
32 void main()
33 {
34  _GLF_color = vec4(
35  floor(gl_FragCoord.x) * (1.0 / 255.0),
36  (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 255.0),
37  floor(gl_FragCoord.y) * (1.0 / 255.0),
38  1.0);
39 }
40 END
41 BUFFER default_texture FORMAT B8G8R8A8_UNORM
42
43 PIPELINE graphics texgen_pipeline
44   ATTACH texgen_vert
45   ATTACH texgen_frag
46   FRAMEBUFFER_SIZE 256 256
47   BIND BUFFER default_texture AS color LOCATION 0
48 END
49
50 CLEAR_COLOR texgen_pipeline 0 0 0 255
51 CLEAR texgen_pipeline
52 RUN texgen_pipeline DRAW_RECT POS 0 0  SIZE 256 256
53
54 SHADER vertex variant_vertex_shader PASSTHROUGH
55
56 # variant_fragment_shader is derived from the following GLSL:
57 # #version 320 es
58 #
59 # #define _int_1 _GLF_uniform_int_values[0]
60 # #define _int_0 _GLF_uniform_int_values[1]
61 # #define _int_256 _GLF_uniform_int_values[2]
62 # #define _float_0_0 _GLF_uniform_float_values[0]
63 #
64 # precision highp float;
65 # precision highp int;
66 #
67 # // Contents of _GLF_uniform_float_values: 0.0
68 # layout(set = 0, binding = 0) uniform buf0
69 # {
70 #     float _GLF_uniform_float_values[1];
71 # };
72 #
73 # // Contents of _GLF_uniform_int_values: [1, 0, 256]
74 # layout(set = 0, binding = 1) uniform buf1
75 # {
76 #     int _GLF_uniform_int_values[3];
77 # };
78 #
79 # layout(set = 0, binding = 2) uniform sampler2D tex;
80 #
81 # layout(location = 0) out vec4 _GLF_color;
82 #
83 # void main()
84 # {
85 #     vec2 v = gl_FragCoord.xy;
86 #     int a = _int_256;
87 #     vec4 res = vec4(_int_0);
88 #
89 #     // Iterates three times.
90 #     for(int i = 0; i < 3; i++)
91 #     {
92 #         // Iterates three times.
93 #         for(int j = 0; j < 3; j++)
94 #         {
95 #             vec4 v0 = texture(tex, clamp(vec2(_int_1) + max(vec2(_int_1), vec2(i, j - _int_1)), vec2(_int_1), vec2(_int_1, v.y + float(j)) - vec2(_int_1)));
96 #             vec4 v1 = texture(tex, clamp(vec2(_int_1) + min(min(gl_FragCoord.x > _float_0_0 ? max(vec2(i, _int_1), vec2(a, j)) : vec2(_int_1), vec2(_int_1)), max(vec2(i, j), vec2(a, j))), vec2(_int_1) + max(vec2(i, j), vec2(i, _int_1)), vec2(_int_1) + clamp(vec2(_int_1), max(vec2(_int_1), vec2(i, j)), max(vec2(_int_1), vec2(i - _int_1, j)))));
97 #             vec4 v2 = texture(tex, clamp(vec2(_int_1) + vec2(i * a, j), vec2(_int_1), vec2(_int_1)));
98 #             vec4 v3 = texture(tex, clamp(vec2(_int_1) + max(vec2(i, _int_1), vec2(_int_1, j)), vec2(_int_1) + max(vec2(i, gl_FragCoord.y > _float_0_0 ? _int_1 : j), vec2(_int_1)), v + vec2(_int_1, j)));
99 #             vec4 v4 = clamp(v1, v2, v3);
100 #
101 #             // Only iteration i = 0, j = 0 increments res.
102 #             res += min(v0, v4) * float[9](1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)[i * 3 + j];
103 #         }
104 #     }
105 #
106 #     // The loops above simplify to a line below by substituting i = 0 and j = 0, and manually simplifying the expressions.
107 #     vec4 ref = texture(tex, vec2(_int_1, _int_1));
108 #
109 #     // Always true.
110 #     if(ref == res)
111 #     {
112 #         _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
113 #     }
114 #     else
115 #     {
116 #         _GLF_color = vec4(_int_0);
117 #     }
118 # }
119 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
120 ; SPIR-V
121 ; Version: 1.0
122 ; Generator: Khronos Glslang Reference Front End; 10
123 ; Bound: 355
124 ; Schema: 0
125                OpCapability Shader
126           %1 = OpExtInstImport "GLSL.std.450"
127                OpMemoryModel Logical GLSL450
128                OpEntryPoint Fragment %4 "main" %12 %336
129                OpExecutionMode %4 OriginUpperLeft
130                OpSource ESSL 320
131                OpName %4 "main"
132                OpName %9 "v"
133                OpName %12 "gl_FragCoord"
134                OpName %17 "a"
135                OpName %21 "buf1"
136                OpMemberName %21 0 "_GLF_uniform_int_values"
137                OpName %23 ""
138                OpName %30 "res"
139                OpName %36 "i"
140                OpName %46 "j"
141                OpName %54 "v0"
142                OpName %58 "tex"
143                OpName %100 "v1"
144                OpName %111 "buf0"
145                OpMemberName %111 0 "_GLF_uniform_float_values"
146                OpName %113 ""
147                OpName %209 "v2"
148                OpName %233 "v3"
149                OpName %290 "v4"
150                OpName %308 "indexable"
151                OpName %318 "ref"
152                OpName %336 "_GLF_color"
153                OpDecorate %12 BuiltIn FragCoord
154                OpDecorate %20 ArrayStride 16
155                OpMemberDecorate %21 0 Offset 0
156                OpDecorate %21 Block
157                OpDecorate %23 DescriptorSet 0
158                OpDecorate %23 Binding 1
159                OpDecorate %58 RelaxedPrecision
160                OpDecorate %58 DescriptorSet 0
161                OpDecorate %58 Binding 2
162                OpDecorate %59 RelaxedPrecision
163                OpDecorate %62 RelaxedPrecision
164                OpDecorate %63 RelaxedPrecision
165                OpDecorate %66 RelaxedPrecision
166                OpDecorate %67 RelaxedPrecision
167                OpDecorate %69 RelaxedPrecision
168                OpDecorate %74 RelaxedPrecision
169                OpDecorate %75 RelaxedPrecision
170                OpDecorate %76 RelaxedPrecision
171                OpDecorate %77 RelaxedPrecision
172                OpDecorate %80 RelaxedPrecision
173                OpDecorate %81 RelaxedPrecision
174                OpDecorate %84 RelaxedPrecision
175                OpDecorate %92 RelaxedPrecision
176                OpDecorate %95 RelaxedPrecision
177                OpDecorate %96 RelaxedPrecision
178                OpDecorate %97 RelaxedPrecision
179                OpDecorate %98 RelaxedPrecision
180                OpDecorate %99 RelaxedPrecision
181                OpDecorate %101 RelaxedPrecision
182                OpDecorate %104 RelaxedPrecision
183                OpDecorate %105 RelaxedPrecision
184                OpDecorate %110 ArrayStride 16
185                OpMemberDecorate %111 0 Offset 0
186                OpDecorate %111 Block
187                OpDecorate %113 DescriptorSet 0
188                OpDecorate %113 Binding 0
189                OpDecorate %118 RelaxedPrecision
190                OpDecorate %122 RelaxedPrecision
191                OpDecorate %125 RelaxedPrecision
192                OpDecorate %126 RelaxedPrecision
193                OpDecorate %128 RelaxedPrecision
194                OpDecorate %130 RelaxedPrecision
195                OpDecorate %131 RelaxedPrecision
196                OpDecorate %132 RelaxedPrecision
197                OpDecorate %136 RelaxedPrecision
198                OpDecorate %137 RelaxedPrecision
199                OpDecorate %138 RelaxedPrecision
200                OpDecorate %141 RelaxedPrecision
201                OpDecorate %142 RelaxedPrecision
202                OpDecorate %143 RelaxedPrecision
203                OpDecorate %145 RelaxedPrecision
204                OpDecorate %147 RelaxedPrecision
205                OpDecorate %148 RelaxedPrecision
206                OpDecorate %150 RelaxedPrecision
207                OpDecorate %152 RelaxedPrecision
208                OpDecorate %153 RelaxedPrecision
209                OpDecorate %154 RelaxedPrecision
210                OpDecorate %155 RelaxedPrecision
211                OpDecorate %156 RelaxedPrecision
212                OpDecorate %159 RelaxedPrecision
213                OpDecorate %160 RelaxedPrecision
214                OpDecorate %162 RelaxedPrecision
215                OpDecorate %164 RelaxedPrecision
216                OpDecorate %165 RelaxedPrecision
217                OpDecorate %167 RelaxedPrecision
218                OpDecorate %170 RelaxedPrecision
219                OpDecorate %171 RelaxedPrecision
220                OpDecorate %172 RelaxedPrecision
221                OpDecorate %173 RelaxedPrecision
222                OpDecorate %176 RelaxedPrecision
223                OpDecorate %177 RelaxedPrecision
224                OpDecorate %180 RelaxedPrecision
225                OpDecorate %181 RelaxedPrecision
226                OpDecorate %184 RelaxedPrecision
227                OpDecorate %185 RelaxedPrecision
228                OpDecorate %187 RelaxedPrecision
229                OpDecorate %189 RelaxedPrecision
230                OpDecorate %190 RelaxedPrecision
231                OpDecorate %191 RelaxedPrecision
232                OpDecorate %194 RelaxedPrecision
233                OpDecorate %195 RelaxedPrecision
234                OpDecorate %200 RelaxedPrecision
235                OpDecorate %202 RelaxedPrecision
236                OpDecorate %203 RelaxedPrecision
237                OpDecorate %204 RelaxedPrecision
238                OpDecorate %205 RelaxedPrecision
239                OpDecorate %206 RelaxedPrecision
240                OpDecorate %207 RelaxedPrecision
241                OpDecorate %208 RelaxedPrecision
242                OpDecorate %210 RelaxedPrecision
243                OpDecorate %213 RelaxedPrecision
244                OpDecorate %214 RelaxedPrecision
245                OpDecorate %218 RelaxedPrecision
246                OpDecorate %220 RelaxedPrecision
247                OpDecorate %221 RelaxedPrecision
248                OpDecorate %222 RelaxedPrecision
249                OpDecorate %225 RelaxedPrecision
250                OpDecorate %226 RelaxedPrecision
251                OpDecorate %229 RelaxedPrecision
252                OpDecorate %230 RelaxedPrecision
253                OpDecorate %231 RelaxedPrecision
254                OpDecorate %232 RelaxedPrecision
255                OpDecorate %234 RelaxedPrecision
256                OpDecorate %289 RelaxedPrecision
257                OpDecorate %319 RelaxedPrecision
258                OpDecorate %322 RelaxedPrecision
259                OpDecorate %325 RelaxedPrecision
260                OpDecorate %326 RelaxedPrecision
261                OpDecorate %327 RelaxedPrecision
262                OpDecorate %336 Location 0
263           %2 = OpTypeVoid
264           %3 = OpTypeFunction %2
265           %6 = OpTypeFloat 32
266           %7 = OpTypeVector %6 2
267           %8 = OpTypePointer Function %7
268          %10 = OpTypeVector %6 4
269          %11 = OpTypePointer Input %10
270          %12 = OpVariable %11 Input
271          %15 = OpTypeInt 32 1
272          %16 = OpTypePointer Function %15
273          %18 = OpTypeInt 32 0
274          %19 = OpConstant %18 3
275          %20 = OpTypeArray %15 %19
276          %21 = OpTypeStruct %20
277          %22 = OpTypePointer Uniform %21
278          %23 = OpVariable %22 Uniform
279          %24 = OpConstant %15 0
280          %25 = OpConstant %15 2
281          %26 = OpTypePointer Uniform %15
282          %29 = OpTypePointer Function %10
283          %31 = OpConstant %15 1
284          %43 = OpConstant %15 3
285          %44 = OpTypeBool
286          %55 = OpTypeImage %6 2D 0 0 0 1 Unknown
287          %56 = OpTypeSampledImage %55
288          %57 = OpTypePointer UniformConstant %56
289          %58 = OpVariable %57 UniformConstant
290          %85 = OpConstant %18 1
291          %86 = OpTypePointer Function %6
292         %106 = OpConstant %18 0
293         %107 = OpTypePointer Input %6
294         %110 = OpTypeArray %6 %85
295         %111 = OpTypeStruct %110
296         %112 = OpTypePointer Uniform %111
297         %113 = OpVariable %112 Uniform
298         %114 = OpTypePointer Uniform %6
299         %298 = OpConstant %18 9
300         %299 = OpTypeArray %6 %298
301         %300 = OpConstant %6 1
302         %301 = OpConstant %6 0
303         %302 = OpConstantComposite %299 %300 %301 %301 %301 %301 %301 %301 %301 %301
304         %307 = OpTypePointer Function %299
305         %330 = OpTypeVector %44 4
306         %335 = OpTypePointer Output %10
307         %336 = OpVariable %335 Output
308           %4 = OpFunction %2 None %3
309           %5 = OpLabel
310           %9 = OpVariable %8 Function
311          %17 = OpVariable %16 Function
312          %30 = OpVariable %29 Function
313          %36 = OpVariable %16 Function
314          %46 = OpVariable %16 Function
315          %54 = OpVariable %29 Function
316         %100 = OpVariable %29 Function
317         %118 = OpVariable %8 Function
318         %209 = OpVariable %29 Function
319         %233 = OpVariable %29 Function
320         %264 = OpVariable %16 Function
321         %290 = OpVariable %29 Function
322         %308 = OpVariable %307 Function
323         %318 = OpVariable %29 Function
324          %13 = OpLoad %10 %12
325          %14 = OpVectorShuffle %7 %13 %13 0 1
326                OpStore %9 %14
327          %27 = OpAccessChain %26 %23 %24 %25
328          %28 = OpLoad %15 %27
329                OpStore %17 %28
330          %32 = OpAccessChain %26 %23 %24 %31
331          %33 = OpLoad %15 %32
332          %34 = OpConvertSToF %6 %33
333          %35 = OpCompositeConstruct %10 %34 %34 %34 %34
334                OpStore %30 %35
335                OpStore %36 %24
336                OpBranch %37
337          %37 = OpLabel
338                OpLoopMerge %39 %40 None
339                OpBranch %41
340          %41 = OpLabel
341          %42 = OpLoad %15 %36
342          %45 = OpSLessThan %44 %42 %43
343                OpBranchConditional %45 %38 %39
344          %38 = OpLabel
345                OpStore %46 %24
346                OpBranch %47
347          %47 = OpLabel
348                OpLoopMerge %49 %50 None
349                OpBranch %51
350          %51 = OpLabel
351          %52 = OpLoad %15 %46
352          %53 = OpSLessThan %44 %52 %43
353                OpBranchConditional %53 %48 %49
354          %48 = OpLabel
355          %59 = OpLoad %56 %58
356          %60 = OpAccessChain %26 %23 %24 %24
357          %61 = OpLoad %15 %60
358          %62 = OpConvertSToF %6 %61
359          %63 = OpCompositeConstruct %7 %62 %62
360          %64 = OpAccessChain %26 %23 %24 %24
361          %65 = OpLoad %15 %64
362          %66 = OpConvertSToF %6 %65
363          %67 = OpCompositeConstruct %7 %66 %66
364          %68 = OpLoad %15 %36
365          %69 = OpConvertSToF %6 %68
366          %70 = OpLoad %15 %46
367          %71 = OpAccessChain %26 %23 %24 %24
368          %72 = OpLoad %15 %71
369          %73 = OpISub %15 %70 %72
370          %74 = OpConvertSToF %6 %73
371          %75 = OpCompositeConstruct %7 %69 %74
372          %76 = OpExtInst %7 %1 FMax %67 %75
373          %77 = OpFAdd %7 %63 %76
374          %78 = OpAccessChain %26 %23 %24 %24
375          %79 = OpLoad %15 %78
376          %80 = OpConvertSToF %6 %79
377          %81 = OpCompositeConstruct %7 %80 %80
378          %82 = OpAccessChain %26 %23 %24 %24
379          %83 = OpLoad %15 %82
380          %84 = OpConvertSToF %6 %83
381          %87 = OpAccessChain %86 %9 %85
382          %88 = OpLoad %6 %87
383          %89 = OpLoad %15 %46
384          %90 = OpConvertSToF %6 %89
385          %91 = OpFAdd %6 %88 %90
386          %92 = OpCompositeConstruct %7 %84 %91
387          %93 = OpAccessChain %26 %23 %24 %24
388          %94 = OpLoad %15 %93
389          %95 = OpConvertSToF %6 %94
390          %96 = OpCompositeConstruct %7 %95 %95
391          %97 = OpFSub %7 %92 %96
392          %98 = OpExtInst %7 %1 FClamp %77 %81 %97
393          %99 = OpImageSampleImplicitLod %10 %59 %98
394                OpStore %54 %99
395         %101 = OpLoad %56 %58
396         %102 = OpAccessChain %26 %23 %24 %24
397         %103 = OpLoad %15 %102
398         %104 = OpConvertSToF %6 %103
399         %105 = OpCompositeConstruct %7 %104 %104
400         %108 = OpAccessChain %107 %12 %106
401         %109 = OpLoad %6 %108
402         %115 = OpAccessChain %114 %113 %24 %24
403         %116 = OpLoad %6 %115
404         %117 = OpFOrdGreaterThan %44 %109 %116
405                OpSelectionMerge %120 None
406                OpBranchConditional %117 %119 %133
407         %119 = OpLabel
408         %121 = OpLoad %15 %36
409         %122 = OpConvertSToF %6 %121
410         %123 = OpAccessChain %26 %23 %24 %24
411         %124 = OpLoad %15 %123
412         %125 = OpConvertSToF %6 %124
413         %126 = OpCompositeConstruct %7 %122 %125
414         %127 = OpLoad %15 %17
415         %128 = OpConvertSToF %6 %127
416         %129 = OpLoad %15 %46
417         %130 = OpConvertSToF %6 %129
418         %131 = OpCompositeConstruct %7 %128 %130
419         %132 = OpExtInst %7 %1 FMax %126 %131
420                OpStore %118 %132
421                OpBranch %120
422         %133 = OpLabel
423         %134 = OpAccessChain %26 %23 %24 %24
424         %135 = OpLoad %15 %134
425         %136 = OpConvertSToF %6 %135
426         %137 = OpCompositeConstruct %7 %136 %136
427                OpStore %118 %137
428                OpBranch %120
429         %120 = OpLabel
430         %138 = OpLoad %7 %118
431         %139 = OpAccessChain %26 %23 %24 %24
432         %140 = OpLoad %15 %139
433         %141 = OpConvertSToF %6 %140
434         %142 = OpCompositeConstruct %7 %141 %141
435         %143 = OpExtInst %7 %1 FMin %138 %142
436         %144 = OpLoad %15 %36
437         %145 = OpConvertSToF %6 %144
438         %146 = OpLoad %15 %46
439         %147 = OpConvertSToF %6 %146
440         %148 = OpCompositeConstruct %7 %145 %147
441         %149 = OpLoad %15 %17
442         %150 = OpConvertSToF %6 %149
443         %151 = OpLoad %15 %46
444         %152 = OpConvertSToF %6 %151
445         %153 = OpCompositeConstruct %7 %150 %152
446         %154 = OpExtInst %7 %1 FMax %148 %153
447         %155 = OpExtInst %7 %1 FMin %143 %154
448         %156 = OpFAdd %7 %105 %155
449         %157 = OpAccessChain %26 %23 %24 %24
450         %158 = OpLoad %15 %157
451         %159 = OpConvertSToF %6 %158
452         %160 = OpCompositeConstruct %7 %159 %159
453         %161 = OpLoad %15 %36
454         %162 = OpConvertSToF %6 %161
455         %163 = OpLoad %15 %46
456         %164 = OpConvertSToF %6 %163
457         %165 = OpCompositeConstruct %7 %162 %164
458         %166 = OpLoad %15 %36
459         %167 = OpConvertSToF %6 %166
460         %168 = OpAccessChain %26 %23 %24 %24
461         %169 = OpLoad %15 %168
462         %170 = OpConvertSToF %6 %169
463         %171 = OpCompositeConstruct %7 %167 %170
464         %172 = OpExtInst %7 %1 FMax %165 %171
465         %173 = OpFAdd %7 %160 %172
466         %174 = OpAccessChain %26 %23 %24 %24
467         %175 = OpLoad %15 %174
468         %176 = OpConvertSToF %6 %175
469         %177 = OpCompositeConstruct %7 %176 %176
470         %178 = OpAccessChain %26 %23 %24 %24
471         %179 = OpLoad %15 %178
472         %180 = OpConvertSToF %6 %179
473         %181 = OpCompositeConstruct %7 %180 %180
474         %182 = OpAccessChain %26 %23 %24 %24
475         %183 = OpLoad %15 %182
476         %184 = OpConvertSToF %6 %183
477         %185 = OpCompositeConstruct %7 %184 %184
478         %186 = OpLoad %15 %36
479         %187 = OpConvertSToF %6 %186
480         %188 = OpLoad %15 %46
481         %189 = OpConvertSToF %6 %188
482         %190 = OpCompositeConstruct %7 %187 %189
483         %191 = OpExtInst %7 %1 FMax %185 %190
484         %192 = OpAccessChain %26 %23 %24 %24
485         %193 = OpLoad %15 %192
486         %194 = OpConvertSToF %6 %193
487         %195 = OpCompositeConstruct %7 %194 %194
488         %196 = OpLoad %15 %36
489         %197 = OpAccessChain %26 %23 %24 %24
490         %198 = OpLoad %15 %197
491         %199 = OpISub %15 %196 %198
492         %200 = OpConvertSToF %6 %199
493         %201 = OpLoad %15 %46
494         %202 = OpConvertSToF %6 %201
495         %203 = OpCompositeConstruct %7 %200 %202
496         %204 = OpExtInst %7 %1 FMax %195 %203
497         %205 = OpExtInst %7 %1 FClamp %181 %191 %204
498         %206 = OpFAdd %7 %177 %205
499         %207 = OpExtInst %7 %1 FClamp %156 %173 %206
500         %208 = OpImageSampleImplicitLod %10 %101 %207
501                OpStore %100 %208
502         %210 = OpLoad %56 %58
503         %211 = OpAccessChain %26 %23 %24 %24
504         %212 = OpLoad %15 %211
505         %213 = OpConvertSToF %6 %212
506         %214 = OpCompositeConstruct %7 %213 %213
507         %215 = OpLoad %15 %36
508         %216 = OpLoad %15 %17
509         %217 = OpIMul %15 %215 %216
510         %218 = OpConvertSToF %6 %217
511         %219 = OpLoad %15 %46
512         %220 = OpConvertSToF %6 %219
513         %221 = OpCompositeConstruct %7 %218 %220
514         %222 = OpFAdd %7 %214 %221
515         %223 = OpAccessChain %26 %23 %24 %24
516         %224 = OpLoad %15 %223
517         %225 = OpConvertSToF %6 %224
518         %226 = OpCompositeConstruct %7 %225 %225
519         %227 = OpAccessChain %26 %23 %24 %24
520         %228 = OpLoad %15 %227
521         %229 = OpConvertSToF %6 %228
522         %230 = OpCompositeConstruct %7 %229 %229
523         %231 = OpExtInst %7 %1 FClamp %222 %226 %230
524         %232 = OpImageSampleImplicitLod %10 %210 %231
525                OpStore %209 %232
526         %234 = OpLoad %56 %58
527         %235 = OpAccessChain %26 %23 %24 %24
528         %236 = OpLoad %15 %235
529         %237 = OpConvertSToF %6 %236
530         %238 = OpCompositeConstruct %7 %237 %237
531         %239 = OpLoad %15 %36
532         %240 = OpConvertSToF %6 %239
533         %241 = OpAccessChain %26 %23 %24 %24
534         %242 = OpLoad %15 %241
535         %243 = OpConvertSToF %6 %242
536         %244 = OpCompositeConstruct %7 %240 %243
537         %245 = OpAccessChain %26 %23 %24 %24
538         %246 = OpLoad %15 %245
539         %247 = OpConvertSToF %6 %246
540         %248 = OpLoad %15 %46
541         %249 = OpConvertSToF %6 %248
542         %250 = OpCompositeConstruct %7 %247 %249
543         %251 = OpExtInst %7 %1 FMax %244 %250
544         %252 = OpFAdd %7 %238 %251
545         %253 = OpAccessChain %26 %23 %24 %24
546         %254 = OpLoad %15 %253
547         %255 = OpConvertSToF %6 %254
548         %256 = OpCompositeConstruct %7 %255 %255
549         %257 = OpLoad %15 %36
550         %258 = OpConvertSToF %6 %257
551         %259 = OpAccessChain %107 %12 %85
552         %260 = OpLoad %6 %259
553         %261 = OpAccessChain %114 %113 %24 %24
554         %262 = OpLoad %6 %261
555         %263 = OpFOrdGreaterThan %44 %260 %262
556                OpSelectionMerge %266 None
557                OpBranchConditional %263 %265 %269
558         %265 = OpLabel
559         %267 = OpAccessChain %26 %23 %24 %24
560         %268 = OpLoad %15 %267
561                OpStore %264 %268
562                OpBranch %266
563         %269 = OpLabel
564         %270 = OpLoad %15 %46
565                OpStore %264 %270
566                OpBranch %266
567         %266 = OpLabel
568         %271 = OpLoad %15 %264
569         %272 = OpConvertSToF %6 %271
570         %273 = OpCompositeConstruct %7 %258 %272
571         %274 = OpAccessChain %26 %23 %24 %24
572         %275 = OpLoad %15 %274
573         %276 = OpConvertSToF %6 %275
574         %277 = OpCompositeConstruct %7 %276 %276
575         %278 = OpExtInst %7 %1 FMax %273 %277
576         %279 = OpFAdd %7 %256 %278
577         %280 = OpLoad %7 %9
578         %281 = OpAccessChain %26 %23 %24 %24
579         %282 = OpLoad %15 %281
580         %283 = OpConvertSToF %6 %282
581         %284 = OpLoad %15 %46
582         %285 = OpConvertSToF %6 %284
583         %286 = OpCompositeConstruct %7 %283 %285
584         %287 = OpFAdd %7 %280 %286
585         %288 = OpExtInst %7 %1 FClamp %252 %279 %287
586         %289 = OpImageSampleImplicitLod %10 %234 %288
587                OpStore %233 %289
588         %291 = OpLoad %10 %100
589         %292 = OpLoad %10 %209
590         %293 = OpLoad %10 %233
591         %294 = OpExtInst %10 %1 FClamp %291 %292 %293
592                OpStore %290 %294
593         %295 = OpLoad %10 %54
594         %296 = OpLoad %10 %290
595         %297 = OpExtInst %10 %1 FMin %295 %296
596         %303 = OpLoad %15 %36
597         %304 = OpIMul %15 %303 %43
598         %305 = OpLoad %15 %46
599         %306 = OpIAdd %15 %304 %305
600                OpStore %308 %302
601         %309 = OpAccessChain %86 %308 %306
602         %310 = OpLoad %6 %309
603         %311 = OpVectorTimesScalar %10 %297 %310
604         %312 = OpLoad %10 %30
605         %313 = OpFAdd %10 %312 %311
606                OpStore %30 %313
607                OpBranch %50
608          %50 = OpLabel
609         %314 = OpLoad %15 %46
610         %315 = OpIAdd %15 %314 %31
611                OpStore %46 %315
612                OpBranch %47
613          %49 = OpLabel
614                OpBranch %40
615          %40 = OpLabel
616         %316 = OpLoad %15 %36
617         %317 = OpIAdd %15 %316 %31
618                OpStore %36 %317
619                OpBranch %37
620          %39 = OpLabel
621         %319 = OpLoad %56 %58
622         %320 = OpAccessChain %26 %23 %24 %24
623         %321 = OpLoad %15 %320
624         %322 = OpConvertSToF %6 %321
625         %323 = OpAccessChain %26 %23 %24 %24
626         %324 = OpLoad %15 %323
627         %325 = OpConvertSToF %6 %324
628         %326 = OpCompositeConstruct %7 %322 %325
629         %327 = OpImageSampleImplicitLod %10 %319 %326
630                OpStore %318 %327
631         %328 = OpLoad %10 %318
632         %329 = OpLoad %10 %30
633         %331 = OpFOrdEqual %330 %328 %329
634         %332 = OpAll %44 %331
635                OpSelectionMerge %334 None
636                OpBranchConditional %332 %333 %350
637         %333 = OpLabel
638         %337 = OpAccessChain %26 %23 %24 %24
639         %338 = OpLoad %15 %337
640         %339 = OpConvertSToF %6 %338
641         %340 = OpAccessChain %26 %23 %24 %31
642         %341 = OpLoad %15 %340
643         %342 = OpConvertSToF %6 %341
644         %343 = OpAccessChain %26 %23 %24 %31
645         %344 = OpLoad %15 %343
646         %345 = OpConvertSToF %6 %344
647         %346 = OpAccessChain %26 %23 %24 %24
648         %347 = OpLoad %15 %346
649         %348 = OpConvertSToF %6 %347
650         %349 = OpCompositeConstruct %10 %339 %342 %345 %348
651                OpStore %336 %349
652                OpBranch %334
653         %350 = OpLabel
654         %351 = OpAccessChain %26 %23 %24 %31
655         %352 = OpLoad %15 %351
656         %353 = OpConvertSToF %6 %352
657         %354 = OpCompositeConstruct %10 %353 %353 %353 %353
658                OpStore %336 %354
659                OpBranch %334
660         %334 = OpLabel
661                OpReturn
662                OpFunctionEnd
663 END
664
665 # uniforms for variant
666
667 # tex
668 SAMPLER variant_tex
669
670 # _GLF_uniform_int_values
671 BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
672  1 0 256
673 END
674 # _GLF_uniform_float_values
675 BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
676  0.0
677 END
678
679 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
680
681 PIPELINE graphics variant_pipeline
682   ATTACH variant_vertex_shader
683   ATTACH variant_fragment_shader
684   FRAMEBUFFER_SIZE 32 32
685   BIND BUFFER variant_framebuffer AS color LOCATION 0
686   BIND BUFFER default_texture AS combined_image_sampler SAMPLER variant_tex DESCRIPTOR_SET 0 BINDING 2
687   BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
688   BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0
689 END
690 CLEAR_COLOR variant_pipeline 0 0 0 255
691
692 CLEAR variant_pipeline
693 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
694
695 EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255