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