Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / stable-colorgrid-modulo-double-always-false-discard.amber
1 #!amber
2
3 # Copyright 2020 Google LLC
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17
18 # A test for a bug found by the GraphicsFuzz project.
19
20 # Short description: A fragment shader with two always false discards
21
22 # The test passes because both shaders render the same image.
23
24 # Optimized using spirv-opt with the following arguments:
25 # '-O'
26 # spirv-opt commit hash: 717e7877cac15d393fd3bb1bd872679de8b59add
27
28
29
30 SHADER vertex reference_vertex_shader PASSTHROUGH
31
32 # reference_fragment_shader is derived from the following GLSL:
33 # #version 320 es
34 # precision highp float;
35 #
36 # precision highp int;
37 #
38 # layout(location = 0) out vec4 _GLF_color;
39 #
40 # layout(set = 0, binding = 0) uniform buf0
41 # {
42 #   vec2 resolution;
43 # };
44 # float compute_value(float limit, float thirty_two)
45 # {
46 #   float result = -0.5;
47 #   for (int i = 1; i < 800; i++)
48 #   {
49 #     if ((i % 32) == 0)
50 #     {
51 #       result += 0.4;
52 #     }
53 #     else
54 #     {
55 #       if (mod(float(i), round(thirty_two)) <= 0.01)
56 #       {
57 #         result += 100.0;
58 #       }
59 #     }
60 #     if (float(i) >= limit)
61 #     {
62 #       return result;
63 #     }
64 #   }
65 #   return result;
66 # }
67 # void main()
68 # {
69 #   vec3 c = vec3(7.0, 8.0, 9.0);
70 #   float thirty_two = round(resolution.x / 8.0);
71 #   c.x = compute_value(gl_FragCoord.x, thirty_two);
72 #   c.y = compute_value(gl_FragCoord.y, thirty_two);
73 #   c.z = c.x + c.y;
74 #   for (int i = 0; i < 3; i++)
75 #   {
76 #     if (c[i] >= 1.0)
77 #     {
78 #       c[i] = c[i] * c[i];
79 #     }
80 #   }
81 #   _GLF_color = vec4(normalize(abs(c)), 1.0);
82 # }
83 SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
84 ; SPIR-V
85 ; Version: 1.0
86 ; Generator: Khronos Glslang Reference Front End; 10
87 ; Bound: 290
88 ; Schema: 0
89                OpCapability Shader
90           %1 = OpExtInstImport "GLSL.std.450"
91                OpMemoryModel Logical GLSL450
92                OpEntryPoint Fragment %4 "main" %85 %137
93                OpExecutionMode %4 OriginUpperLeft
94                OpSource ESSL 320
95                OpName %4 "main"
96                OpName %66 "c"
97                OpName %73 "buf0"
98                OpMemberName %73 0 "resolution"
99                OpName %75 ""
100                OpName %85 "gl_FragCoord"
101                OpName %137 "_GLF_color"
102                OpMemberDecorate %73 0 Offset 0
103                OpDecorate %73 Block
104                OpDecorate %75 DescriptorSet 0
105                OpDecorate %75 Binding 0
106                OpDecorate %85 BuiltIn FragCoord
107                OpDecorate %137 Location 0
108           %2 = OpTypeVoid
109           %3 = OpTypeFunction %2
110           %6 = OpTypeFloat 32
111           %7 = OpTypePointer Function %6
112          %14 = OpConstant %6 -0.5
113          %15 = OpTypeInt 32 1
114          %18 = OpConstant %15 1
115          %25 = OpConstant %15 800
116          %26 = OpTypeBool
117          %29 = OpConstant %15 32
118          %31 = OpConstant %15 0
119          %35 = OpConstant %6 0.400000006
120          %44 = OpConstant %6 0.00999999978
121          %48 = OpConstant %6 100
122          %64 = OpTypeVector %6 3
123          %65 = OpTypePointer Function %64
124          %67 = OpConstant %6 7
125          %68 = OpConstant %6 8
126          %69 = OpConstant %6 9
127          %70 = OpConstantComposite %64 %67 %68 %69
128          %72 = OpTypeVector %6 2
129          %73 = OpTypeStruct %72
130          %74 = OpTypePointer Uniform %73
131          %75 = OpVariable %74 Uniform
132          %76 = OpTypeInt 32 0
133          %77 = OpConstant %76 0
134          %78 = OpTypePointer Uniform %6
135          %83 = OpTypeVector %6 4
136          %84 = OpTypePointer Input %83
137          %85 = OpVariable %84 Input
138          %87 = OpTypePointer Input %6
139          %95 = OpConstant %76 1
140         %107 = OpConstant %76 2
141         %116 = OpConstant %15 3
142         %121 = OpConstant %6 1
143         %136 = OpTypePointer Output %83
144         %137 = OpVariable %136 Output
145         %149 = OpConstantFalse %26
146         %152 = OpConstantTrue %26
147         %261 = OpUndef %6
148         %289 = OpConstant %6 0.125
149           %4 = OpFunction %2 None %3
150           %5 = OpLabel
151          %66 = OpVariable %65 Function
152                OpStore %66 %70
153          %79 = OpAccessChain %78 %75 %31 %77
154          %80 = OpLoad %6 %79
155          %81 = OpFMul %6 %80 %289
156          %82 = OpExtInst %6 %1 Round %81
157          %88 = OpAccessChain %87 %85 %77
158          %89 = OpLoad %6 %88
159                OpSelectionMerge %199 None
160                OpSwitch %77 %161
161         %161 = OpLabel
162                OpBranch %162
163         %162 = OpLabel
164         %248 = OpPhi %6 %14 %161 %251 %192
165         %247 = OpPhi %15 %18 %161 %194 %192
166         %165 = OpSLessThan %26 %247 %25
167                OpLoopMerge %195 %192 None
168                OpBranchConditional %165 %166 %195
169         %166 = OpLabel
170         %168 = OpSMod %15 %247 %29
171         %169 = OpIEqual %26 %168 %31
172                OpSelectionMerge %184 None
173                OpBranchConditional %169 %170 %173
174         %170 = OpLabel
175         %172 = OpFAdd %6 %248 %35
176                OpBranch %184
177         %173 = OpLabel
178         %175 = OpConvertSToF %6 %247
179         %177 = OpExtInst %6 %1 Round %82
180         %178 = OpFMod %6 %175 %177
181         %179 = OpFOrdLessThanEqual %26 %178 %44
182                OpSelectionMerge %183 None
183                OpBranchConditional %179 %180 %183
184         %180 = OpLabel
185         %182 = OpFAdd %6 %248 %48
186                OpBranch %183
187         %183 = OpLabel
188         %252 = OpPhi %6 %248 %173 %182 %180
189                OpBranch %184
190         %184 = OpLabel
191         %251 = OpPhi %6 %172 %170 %252 %183
192         %186 = OpConvertSToF %6 %247
193         %188 = OpFOrdGreaterThanEqual %26 %186 %89
194                OpSelectionMerge %191 None
195                OpBranchConditional %188 %189 %191
196         %189 = OpLabel
197                OpBranch %195
198         %191 = OpLabel
199                OpBranch %192
200         %192 = OpLabel
201         %194 = OpIAdd %15 %247 %18
202                OpBranch %162
203         %195 = OpLabel
204         %259 = OpPhi %6 %261 %162 %251 %189
205         %257 = OpPhi %6 %248 %162 %251 %189
206         %253 = OpPhi %26 %149 %162 %152 %189
207                OpSelectionMerge %197 None
208                OpBranchConditional %253 %199 %197
209         %197 = OpLabel
210                OpBranch %199
211         %199 = OpLabel
212         %258 = OpPhi %6 %259 %195 %257 %197
213          %93 = OpAccessChain %7 %66 %77
214                OpStore %93 %258
215          %96 = OpAccessChain %87 %85 %95
216          %97 = OpLoad %6 %96
217                OpSelectionMerge %245 None
218                OpSwitch %77 %207
219         %207 = OpLabel
220                OpBranch %208
221         %208 = OpLabel
222         %265 = OpPhi %6 %14 %207 %268 %238
223         %264 = OpPhi %15 %18 %207 %240 %238
224         %211 = OpSLessThan %26 %264 %25
225                OpLoopMerge %241 %238 None
226                OpBranchConditional %211 %212 %241
227         %212 = OpLabel
228         %214 = OpSMod %15 %264 %29
229         %215 = OpIEqual %26 %214 %31
230                OpSelectionMerge %230 None
231                OpBranchConditional %215 %216 %219
232         %216 = OpLabel
233         %218 = OpFAdd %6 %265 %35
234                OpBranch %230
235         %219 = OpLabel
236         %221 = OpConvertSToF %6 %264
237         %223 = OpExtInst %6 %1 Round %82
238         %224 = OpFMod %6 %221 %223
239         %225 = OpFOrdLessThanEqual %26 %224 %44
240                OpSelectionMerge %229 None
241                OpBranchConditional %225 %226 %229
242         %226 = OpLabel
243         %228 = OpFAdd %6 %265 %48
244                OpBranch %229
245         %229 = OpLabel
246         %269 = OpPhi %6 %265 %219 %228 %226
247                OpBranch %230
248         %230 = OpLabel
249         %268 = OpPhi %6 %218 %216 %269 %229
250         %232 = OpConvertSToF %6 %264
251         %234 = OpFOrdGreaterThanEqual %26 %232 %97
252                OpSelectionMerge %237 None
253                OpBranchConditional %234 %235 %237
254         %235 = OpLabel
255                OpBranch %241
256         %237 = OpLabel
257                OpBranch %238
258         %238 = OpLabel
259         %240 = OpIAdd %15 %264 %18
260                OpBranch %208
261         %241 = OpLabel
262         %276 = OpPhi %6 %261 %208 %268 %235
263         %274 = OpPhi %6 %265 %208 %268 %235
264         %270 = OpPhi %26 %149 %208 %152 %235
265                OpSelectionMerge %243 None
266                OpBranchConditional %270 %245 %243
267         %243 = OpLabel
268                OpBranch %245
269         %245 = OpLabel
270         %275 = OpPhi %6 %276 %241 %274 %243
271         %101 = OpAccessChain %7 %66 %95
272                OpStore %101 %275
273         %103 = OpLoad %6 %93
274         %105 = OpLoad %6 %101
275         %106 = OpFAdd %6 %103 %105
276         %108 = OpAccessChain %7 %66 %107
277                OpStore %108 %106
278                OpBranch %110
279         %110 = OpLabel
280         %285 = OpPhi %15 %31 %245 %135 %113
281         %117 = OpSLessThan %26 %285 %116
282                OpLoopMerge %112 %113 None
283                OpBranchConditional %117 %111 %112
284         %111 = OpLabel
285         %119 = OpAccessChain %7 %66 %285
286         %120 = OpLoad %6 %119
287         %122 = OpFOrdGreaterThanEqual %26 %120 %121
288                OpSelectionMerge %124 None
289                OpBranchConditional %122 %123 %124
290         %123 = OpLabel
291         %128 = OpLoad %6 %119
292         %131 = OpLoad %6 %119
293         %132 = OpFMul %6 %128 %131
294                OpStore %119 %132
295                OpBranch %124
296         %124 = OpLabel
297                OpBranch %113
298         %113 = OpLabel
299         %135 = OpIAdd %15 %285 %18
300                OpBranch %110
301         %112 = OpLabel
302         %138 = OpLoad %64 %66
303         %139 = OpExtInst %64 %1 FAbs %138
304         %140 = OpExtInst %64 %1 Normalize %139
305         %141 = OpCompositeExtract %6 %140 0
306         %142 = OpCompositeExtract %6 %140 1
307         %143 = OpCompositeExtract %6 %140 2
308         %144 = OpCompositeConstruct %83 %141 %142 %143 %121
309                OpStore %137 %144
310                OpReturn
311                OpFunctionEnd
312 END
313
314 # uniforms for reference
315
316 # resolution
317 BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
318  256.0 256.0
319 END
320
321 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
322
323 PIPELINE graphics reference_pipeline
324   ATTACH reference_vertex_shader
325   ATTACH reference_fragment_shader
326   FRAMEBUFFER_SIZE 256 256
327   BIND BUFFER reference_framebuffer AS color LOCATION 0
328   BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
329 END
330 CLEAR_COLOR reference_pipeline 0 0 0 255
331
332 CLEAR reference_pipeline
333 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
334
335
336 SHADER vertex variant_vertex_shader PASSTHROUGH
337
338 # variant_fragment_shader is derived from the following GLSL:
339 # #version 320 es
340 # precision highp float;
341 #
342 # precision highp int;
343 #
344 # layout(location = 0) out vec4 _GLF_color;
345 #
346 # layout(set = 0, binding = 0) uniform buf0
347 # {
348 #   vec2 resolution;
349 # };
350 # layout(set = 0, binding = 1) uniform buf1
351 # {
352 #   vec2 injectionSwitch; // x == 0.0, y == 1.0
353 # };
354 # float compute_value(float limit, float thirty_two)
355 # {
356 #   float result = -0.5;
357 #   for (int i = 1; i < 800; i++)
358 #   {
359 #     if ((i % 32) == 0)
360 #     {
361 #       result += 0.4;
362 #     }
363 #     else
364 #     {
365 #       if (mod(float(i), round(thirty_two)) <= 0.01)
366 #       {
367 #         result += 100.0;
368 #       }
369 #       // Always false.
370 #       if (injectionSwitch.x > injectionSwitch.y)
371 #       {
372 #         discard;
373 #       }
374 #     }
375 #     if (float(i) >= limit)
376 #     {
377 #       return result;
378 #     }
379 #   }
380 #   return result;
381 # }
382 # void main()
383 # {
384 #   vec3 c = vec3(7.0, 8.0, 9.0);
385 #   float thirty_two = round(resolution.x / 8.0);
386 #   c.x = compute_value(gl_FragCoord.x, thirty_two);
387 #   c.y = compute_value(gl_FragCoord.y, thirty_two);
388 #   c.z = c.x + c.y;
389 #   for (int i = 0; i < 3; i++)
390 #   {
391 #     if (c[i] >= 1.0)
392 #     {
393 #       c[i] = c[i] * c[i];
394 #       // Always false.
395 #       if ((injectionSwitch.x > injectionSwitch.y))
396 #       {
397 #         discard;
398 #       }
399 #     }
400 #   }
401 #   _GLF_color = vec4(normalize(abs(c)), 1.0);
402 # }
403 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
404 ; SPIR-V
405 ; Version: 1.0
406 ; Generator: Khronos Glslang Reference Front End; 10
407 ; Bound: 325
408 ; Schema: 0
409                OpCapability Shader
410           %1 = OpExtInstImport "GLSL.std.450"
411                OpMemoryModel Logical GLSL450
412                OpEntryPoint Fragment %4 "main" %97 %156
413                OpExecutionMode %4 OriginUpperLeft
414                OpSource ESSL 320
415                OpName %4 "main"
416                OpName %52 "buf1"
417                OpMemberName %52 0 "injectionSwitch"
418                OpName %54 ""
419                OpName %82 "c"
420                OpName %88 "buf0"
421                OpMemberName %88 0 "resolution"
422                OpName %90 ""
423                OpName %97 "gl_FragCoord"
424                OpName %156 "_GLF_color"
425                OpMemberDecorate %52 0 Offset 0
426                OpDecorate %52 Block
427                OpDecorate %54 DescriptorSet 0
428                OpDecorate %54 Binding 1
429                OpMemberDecorate %88 0 Offset 0
430                OpDecorate %88 Block
431                OpDecorate %90 DescriptorSet 0
432                OpDecorate %90 Binding 0
433                OpDecorate %97 BuiltIn FragCoord
434                OpDecorate %156 Location 0
435           %2 = OpTypeVoid
436           %3 = OpTypeFunction %2
437           %6 = OpTypeFloat 32
438           %7 = OpTypePointer Function %6
439          %14 = OpConstant %6 -0.5
440          %15 = OpTypeInt 32 1
441          %18 = OpConstant %15 1
442          %25 = OpConstant %15 800
443          %26 = OpTypeBool
444          %29 = OpConstant %15 32
445          %31 = OpConstant %15 0
446          %35 = OpConstant %6 0.400000006
447          %44 = OpConstant %6 0.00999999978
448          %48 = OpConstant %6 100
449          %51 = OpTypeVector %6 2
450          %52 = OpTypeStruct %51
451          %53 = OpTypePointer Uniform %52
452          %54 = OpVariable %53 Uniform
453          %55 = OpTypeInt 32 0
454          %56 = OpConstant %55 0
455          %57 = OpTypePointer Uniform %6
456          %60 = OpConstant %55 1
457          %80 = OpTypeVector %6 3
458          %81 = OpTypePointer Function %80
459          %83 = OpConstant %6 7
460          %84 = OpConstant %6 8
461          %85 = OpConstant %6 9
462          %86 = OpConstantComposite %80 %83 %84 %85
463          %88 = OpTypeStruct %51
464          %89 = OpTypePointer Uniform %88
465          %90 = OpVariable %89 Uniform
466          %95 = OpTypeVector %6 4
467          %96 = OpTypePointer Input %95
468          %97 = OpVariable %96 Input
469          %99 = OpTypePointer Input %6
470         %118 = OpConstant %55 2
471         %127 = OpConstant %15 3
472         %132 = OpConstant %6 1
473         %155 = OpTypePointer Output %95
474         %156 = OpVariable %155 Output
475         %168 = OpConstantFalse %26
476         %171 = OpConstantTrue %26
477         %296 = OpUndef %6
478         %324 = OpConstant %6 0.125
479           %4 = OpFunction %2 None %3
480           %5 = OpLabel
481          %82 = OpVariable %81 Function
482                OpStore %82 %86
483          %91 = OpAccessChain %57 %90 %31 %56
484          %92 = OpLoad %6 %91
485          %93 = OpFMul %6 %92 %324
486          %94 = OpExtInst %6 %1 Round %93
487         %100 = OpAccessChain %99 %97 %56
488         %101 = OpLoad %6 %100
489                OpSelectionMerge %225 None
490                OpSwitch %56 %180
491         %180 = OpLabel
492                OpBranch %181
493         %181 = OpLabel
494         %283 = OpPhi %6 %14 %180 %286 %218
495         %282 = OpPhi %15 %18 %180 %220 %218
496         %184 = OpSLessThan %26 %282 %25
497                OpLoopMerge %221 %218 None
498                OpBranchConditional %184 %185 %221
499         %185 = OpLabel
500         %187 = OpSMod %15 %282 %29
501         %188 = OpIEqual %26 %187 %31
502                OpSelectionMerge %210 None
503                OpBranchConditional %188 %189 %192
504         %189 = OpLabel
505         %191 = OpFAdd %6 %283 %35
506                OpBranch %210
507         %192 = OpLabel
508         %194 = OpConvertSToF %6 %282
509         %196 = OpExtInst %6 %1 Round %94
510         %197 = OpFMod %6 %194 %196
511         %198 = OpFOrdLessThanEqual %26 %197 %44
512                OpSelectionMerge %202 None
513                OpBranchConditional %198 %199 %202
514         %199 = OpLabel
515         %201 = OpFAdd %6 %283 %48
516                OpBranch %202
517         %202 = OpLabel
518         %287 = OpPhi %6 %283 %192 %201 %199
519         %203 = OpAccessChain %57 %54 %31 %56
520         %204 = OpLoad %6 %203
521         %205 = OpAccessChain %57 %54 %31 %60
522         %206 = OpLoad %6 %205
523         %207 = OpFOrdGreaterThan %26 %204 %206
524                OpSelectionMerge %209 None
525                OpBranchConditional %207 %208 %209
526         %208 = OpLabel
527                OpKill
528         %209 = OpLabel
529                OpBranch %210
530         %210 = OpLabel
531         %286 = OpPhi %6 %191 %189 %287 %209
532         %212 = OpConvertSToF %6 %282
533         %214 = OpFOrdGreaterThanEqual %26 %212 %101
534                OpSelectionMerge %217 None
535                OpBranchConditional %214 %215 %217
536         %215 = OpLabel
537                OpBranch %221
538         %217 = OpLabel
539                OpBranch %218
540         %218 = OpLabel
541         %220 = OpIAdd %15 %282 %18
542                OpBranch %181
543         %221 = OpLabel
544         %294 = OpPhi %6 %296 %181 %286 %215
545         %292 = OpPhi %6 %283 %181 %286 %215
546         %288 = OpPhi %26 %168 %181 %171 %215
547                OpSelectionMerge %223 None
548                OpBranchConditional %288 %225 %223
549         %223 = OpLabel
550                OpBranch %225
551         %225 = OpLabel
552         %293 = OpPhi %6 %294 %221 %292 %223
553         %105 = OpAccessChain %7 %82 %56
554                OpStore %105 %293
555         %107 = OpAccessChain %99 %97 %60
556         %108 = OpLoad %6 %107
557                OpSelectionMerge %279 None
558                OpSwitch %56 %234
559         %234 = OpLabel
560                OpBranch %235
561         %235 = OpLabel
562         %300 = OpPhi %6 %14 %234 %303 %272
563         %299 = OpPhi %15 %18 %234 %274 %272
564         %238 = OpSLessThan %26 %299 %25
565                OpLoopMerge %275 %272 None
566                OpBranchConditional %238 %239 %275
567         %239 = OpLabel
568         %241 = OpSMod %15 %299 %29
569         %242 = OpIEqual %26 %241 %31
570                OpSelectionMerge %264 None
571                OpBranchConditional %242 %243 %246
572         %243 = OpLabel
573         %245 = OpFAdd %6 %300 %35
574                OpBranch %264
575         %246 = OpLabel
576         %248 = OpConvertSToF %6 %299
577         %250 = OpExtInst %6 %1 Round %94
578         %251 = OpFMod %6 %248 %250
579         %252 = OpFOrdLessThanEqual %26 %251 %44
580                OpSelectionMerge %256 None
581                OpBranchConditional %252 %253 %256
582         %253 = OpLabel
583         %255 = OpFAdd %6 %300 %48
584                OpBranch %256
585         %256 = OpLabel
586         %304 = OpPhi %6 %300 %246 %255 %253
587         %257 = OpAccessChain %57 %54 %31 %56
588         %258 = OpLoad %6 %257
589         %259 = OpAccessChain %57 %54 %31 %60
590         %260 = OpLoad %6 %259
591         %261 = OpFOrdGreaterThan %26 %258 %260
592                OpSelectionMerge %263 None
593                OpBranchConditional %261 %262 %263
594         %262 = OpLabel
595                OpKill
596         %263 = OpLabel
597                OpBranch %264
598         %264 = OpLabel
599         %303 = OpPhi %6 %245 %243 %304 %263
600         %266 = OpConvertSToF %6 %299
601         %268 = OpFOrdGreaterThanEqual %26 %266 %108
602                OpSelectionMerge %271 None
603                OpBranchConditional %268 %269 %271
604         %269 = OpLabel
605                OpBranch %275
606         %271 = OpLabel
607                OpBranch %272
608         %272 = OpLabel
609         %274 = OpIAdd %15 %299 %18
610                OpBranch %235
611         %275 = OpLabel
612         %311 = OpPhi %6 %296 %235 %303 %269
613         %309 = OpPhi %6 %300 %235 %303 %269
614         %305 = OpPhi %26 %168 %235 %171 %269
615                OpSelectionMerge %277 None
616                OpBranchConditional %305 %279 %277
617         %277 = OpLabel
618                OpBranch %279
619         %279 = OpLabel
620         %310 = OpPhi %6 %311 %275 %309 %277
621         %112 = OpAccessChain %7 %82 %60
622                OpStore %112 %310
623         %114 = OpLoad %6 %105
624         %116 = OpLoad %6 %112
625         %117 = OpFAdd %6 %114 %116
626         %119 = OpAccessChain %7 %82 %118
627                OpStore %119 %117
628                OpBranch %121
629         %121 = OpLabel
630         %320 = OpPhi %15 %31 %279 %154 %124
631         %128 = OpSLessThan %26 %320 %127
632                OpLoopMerge %123 %124 None
633                OpBranchConditional %128 %122 %123
634         %122 = OpLabel
635         %130 = OpAccessChain %7 %82 %320
636         %131 = OpLoad %6 %130
637         %133 = OpFOrdGreaterThanEqual %26 %131 %132
638                OpSelectionMerge %135 None
639                OpBranchConditional %133 %134 %135
640         %134 = OpLabel
641         %139 = OpLoad %6 %130
642         %142 = OpLoad %6 %130
643         %143 = OpFMul %6 %139 %142
644                OpStore %130 %143
645         %145 = OpAccessChain %57 %54 %31 %56
646         %146 = OpLoad %6 %145
647         %147 = OpAccessChain %57 %54 %31 %60
648         %148 = OpLoad %6 %147
649         %149 = OpFOrdGreaterThan %26 %146 %148
650                OpSelectionMerge %151 None
651                OpBranchConditional %149 %150 %151
652         %150 = OpLabel
653                OpKill
654         %151 = OpLabel
655                OpBranch %135
656         %135 = OpLabel
657                OpBranch %124
658         %124 = OpLabel
659         %154 = OpIAdd %15 %320 %18
660                OpBranch %121
661         %123 = OpLabel
662         %157 = OpLoad %80 %82
663         %158 = OpExtInst %80 %1 FAbs %157
664         %159 = OpExtInst %80 %1 Normalize %158
665         %160 = OpCompositeExtract %6 %159 0
666         %161 = OpCompositeExtract %6 %159 1
667         %162 = OpCompositeExtract %6 %159 2
668         %163 = OpCompositeConstruct %95 %160 %161 %162 %132
669                OpStore %156 %163
670                OpReturn
671                OpFunctionEnd
672 END
673
674 # uniforms for variant
675
676 # resolution
677 BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
678  256.0 256.0
679 END
680 # injectionSwitch
681 BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
682  0.0 1.0
683 END
684
685 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
686
687 PIPELINE graphics variant_pipeline
688   ATTACH variant_vertex_shader
689   ATTACH variant_fragment_shader
690   FRAMEBUFFER_SIZE 256 256
691   BIND BUFFER variant_framebuffer AS color LOCATION 0
692   BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
693   BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 1
694 END
695 CLEAR_COLOR variant_pipeline 0 0 0 255
696
697 CLEAR variant_pipeline
698 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
699
700 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005