Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / spv-stable-pillars-O-op-select-to-op-phi.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: OpSelect -> OpPhi
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: 366
34 ; Schema: 0
35                OpCapability Shader
36           %1 = OpExtInstImport "GLSL.std.450"
37                OpMemoryModel Logical GLSL450
38                OpEntryPoint Fragment %4 "main" %246 %268
39                OpExecutionMode %4 OriginUpperLeft
40                OpSource ESSL 320
41                OpName %4 "main"
42                OpName %246 "gl_FragCoord"
43                OpName %249 "buf0"
44                OpMemberName %249 0 "resolution"
45                OpName %251 ""
46                OpName %268 "_GLF_color"
47                OpDecorate %246 BuiltIn FragCoord
48                OpMemberDecorate %249 0 Offset 0
49                OpDecorate %249 Block
50                OpDecorate %251 DescriptorSet 0
51                OpDecorate %251 Binding 0
52                OpDecorate %268 Location 0
53           %2 = OpTypeVoid
54           %3 = OpTypeFunction %2
55           %6 = OpTypeInt 32 1
56           %7 = OpTypeVector %6 2
57           %9 = OpTypeFloat 32
58          %10 = OpTypeVector %9 4
59          %20 = OpTypeInt 32 0
60          %22 = OpTypePointer Function %6
61          %25 = OpConstant %6 256
62          %26 = OpTypeBool
63          %28 = OpConstant %20 0
64          %31 = OpConstant %20 256
65          %32 = OpTypeArray %6 %31
66          %33 = OpConstant %6 115
67          %34 = OpConstant %6 133
68          %35 = OpConstant %6 150
69          %36 = OpConstant %6 164
70          %37 = OpConstant %6 176
71          %38 = OpConstant %6 184
72          %39 = OpConstant %6 190
73          %40 = OpConstant %6 192
74          %41 = OpConstant %6 191
75          %42 = OpConstant %6 187
76          %43 = OpConstant %6 181
77          %44 = OpConstant %6 172
78          %45 = OpConstant %6 163
79          %46 = OpConstant %6 153
80          %47 = OpConstant %6 143
81          %48 = OpConstant %6 134
82          %49 = OpConstant %6 126
83          %50 = OpConstant %6 120
84          %51 = OpConstant %6 116
85          %52 = OpConstant %6 114
86          %53 = OpConstant %6 117
87          %54 = OpConstant %6 121
88          %55 = OpConstant %6 127
89          %56 = OpConstant %6 141
90          %57 = OpConstant %6 148
91          %58 = OpConstant %6 154
92          %59 = OpConstant %6 159
93          %60 = OpConstant %6 162
94          %61 = OpConstant %6 161
95          %62 = OpConstant %6 157
96          %63 = OpConstant %6 151
97          %64 = OpConstant %6 124
98          %65 = OpConstant %6 113
99          %66 = OpConstant %6 103
100          %67 = OpConstant %6 94
101          %68 = OpConstant %6 87
102          %69 = OpConstant %6 82
103          %70 = OpConstant %6 79
104          %71 = OpConstant %6 80
105          %72 = OpConstant %6 84
106          %73 = OpConstant %6 91
107          %74 = OpConstant %6 101
108          %75 = OpConstant %6 130
109          %76 = OpConstant %6 146
110          %77 = OpConstant %6 182
111          %78 = OpConstant %6 199
112          %79 = OpConstant %6 215
113          %80 = OpConstant %6 229
114          %81 = OpConstant %6 240
115          %82 = OpConstant %6 249
116          %83 = OpConstant %6 254
117          %84 = OpConstant %6 250
118          %85 = OpConstant %6 243
119          %86 = OpConstant %6 233
120          %87 = OpConstant %6 223
121          %88 = OpConstant %6 212
122          %89 = OpConstant %6 200
123          %90 = OpConstant %6 180
124          %91 = OpConstant %6 166
125          %92 = OpConstant %6 169
126          %93 = OpConstant %6 174
127          %94 = OpConstant %6 179
128          %95 = OpConstant %6 185
129          %96 = OpConstant %6 193
130          %97 = OpConstant %6 195
131          %98 = OpConstant %6 188
132          %99 = OpConstant %6 171
133         %100 = OpConstant %6 149
134         %101 = OpConstant %6 137
135         %102 = OpConstant %6 125
136         %103 = OpConstant %6 105
137         %104 = OpConstant %6 97
138         %105 = OpConstant %6 93
139         %106 = OpConstant %6 98
140         %107 = OpConstant %6 106
141         %108 = OpConstant %6 145
142         %109 = OpConstant %6 177
143         %110 = OpConstant %6 208
144         %111 = OpConstant %6 221
145         %112 = OpConstant %6 231
146         %113 = OpConstant %6 239
147         %114 = OpConstant %6 244
148         %115 = OpConstant %6 242
149         %116 = OpConstant %6 236
150         %117 = OpConstant %6 228
151         %118 = OpConstant %6 218
152         %119 = OpConstant %6 207
153         %120 = OpConstant %6 194
154         %121 = OpConstant %6 158
155         %122 = OpConstant %6 135
156         %123 = OpConstant %6 132
157         %124 = OpConstant %6 131
158         %125 = OpConstant %6 138
159         %126 = OpConstant %6 147
160         %127 = OpConstant %6 155
161         %128 = OpConstant %6 152
162         %129 = OpConstant %6 139
163         %130 = OpConstant %6 129
164         %131 = OpConstant %6 118
165         %132 = OpConstant %6 68
166         %133 = OpConstant %6 58
167         %134 = OpConstant %6 49
168         %135 = OpConstant %6 43
169         %136 = OpConstant %6 40
170         %137 = OpConstant %6 41
171         %138 = OpConstant %6 44
172         %139 = OpConstant %6 51
173         %140 = OpConstant %6 61
174         %141 = OpConstant %6 73
175         %142 = OpConstant %6 119
176         %143 = OpConstant %6 173
177         %144 = OpConstant %6 186
178         %145 = OpConstant %6 128
179         %146 = OpConstant %6 104
180         %147 = OpConstant %6 86
181         %148 = OpConstant %6 81
182         %149 = OpConstant %6 77
183         %150 = OpConstant %6 76
184         %151 = OpConstant %6 89
185         %152 = OpConstant %6 102
186         %153 = OpConstant %6 92
187         %154 = OpConstant %6 83
188         %155 = OpConstant %6 62
189         %156 = OpConstant %6 50
190         %157 = OpConstant %6 38
191         %158 = OpConstant %6 26
192         %159 = OpConstant %6 16
193         %160 = OpConstant %6 8
194         %161 = OpConstant %6 2
195         %162 = OpConstant %6 0
196         %163 = OpConstant %6 4
197         %164 = OpConstant %6 11
198         %165 = OpConstant %6 21
199         %166 = OpConstant %6 33
200         %167 = OpConstant %6 48
201         %168 = OpConstant %6 64
202         %169 = OpConstant %6 144
203         %170 = OpConstant %6 123
204         %171 = OpConstant %6 112
205         %172 = OpConstant %6 100
206         %173 = OpConstant %6 90
207         %174 = OpConstant %6 65
208         %175 = OpConstant %6 67
209         %176 = OpConstant %6 70
210         %177 = OpConstant %6 75
211         %178 = OpConstant %6 95
212         %179 = OpConstant %6 88
213         %180 = OpConstant %6 69
214         %181 = OpConstant %6 47
215         %182 = OpConstant %6 36
216         %183 = OpConstant %6 18
217         %184 = OpConstant %6 13
218         %185 = OpConstant %6 15
219         %186 = OpConstant %6 22
220         %187 = OpConstant %6 32
221         %188 = OpConstant %6 45
222         %189 = OpConstant %6 60
223         %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
224         %193 = OpTypePointer Function %32
225         %215 = OpConstant %9 15
226         %231 = OpConstant %9 1
227         %236 = OpConstant %6 1
228         %238 = OpConstant %9 0
229         %239 = OpConstantComposite %10 %238 %238 %238 %231
230         %242 = OpTypeVector %9 2
231         %245 = OpTypePointer Input %10
232         %246 = OpVariable %245 Input
233         %249 = OpTypeStruct %242
234         %250 = OpTypePointer Uniform %249
235         %251 = OpVariable %250 Uniform
236         %252 = OpTypePointer Uniform %242
237         %259 = OpConstant %9 256
238         %267 = OpTypePointer Output %10
239         %268 = OpVariable %267 Output
240         %277 = OpConstantFalse %26
241         %280 = OpConstantTrue %26
242         %363 = OpUndef %10
243         %365 = OpConstant %9 0.0666666701
244           %4 = OpFunction %2 None %3
245           %5 = OpLabel
246         %285 = OpVariable %193 Function
247         %286 = OpVariable %193 Function
248         %288 = OpVariable %193 Function
249         %247 = OpLoad %10 %246
250         %248 = OpVectorShuffle %242 %247 %247 0 1
251         %253 = OpAccessChain %252 %251 %162
252         %254 = OpLoad %242 %253
253         %255 = OpFDiv %242 %248 %254
254         %258 = OpCompositeExtract %9 %255 0
255         %260 = OpFMul %9 %258 %259
256         %261 = OpConvertFToS %6 %260
257         %263 = OpCompositeExtract %9 %255 1
258         %264 = OpFMul %9 %263 %259
259         %265 = OpConvertFToS %6 %264
260         %266 = OpCompositeConstruct %7 %261 %265
261                OpSelectionMerge %341 None
262                OpSwitch %28 %291
263         %291 = OpLabel
264                OpBranch %292
265         %292 = OpLabel
266         %355 = OpPhi %7 %266 %291 %354 %337
267         %295 = OpCompositeExtract %6 %355 1
268         %296 = OpINotEqual %26 %295 %25
269                OpLoopMerge %338 %337 None
270                OpBranchConditional %296 %297 %338
271         %297 = OpLabel
272         %299 = OpCompositeExtract %6 %355 0
273                OpStore %285 %190
274         %302 = OpAccessChain %22 %285 %295
275         %303 = OpLoad %6 %302
276         %304 = OpIAdd %6 %303 %185
277         %305 = OpSLessThan %26 %299 %304
278                OpSelectionMerge %315 None
279                OpBranchConditional %305 %306 %315
280         %306 = OpLabel
281                OpStore %286 %190
282         %311 = OpAccessChain %22 %286 %295
283         %312 = OpLoad %6 %311
284         %313 = OpISub %6 %312 %185
285         %314 = OpSGreaterThan %26 %299 %313
286                OpBranch %315
287         %315 = OpLabel
288         %316 = OpPhi %26 %305 %297 %314 %306
289                OpSelectionMerge %333 None
290                OpBranchConditional %316 %317 %333
291         %317 = OpLabel
292                OpStore %288 %190
293         %322 = OpAccessChain %22 %288 %295
294         %323 = OpLoad %6 %322
295         %324 = OpISub %6 %299 %323
296         %325 = OpConvertSToF %9 %324
297         %326 = OpExtInst %9 %1 FAbs %325
298         %327 = OpFSub %9 %215 %326
299         %328 = OpFMul %9 %327 %365
300         %332 = OpCompositeConstruct %10 %328 %328 %328 %231
301                OpBranch %338
302         %333 = OpLabel
303         %336 = OpIAdd %6 %295 %236
304         %354 = OpCompositeInsert %7 %336 %355 1
305                OpBranch %337
306         %337 = OpLabel
307                OpBranch %292
308         %338 = OpLabel
309         %361 = OpPhi %10 %363 %292 %332 %317
310         %357 = OpPhi %26 %277 %292 %280 %317
311                OpSelectionMerge %340 None
312                OpBranchConditional %357 %341 %340
313         %340 = OpLabel
314                OpBranch %341
315         %341 = OpLabel
316         %360 = OpPhi %10 %361 %338 %239 %340
317                OpStore %268 %360
318                OpReturn
319                OpFunctionEnd
320 END
321
322 # uniforms for reference
323
324 # resolution
325 BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
326  32.0 16.0
327 END
328
329 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
330
331 PIPELINE graphics reference_pipeline
332   ATTACH reference_vertex_shader
333   ATTACH reference_fragment_shader
334   FRAMEBUFFER_SIZE 32 16
335   BIND BUFFER reference_framebuffer AS color LOCATION 0
336   BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
337 END
338 CLEAR_COLOR reference_pipeline 0 0 0 255
339
340 CLEAR reference_pipeline
341 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 32 16
342
343
344 SHADER vertex variant_vertex_shader PASSTHROUGH
345
346 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
347 ; SPIR-V
348 ; Version: 1.0
349 ; Generator: Khronos Glslang Reference Front End; 7
350 ; Bound: 534
351 ; Schema: 0
352                OpCapability Shader
353           %1 = OpExtInstImport "GLSL.std.450"
354                OpMemoryModel Logical GLSL450
355                OpEntryPoint Fragment %4 "main" %246 %268
356                OpExecutionMode %4 OriginUpperLeft
357                OpSource ESSL 320
358                OpName %4 "main"
359                OpName %246 "gl_FragCoord"
360                OpName %249 "buf0"
361                OpMemberName %249 0 "resolution"
362                OpName %251 ""
363                OpName %268 "_GLF_color"
364                OpDecorate %246 BuiltIn FragCoord
365                OpMemberDecorate %249 0 Offset 0
366                OpDecorate %249 Block
367                OpDecorate %251 DescriptorSet 0
368                OpDecorate %251 Binding 0
369                OpDecorate %268 Location 0
370           %2 = OpTypeVoid
371           %3 = OpTypeFunction %2
372           %6 = OpTypeInt 32 1
373           %7 = OpTypeVector %6 2
374           %9 = OpTypeFloat 32
375          %10 = OpTypeVector %9 4
376          %20 = OpTypeInt 32 0
377          %22 = OpTypePointer Function %6
378          %25 = OpConstant %6 256
379          %26 = OpTypeBool
380          %28 = OpConstant %20 0
381          %31 = OpConstant %20 256
382          %32 = OpTypeArray %6 %31
383          %33 = OpConstant %6 115
384          %34 = OpConstant %6 133
385          %35 = OpConstant %6 150
386          %36 = OpConstant %6 164
387          %37 = OpConstant %6 176
388          %38 = OpConstant %6 184
389          %39 = OpConstant %6 190
390          %40 = OpConstant %6 192
391          %41 = OpConstant %6 191
392          %42 = OpConstant %6 187
393          %43 = OpConstant %6 181
394          %44 = OpConstant %6 172
395          %45 = OpConstant %6 163
396          %46 = OpConstant %6 153
397          %47 = OpConstant %6 143
398          %48 = OpConstant %6 134
399          %49 = OpConstant %6 126
400          %50 = OpConstant %6 120
401          %51 = OpConstant %6 116
402          %52 = OpConstant %6 114
403          %53 = OpConstant %6 117
404          %54 = OpConstant %6 121
405          %55 = OpConstant %6 127
406          %56 = OpConstant %6 141
407          %57 = OpConstant %6 148
408          %58 = OpConstant %6 154
409          %59 = OpConstant %6 159
410          %60 = OpConstant %6 162
411          %61 = OpConstant %6 161
412          %62 = OpConstant %6 157
413          %63 = OpConstant %6 151
414          %64 = OpConstant %6 124
415          %65 = OpConstant %6 113
416          %66 = OpConstant %6 103
417          %67 = OpConstant %6 94
418          %68 = OpConstant %6 87
419          %69 = OpConstant %6 82
420          %70 = OpConstant %6 79
421          %71 = OpConstant %6 80
422          %72 = OpConstant %6 84
423          %73 = OpConstant %6 91
424          %74 = OpConstant %6 101
425          %75 = OpConstant %6 130
426          %76 = OpConstant %6 146
427          %77 = OpConstant %6 182
428          %78 = OpConstant %6 199
429          %79 = OpConstant %6 215
430          %80 = OpConstant %6 229
431          %81 = OpConstant %6 240
432          %82 = OpConstant %6 249
433          %83 = OpConstant %6 254
434          %84 = OpConstant %6 250
435          %85 = OpConstant %6 243
436          %86 = OpConstant %6 233
437          %87 = OpConstant %6 223
438          %88 = OpConstant %6 212
439          %89 = OpConstant %6 200
440          %90 = OpConstant %6 180
441          %91 = OpConstant %6 166
442          %92 = OpConstant %6 169
443          %93 = OpConstant %6 174
444          %94 = OpConstant %6 179
445          %95 = OpConstant %6 185
446          %96 = OpConstant %6 193
447          %97 = OpConstant %6 195
448          %98 = OpConstant %6 188
449          %99 = OpConstant %6 171
450         %100 = OpConstant %6 149
451         %101 = OpConstant %6 137
452         %102 = OpConstant %6 125
453         %103 = OpConstant %6 105
454         %104 = OpConstant %6 97
455         %105 = OpConstant %6 93
456         %106 = OpConstant %6 98
457         %107 = OpConstant %6 106
458         %108 = OpConstant %6 145
459         %109 = OpConstant %6 177
460         %110 = OpConstant %6 208
461         %111 = OpConstant %6 221
462         %112 = OpConstant %6 231
463         %113 = OpConstant %6 239
464         %114 = OpConstant %6 244
465         %115 = OpConstant %6 242
466         %116 = OpConstant %6 236
467         %117 = OpConstant %6 228
468         %118 = OpConstant %6 218
469         %119 = OpConstant %6 207
470         %120 = OpConstant %6 194
471         %121 = OpConstant %6 158
472         %122 = OpConstant %6 135
473         %123 = OpConstant %6 132
474         %124 = OpConstant %6 131
475         %125 = OpConstant %6 138
476         %126 = OpConstant %6 147
477         %127 = OpConstant %6 155
478         %128 = OpConstant %6 152
479         %129 = OpConstant %6 139
480         %130 = OpConstant %6 129
481         %131 = OpConstant %6 118
482         %132 = OpConstant %6 68
483         %133 = OpConstant %6 58
484         %134 = OpConstant %6 49
485         %135 = OpConstant %6 43
486         %136 = OpConstant %6 40
487         %137 = OpConstant %6 41
488         %138 = OpConstant %6 44
489         %139 = OpConstant %6 51
490         %140 = OpConstant %6 61
491         %141 = OpConstant %6 73
492         %142 = OpConstant %6 119
493         %143 = OpConstant %6 173
494         %144 = OpConstant %6 186
495         %145 = OpConstant %6 128
496         %146 = OpConstant %6 104
497         %147 = OpConstant %6 86
498         %148 = OpConstant %6 81
499         %149 = OpConstant %6 77
500         %150 = OpConstant %6 76
501         %151 = OpConstant %6 89
502         %152 = OpConstant %6 102
503         %153 = OpConstant %6 92
504         %154 = OpConstant %6 83
505         %155 = OpConstant %6 62
506         %156 = OpConstant %6 50
507         %157 = OpConstant %6 38
508         %158 = OpConstant %6 26
509         %159 = OpConstant %6 16
510         %160 = OpConstant %6 8
511         %161 = OpConstant %6 2
512         %162 = OpConstant %6 0
513         %163 = OpConstant %6 4
514         %164 = OpConstant %6 11
515         %165 = OpConstant %6 21
516         %166 = OpConstant %6 33
517         %167 = OpConstant %6 48
518         %168 = OpConstant %6 64
519         %169 = OpConstant %6 144
520         %170 = OpConstant %6 123
521         %171 = OpConstant %6 112
522         %172 = OpConstant %6 100
523         %173 = OpConstant %6 90
524         %174 = OpConstant %6 65
525         %175 = OpConstant %6 67
526         %176 = OpConstant %6 70
527         %177 = OpConstant %6 75
528         %178 = OpConstant %6 95
529         %179 = OpConstant %6 88
530         %180 = OpConstant %6 69
531         %181 = OpConstant %6 47
532         %182 = OpConstant %6 36
533         %183 = OpConstant %6 18
534         %184 = OpConstant %6 13
535         %185 = OpConstant %6 15
536         %186 = OpConstant %6 22
537         %187 = OpConstant %6 32
538         %188 = OpConstant %6 45
539         %189 = OpConstant %6 60
540         %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
541         %193 = OpTypePointer Function %32
542         %215 = OpConstant %9 15
543         %231 = OpConstant %9 1
544         %236 = OpConstant %6 1
545         %238 = OpConstant %9 0
546         %239 = OpConstantComposite %10 %238 %238 %238 %231
547         %242 = OpTypeVector %9 2
548         %245 = OpTypePointer Input %10
549         %246 = OpVariable %245 Input
550         %249 = OpTypeStruct %242
551         %250 = OpTypePointer Uniform %249
552         %251 = OpVariable %250 Uniform
553         %252 = OpTypePointer Uniform %242
554         %259 = OpConstant %9 256
555         %267 = OpTypePointer Output %10
556         %268 = OpVariable %267 Output
557         %277 = OpConstantFalse %26
558         %280 = OpConstantTrue %26
559         %363 = OpUndef %10
560         %365 = OpConstant %9 0.0666666701
561         %523 = OpConstant %6 0
562           %4 = OpFunction %2 None %3
563           %5 = OpLabel
564         %285 = OpVariable %193 Function
565         %286 = OpVariable %193 Function
566         %288 = OpVariable %193 Function
567         %247 = OpLoad %10 %246
568         %248 = OpVectorShuffle %242 %247 %247 0 1
569         %253 = OpAccessChain %252 %251 %162
570         %254 = OpLoad %242 %253
571         %255 = OpFDiv %242 %248 %254
572         %258 = OpCompositeExtract %9 %255 0
573         %260 = OpFMul %9 %258 %259
574         %261 = OpConvertFToS %6 %260
575         %263 = OpCompositeExtract %9 %255 1
576         %264 = OpFMul %9 %263 %259
577         %265 = OpConvertFToS %6 %264
578         %266 = OpCompositeConstruct %7 %261 %265
579                OpSelectionMerge %341 None
580                OpSwitch %28 %291
581         %291 = OpLabel
582                OpBranch %292
583         %292 = OpLabel
584         %355 = OpPhi %7 %266 %291 %354 %337
585         %295 = OpCompositeExtract %6 %355 1
586         %296 = OpINotEqual %26 %295 %25
587                OpLoopMerge %338 %337 None
588                OpBranchConditional %296 %297 %338
589         %297 = OpLabel
590         %299 = OpCompositeExtract %6 %355 0
591                OpStore %285 %190
592         %302 = OpAccessChain %22 %285 %295
593         %303 = OpLoad %6 %302
594         %304 = OpIAdd %6 %303 %185
595         %305 = OpSLessThan %26 %299 %304
596                OpBranch %306
597         %306 = OpLabel
598                OpSelectionMerge %516 None
599                OpBranchConditional %305 %517 %516
600         %517 = OpLabel
601                OpStore %286 %190
602                OpBranch %516
603         %516 = OpLabel
604         %311 = OpAccessChain %22 %286 %295
605                OpSelectionMerge %518 None
606                OpBranchConditional %305 %519 %521
607         %519 = OpLabel
608         %520 = OpLoad %6 %311
609                OpBranch %518
610         %521 = OpLabel
611         %522 = OpCopyObject %6 %523
612                OpBranch %518
613         %518 = OpLabel
614         %312 = OpPhi %6 %520 %519 %522 %521
615         %313 = OpISub %6 %312 %185
616         %314 = OpSGreaterThan %26 %299 %313
617                OpSelectionMerge %315 None
618                OpBranchConditional %305 %532 %533
619         %532 = OpLabel
620                OpBranch %315
621         %533 = OpLabel
622                OpBranch %315
623         %315 = OpLabel
624         %316 = OpPhi %26 %314 %532 %305 %533
625                OpSelectionMerge %333 None
626                OpBranchConditional %316 %317 %333
627         %317 = OpLabel
628                OpStore %288 %190
629         %322 = OpAccessChain %22 %288 %295
630         %323 = OpLoad %6 %322
631         %324 = OpISub %6 %299 %323
632         %325 = OpConvertSToF %9 %324
633         %326 = OpExtInst %9 %1 FAbs %325
634         %327 = OpFSub %9 %215 %326
635         %328 = OpFMul %9 %327 %365
636         %332 = OpCompositeConstruct %10 %328 %328 %328 %231
637                OpBranch %338
638         %333 = OpLabel
639         %336 = OpIAdd %6 %295 %236
640         %354 = OpCompositeInsert %7 %336 %355 1
641                OpBranch %337
642         %337 = OpLabel
643                OpBranch %292
644         %338 = OpLabel
645         %361 = OpPhi %10 %363 %292 %332 %317
646         %357 = OpPhi %26 %277 %292 %280 %317
647                OpSelectionMerge %340 None
648                OpBranchConditional %357 %341 %340
649         %340 = OpLabel
650                OpBranch %341
651         %341 = OpLabel
652         %360 = OpPhi %10 %361 %338 %239 %340
653                OpStore %268 %360
654                OpReturn
655                OpFunctionEnd
656 END
657
658 # uniforms for variant
659
660 # resolution
661 BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
662  32.0 16.0
663 END
664
665 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
666
667 PIPELINE graphics variant_pipeline
668   ATTACH variant_vertex_shader
669   ATTACH variant_fragment_shader
670   FRAMEBUFFER_SIZE 32 16
671   BIND BUFFER variant_framebuffer AS color LOCATION 0
672   BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
673 END
674 CLEAR_COLOR variant_pipeline 0 0 0 255
675
676 CLEAR variant_pipeline
677 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 16
678
679
680 SHADER vertex variant_2_vertex_shader PASSTHROUGH
681
682 SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
683 ; SPIR-V
684 ; Version: 1.0
685 ; Generator: Khronos Glslang Reference Front End; 7
686 ; Bound: 524
687 ; Schema: 0
688                OpCapability Shader
689           %1 = OpExtInstImport "GLSL.std.450"
690                OpMemoryModel Logical GLSL450
691                OpEntryPoint Fragment %4 "main" %246 %268
692                OpExecutionMode %4 OriginUpperLeft
693                OpSource ESSL 320
694                OpName %4 "main"
695                OpName %246 "gl_FragCoord"
696                OpName %249 "buf0"
697                OpMemberName %249 0 "resolution"
698                OpName %251 ""
699                OpName %268 "_GLF_color"
700                OpDecorate %246 BuiltIn FragCoord
701                OpMemberDecorate %249 0 Offset 0
702                OpDecorate %249 Block
703                OpDecorate %251 DescriptorSet 0
704                OpDecorate %251 Binding 0
705                OpDecorate %268 Location 0
706           %2 = OpTypeVoid
707           %3 = OpTypeFunction %2
708           %6 = OpTypeInt 32 1
709           %7 = OpTypeVector %6 2
710           %9 = OpTypeFloat 32
711          %10 = OpTypeVector %9 4
712          %20 = OpTypeInt 32 0
713          %22 = OpTypePointer Function %6
714          %25 = OpConstant %6 256
715          %26 = OpTypeBool
716          %28 = OpConstant %20 0
717          %31 = OpConstant %20 256
718          %32 = OpTypeArray %6 %31
719          %33 = OpConstant %6 115
720          %34 = OpConstant %6 133
721          %35 = OpConstant %6 150
722          %36 = OpConstant %6 164
723          %37 = OpConstant %6 176
724          %38 = OpConstant %6 184
725          %39 = OpConstant %6 190
726          %40 = OpConstant %6 192
727          %41 = OpConstant %6 191
728          %42 = OpConstant %6 187
729          %43 = OpConstant %6 181
730          %44 = OpConstant %6 172
731          %45 = OpConstant %6 163
732          %46 = OpConstant %6 153
733          %47 = OpConstant %6 143
734          %48 = OpConstant %6 134
735          %49 = OpConstant %6 126
736          %50 = OpConstant %6 120
737          %51 = OpConstant %6 116
738          %52 = OpConstant %6 114
739          %53 = OpConstant %6 117
740          %54 = OpConstant %6 121
741          %55 = OpConstant %6 127
742          %56 = OpConstant %6 141
743          %57 = OpConstant %6 148
744          %58 = OpConstant %6 154
745          %59 = OpConstant %6 159
746          %60 = OpConstant %6 162
747          %61 = OpConstant %6 161
748          %62 = OpConstant %6 157
749          %63 = OpConstant %6 151
750          %64 = OpConstant %6 124
751          %65 = OpConstant %6 113
752          %66 = OpConstant %6 103
753          %67 = OpConstant %6 94
754          %68 = OpConstant %6 87
755          %69 = OpConstant %6 82
756          %70 = OpConstant %6 79
757          %71 = OpConstant %6 80
758          %72 = OpConstant %6 84
759          %73 = OpConstant %6 91
760          %74 = OpConstant %6 101
761          %75 = OpConstant %6 130
762          %76 = OpConstant %6 146
763          %77 = OpConstant %6 182
764          %78 = OpConstant %6 199
765          %79 = OpConstant %6 215
766          %80 = OpConstant %6 229
767          %81 = OpConstant %6 240
768          %82 = OpConstant %6 249
769          %83 = OpConstant %6 254
770          %84 = OpConstant %6 250
771          %85 = OpConstant %6 243
772          %86 = OpConstant %6 233
773          %87 = OpConstant %6 223
774          %88 = OpConstant %6 212
775          %89 = OpConstant %6 200
776          %90 = OpConstant %6 180
777          %91 = OpConstant %6 166
778          %92 = OpConstant %6 169
779          %93 = OpConstant %6 174
780          %94 = OpConstant %6 179
781          %95 = OpConstant %6 185
782          %96 = OpConstant %6 193
783          %97 = OpConstant %6 195
784          %98 = OpConstant %6 188
785          %99 = OpConstant %6 171
786         %100 = OpConstant %6 149
787         %101 = OpConstant %6 137
788         %102 = OpConstant %6 125
789         %103 = OpConstant %6 105
790         %104 = OpConstant %6 97
791         %105 = OpConstant %6 93
792         %106 = OpConstant %6 98
793         %107 = OpConstant %6 106
794         %108 = OpConstant %6 145
795         %109 = OpConstant %6 177
796         %110 = OpConstant %6 208
797         %111 = OpConstant %6 221
798         %112 = OpConstant %6 231
799         %113 = OpConstant %6 239
800         %114 = OpConstant %6 244
801         %115 = OpConstant %6 242
802         %116 = OpConstant %6 236
803         %117 = OpConstant %6 228
804         %118 = OpConstant %6 218
805         %119 = OpConstant %6 207
806         %120 = OpConstant %6 194
807         %121 = OpConstant %6 158
808         %122 = OpConstant %6 135
809         %123 = OpConstant %6 132
810         %124 = OpConstant %6 131
811         %125 = OpConstant %6 138
812         %126 = OpConstant %6 147
813         %127 = OpConstant %6 155
814         %128 = OpConstant %6 152
815         %129 = OpConstant %6 139
816         %130 = OpConstant %6 129
817         %131 = OpConstant %6 118
818         %132 = OpConstant %6 68
819         %133 = OpConstant %6 58
820         %134 = OpConstant %6 49
821         %135 = OpConstant %6 43
822         %136 = OpConstant %6 40
823         %137 = OpConstant %6 41
824         %138 = OpConstant %6 44
825         %139 = OpConstant %6 51
826         %140 = OpConstant %6 61
827         %141 = OpConstant %6 73
828         %142 = OpConstant %6 119
829         %143 = OpConstant %6 173
830         %144 = OpConstant %6 186
831         %145 = OpConstant %6 128
832         %146 = OpConstant %6 104
833         %147 = OpConstant %6 86
834         %148 = OpConstant %6 81
835         %149 = OpConstant %6 77
836         %150 = OpConstant %6 76
837         %151 = OpConstant %6 89
838         %152 = OpConstant %6 102
839         %153 = OpConstant %6 92
840         %154 = OpConstant %6 83
841         %155 = OpConstant %6 62
842         %156 = OpConstant %6 50
843         %157 = OpConstant %6 38
844         %158 = OpConstant %6 26
845         %159 = OpConstant %6 16
846         %160 = OpConstant %6 8
847         %161 = OpConstant %6 2
848         %162 = OpConstant %6 0
849         %163 = OpConstant %6 4
850         %164 = OpConstant %6 11
851         %165 = OpConstant %6 21
852         %166 = OpConstant %6 33
853         %167 = OpConstant %6 48
854         %168 = OpConstant %6 64
855         %169 = OpConstant %6 144
856         %170 = OpConstant %6 123
857         %171 = OpConstant %6 112
858         %172 = OpConstant %6 100
859         %173 = OpConstant %6 90
860         %174 = OpConstant %6 65
861         %175 = OpConstant %6 67
862         %176 = OpConstant %6 70
863         %177 = OpConstant %6 75
864         %178 = OpConstant %6 95
865         %179 = OpConstant %6 88
866         %180 = OpConstant %6 69
867         %181 = OpConstant %6 47
868         %182 = OpConstant %6 36
869         %183 = OpConstant %6 18
870         %184 = OpConstant %6 13
871         %185 = OpConstant %6 15
872         %186 = OpConstant %6 22
873         %187 = OpConstant %6 32
874         %188 = OpConstant %6 45
875         %189 = OpConstant %6 60
876         %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
877         %193 = OpTypePointer Function %32
878         %215 = OpConstant %9 15
879         %231 = OpConstant %9 1
880         %236 = OpConstant %6 1
881         %238 = OpConstant %9 0
882         %239 = OpConstantComposite %10 %238 %238 %238 %231
883         %242 = OpTypeVector %9 2
884         %245 = OpTypePointer Input %10
885         %246 = OpVariable %245 Input
886         %249 = OpTypeStruct %242
887         %250 = OpTypePointer Uniform %249
888         %251 = OpVariable %250 Uniform
889         %252 = OpTypePointer Uniform %242
890         %259 = OpConstant %9 256
891         %267 = OpTypePointer Output %10
892         %268 = OpVariable %267 Output
893         %277 = OpConstantFalse %26
894         %280 = OpConstantTrue %26
895         %363 = OpUndef %10
896         %365 = OpConstant %9 0.0666666701
897         %523 = OpConstant %6 0
898           %4 = OpFunction %2 None %3
899           %5 = OpLabel
900         %285 = OpVariable %193 Function
901         %286 = OpVariable %193 Function
902         %288 = OpVariable %193 Function
903         %247 = OpLoad %10 %246
904         %248 = OpVectorShuffle %242 %247 %247 0 1
905         %253 = OpAccessChain %252 %251 %162
906         %254 = OpLoad %242 %253
907         %255 = OpFDiv %242 %248 %254
908         %258 = OpCompositeExtract %9 %255 0
909         %260 = OpFMul %9 %258 %259
910         %261 = OpConvertFToS %6 %260
911         %263 = OpCompositeExtract %9 %255 1
912         %264 = OpFMul %9 %263 %259
913         %265 = OpConvertFToS %6 %264
914         %266 = OpCompositeConstruct %7 %261 %265
915                OpSelectionMerge %341 None
916                OpSwitch %28 %291
917         %291 = OpLabel
918                OpBranch %292
919         %292 = OpLabel
920         %355 = OpPhi %7 %266 %291 %354 %337
921         %295 = OpCompositeExtract %6 %355 1
922         %296 = OpINotEqual %26 %295 %25
923                OpLoopMerge %338 %337 None
924                OpBranchConditional %296 %297 %338
925         %297 = OpLabel
926         %299 = OpCompositeExtract %6 %355 0
927                OpStore %285 %190
928         %302 = OpAccessChain %22 %285 %295
929         %303 = OpLoad %6 %302
930         %304 = OpIAdd %6 %303 %185
931         %305 = OpSLessThan %26 %299 %304
932                OpBranch %306
933         %306 = OpLabel
934                OpSelectionMerge %516 None
935                OpBranchConditional %305 %517 %516
936         %517 = OpLabel
937                OpStore %286 %190
938                OpBranch %516
939         %516 = OpLabel
940         %311 = OpAccessChain %22 %286 %295
941                OpSelectionMerge %518 None
942                OpBranchConditional %305 %519 %521
943         %519 = OpLabel
944         %520 = OpLoad %6 %311
945                OpBranch %518
946         %521 = OpLabel
947         %522 = OpCopyObject %6 %523
948                OpBranch %518
949         %518 = OpLabel
950         %312 = OpPhi %6 %520 %519 %522 %521
951         %313 = OpISub %6 %312 %185
952         %314 = OpSGreaterThan %26 %299 %313
953                OpBranch %315
954         %315 = OpLabel
955         %316 = OpSelect %26 %305 %314 %305
956                OpSelectionMerge %333 None
957                OpBranchConditional %316 %317 %333
958         %317 = OpLabel
959                OpStore %288 %190
960         %322 = OpAccessChain %22 %288 %295
961         %323 = OpLoad %6 %322
962         %324 = OpISub %6 %299 %323
963         %325 = OpConvertSToF %9 %324
964         %326 = OpExtInst %9 %1 FAbs %325
965         %327 = OpFSub %9 %215 %326
966         %328 = OpFMul %9 %327 %365
967         %332 = OpCompositeConstruct %10 %328 %328 %328 %231
968                OpBranch %338
969         %333 = OpLabel
970         %336 = OpIAdd %6 %295 %236
971         %354 = OpCompositeInsert %7 %336 %355 1
972                OpBranch %337
973         %337 = OpLabel
974                OpBranch %292
975         %338 = OpLabel
976         %361 = OpPhi %10 %363 %292 %332 %317
977         %357 = OpPhi %26 %277 %292 %280 %317
978                OpSelectionMerge %340 None
979                OpBranchConditional %357 %341 %340
980         %340 = OpLabel
981                OpBranch %341
982         %341 = OpLabel
983         %360 = OpPhi %10 %361 %338 %239 %340
984                OpStore %268 %360
985                OpReturn
986                OpFunctionEnd
987 END
988
989 # uniforms for variant_2
990
991 # resolution
992 BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
993  32.0 16.0
994 END
995
996 BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
997
998 PIPELINE graphics variant_2_pipeline
999   ATTACH variant_2_vertex_shader
1000   ATTACH variant_2_fragment_shader
1001   FRAMEBUFFER_SIZE 32 16
1002   BIND BUFFER variant_2_framebuffer AS color LOCATION 0
1003   BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
1004 END
1005 CLEAR_COLOR variant_2_pipeline 0 0 0 255
1006
1007 CLEAR variant_2_pipeline
1008 RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 32 16
1009
1010 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
1011 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005