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