Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / spv-stable-colorgrid-modulo-O-move-block-down.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: Two shaders with diff: some blocks moved down
21
22 # The test renders two 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: 290
34 ; Schema: 0
35                OpCapability Shader
36           %1 = OpExtInstImport "GLSL.std.450"
37                OpMemoryModel Logical GLSL450
38                OpEntryPoint Fragment %4 "main" %85 %137
39                OpExecutionMode %4 OriginUpperLeft
40                OpSource ESSL 320
41                OpName %4 "main"
42                OpName %66 "c"
43                OpName %73 "buf0"
44                OpMemberName %73 0 "resolution"
45                OpName %75 ""
46                OpName %85 "gl_FragCoord"
47                OpName %137 "_GLF_color"
48                OpMemberDecorate %73 0 Offset 0
49                OpDecorate %73 Block
50                OpDecorate %75 DescriptorSet 0
51                OpDecorate %75 Binding 0
52                OpDecorate %85 BuiltIn FragCoord
53                OpDecorate %137 Location 0
54           %2 = OpTypeVoid
55           %3 = OpTypeFunction %2
56           %6 = OpTypeFloat 32
57           %7 = OpTypePointer Function %6
58          %14 = OpConstant %6 -0.5
59          %15 = OpTypeInt 32 1
60          %18 = OpConstant %15 1
61          %25 = OpConstant %15 800
62          %26 = OpTypeBool
63          %29 = OpConstant %15 32
64          %31 = OpConstant %15 0
65          %35 = OpConstant %6 0.400000006
66          %44 = OpConstant %6 0.00999999978
67          %48 = OpConstant %6 100
68          %64 = OpTypeVector %6 3
69          %65 = OpTypePointer Function %64
70          %67 = OpConstant %6 7
71          %68 = OpConstant %6 8
72          %69 = OpConstant %6 9
73          %70 = OpConstantComposite %64 %67 %68 %69
74          %72 = OpTypeVector %6 2
75          %73 = OpTypeStruct %72
76          %74 = OpTypePointer Uniform %73
77          %75 = OpVariable %74 Uniform
78          %76 = OpTypeInt 32 0
79          %77 = OpConstant %76 0
80          %78 = OpTypePointer Uniform %6
81          %83 = OpTypeVector %6 4
82          %84 = OpTypePointer Input %83
83          %85 = OpVariable %84 Input
84          %87 = OpTypePointer Input %6
85          %95 = OpConstant %76 1
86         %107 = OpConstant %76 2
87         %116 = OpConstant %15 3
88         %121 = OpConstant %6 1
89         %136 = OpTypePointer Output %83
90         %137 = OpVariable %136 Output
91         %149 = OpConstantFalse %26
92         %152 = OpConstantTrue %26
93         %261 = OpUndef %6
94         %289 = OpConstant %6 0.125
95           %4 = OpFunction %2 None %3
96           %5 = OpLabel
97          %66 = OpVariable %65 Function
98                OpStore %66 %70
99          %79 = OpAccessChain %78 %75 %31 %77
100          %80 = OpLoad %6 %79
101          %81 = OpFMul %6 %80 %289
102          %82 = OpExtInst %6 %1 Round %81
103          %88 = OpAccessChain %87 %85 %77
104          %89 = OpLoad %6 %88
105                OpSelectionMerge %199 None
106                OpSwitch %77 %161
107         %161 = OpLabel
108                OpBranch %162
109         %162 = OpLabel
110         %248 = OpPhi %6 %14 %161 %251 %192
111         %247 = OpPhi %15 %18 %161 %194 %192
112         %165 = OpSLessThan %26 %247 %25
113                OpLoopMerge %195 %192 None
114                OpBranchConditional %165 %166 %195
115         %166 = OpLabel
116         %168 = OpSMod %15 %247 %29
117         %169 = OpIEqual %26 %168 %31
118                OpSelectionMerge %184 None
119                OpBranchConditional %169 %170 %173
120         %170 = OpLabel
121         %172 = OpFAdd %6 %248 %35
122                OpBranch %184
123         %173 = OpLabel
124         %175 = OpConvertSToF %6 %247
125         %177 = OpExtInst %6 %1 Round %82
126         %178 = OpFMod %6 %175 %177
127         %179 = OpFOrdLessThanEqual %26 %178 %44
128                OpSelectionMerge %183 None
129                OpBranchConditional %179 %180 %183
130         %180 = OpLabel
131         %182 = OpFAdd %6 %248 %48
132                OpBranch %183
133         %183 = OpLabel
134         %252 = OpPhi %6 %248 %173 %182 %180
135                OpBranch %184
136         %184 = OpLabel
137         %251 = OpPhi %6 %172 %170 %252 %183
138         %186 = OpConvertSToF %6 %247
139         %188 = OpFOrdGreaterThanEqual %26 %186 %89
140                OpSelectionMerge %191 None
141                OpBranchConditional %188 %189 %191
142         %189 = OpLabel
143                OpBranch %195
144         %191 = OpLabel
145                OpBranch %192
146         %192 = OpLabel
147         %194 = OpIAdd %15 %247 %18
148                OpBranch %162
149         %195 = OpLabel
150         %259 = OpPhi %6 %261 %162 %251 %189
151         %257 = OpPhi %6 %248 %162 %251 %189
152         %253 = OpPhi %26 %149 %162 %152 %189
153                OpSelectionMerge %197 None
154                OpBranchConditional %253 %199 %197
155         %197 = OpLabel
156                OpBranch %199
157         %199 = OpLabel
158         %258 = OpPhi %6 %259 %195 %257 %197
159          %93 = OpAccessChain %7 %66 %77
160                OpStore %93 %258
161          %96 = OpAccessChain %87 %85 %95
162          %97 = OpLoad %6 %96
163                OpSelectionMerge %245 None
164                OpSwitch %77 %207
165         %207 = OpLabel
166                OpBranch %208
167         %208 = OpLabel
168         %265 = OpPhi %6 %14 %207 %268 %238
169         %264 = OpPhi %15 %18 %207 %240 %238
170         %211 = OpSLessThan %26 %264 %25
171                OpLoopMerge %241 %238 None
172                OpBranchConditional %211 %212 %241
173         %212 = OpLabel
174         %214 = OpSMod %15 %264 %29
175         %215 = OpIEqual %26 %214 %31
176                OpSelectionMerge %230 None
177                OpBranchConditional %215 %216 %219
178         %216 = OpLabel
179         %218 = OpFAdd %6 %265 %35
180                OpBranch %230
181         %219 = OpLabel
182         %221 = OpConvertSToF %6 %264
183         %223 = OpExtInst %6 %1 Round %82
184         %224 = OpFMod %6 %221 %223
185         %225 = OpFOrdLessThanEqual %26 %224 %44
186                OpSelectionMerge %229 None
187                OpBranchConditional %225 %226 %229
188         %226 = OpLabel
189         %228 = OpFAdd %6 %265 %48
190                OpBranch %229
191         %229 = OpLabel
192         %269 = OpPhi %6 %265 %219 %228 %226
193                OpBranch %230
194         %230 = OpLabel
195         %268 = OpPhi %6 %218 %216 %269 %229
196         %232 = OpConvertSToF %6 %264
197         %234 = OpFOrdGreaterThanEqual %26 %232 %97
198                OpSelectionMerge %237 None
199                OpBranchConditional %234 %235 %237
200         %235 = OpLabel
201                OpBranch %241
202         %237 = OpLabel
203                OpBranch %238
204         %238 = OpLabel
205         %240 = OpIAdd %15 %264 %18
206                OpBranch %208
207         %241 = OpLabel
208         %276 = OpPhi %6 %261 %208 %268 %235
209         %274 = OpPhi %6 %265 %208 %268 %235
210         %270 = OpPhi %26 %149 %208 %152 %235
211                OpSelectionMerge %243 None
212                OpBranchConditional %270 %245 %243
213         %243 = OpLabel
214                OpBranch %245
215         %245 = OpLabel
216         %275 = OpPhi %6 %276 %241 %274 %243
217         %101 = OpAccessChain %7 %66 %95
218                OpStore %101 %275
219         %103 = OpLoad %6 %93
220         %105 = OpLoad %6 %101
221         %106 = OpFAdd %6 %103 %105
222         %108 = OpAccessChain %7 %66 %107
223                OpStore %108 %106
224                OpBranch %110
225         %110 = OpLabel
226         %285 = OpPhi %15 %31 %245 %135 %113
227         %117 = OpSLessThan %26 %285 %116
228                OpLoopMerge %112 %113 None
229                OpBranchConditional %117 %111 %112
230         %111 = OpLabel
231         %119 = OpAccessChain %7 %66 %285
232         %120 = OpLoad %6 %119
233         %122 = OpFOrdGreaterThanEqual %26 %120 %121
234                OpSelectionMerge %124 None
235                OpBranchConditional %122 %123 %124
236         %123 = OpLabel
237         %128 = OpLoad %6 %119
238         %131 = OpLoad %6 %119
239         %132 = OpFMul %6 %128 %131
240                OpStore %119 %132
241                OpBranch %124
242         %124 = OpLabel
243                OpBranch %113
244         %113 = OpLabel
245         %135 = OpIAdd %15 %285 %18
246                OpBranch %110
247         %112 = OpLabel
248         %138 = OpLoad %64 %66
249         %139 = OpExtInst %64 %1 FAbs %138
250         %140 = OpExtInst %64 %1 Normalize %139
251         %141 = OpCompositeExtract %6 %140 0
252         %142 = OpCompositeExtract %6 %140 1
253         %143 = OpCompositeExtract %6 %140 2
254         %144 = OpCompositeConstruct %83 %141 %142 %143 %121
255                OpStore %137 %144
256                OpReturn
257                OpFunctionEnd
258 END
259
260 # uniforms for reference
261
262 # resolution
263 BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
264  256.0 256.0
265 END
266
267 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
268
269 PIPELINE graphics reference_pipeline
270   ATTACH reference_vertex_shader
271   ATTACH reference_fragment_shader
272   FRAMEBUFFER_SIZE 256 256
273   BIND BUFFER reference_framebuffer AS color LOCATION 0
274   BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
275 END
276 CLEAR_COLOR reference_pipeline 0 0 0 255
277
278 CLEAR reference_pipeline
279 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
280
281
282 SHADER vertex variant_vertex_shader PASSTHROUGH
283
284 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
285 ; SPIR-V
286 ; Version: 1.0
287 ; Generator: Khronos Glslang Reference Front End; 7
288 ; Bound: 290
289 ; Schema: 0
290                OpCapability Shader
291           %1 = OpExtInstImport "GLSL.std.450"
292                OpMemoryModel Logical GLSL450
293                OpEntryPoint Fragment %4 "main" %85 %137
294                OpExecutionMode %4 OriginUpperLeft
295                OpSource ESSL 320
296                OpName %4 "main"
297                OpName %66 "c"
298                OpName %73 "buf0"
299                OpMemberName %73 0 "resolution"
300                OpName %75 ""
301                OpName %85 "gl_FragCoord"
302                OpName %137 "_GLF_color"
303                OpMemberDecorate %73 0 Offset 0
304                OpDecorate %73 Block
305                OpDecorate %75 DescriptorSet 0
306                OpDecorate %75 Binding 0
307                OpDecorate %85 BuiltIn FragCoord
308                OpDecorate %137 Location 0
309           %2 = OpTypeVoid
310           %3 = OpTypeFunction %2
311           %6 = OpTypeFloat 32
312           %7 = OpTypePointer Function %6
313          %14 = OpConstant %6 -0.5
314          %15 = OpTypeInt 32 1
315          %18 = OpConstant %15 1
316          %25 = OpConstant %15 800
317          %26 = OpTypeBool
318          %29 = OpConstant %15 32
319          %31 = OpConstant %15 0
320          %35 = OpConstant %6 0.400000006
321          %44 = OpConstant %6 0.00999999978
322          %48 = OpConstant %6 100
323          %64 = OpTypeVector %6 3
324          %65 = OpTypePointer Function %64
325          %67 = OpConstant %6 7
326          %68 = OpConstant %6 8
327          %69 = OpConstant %6 9
328          %70 = OpConstantComposite %64 %67 %68 %69
329          %72 = OpTypeVector %6 2
330          %73 = OpTypeStruct %72
331          %74 = OpTypePointer Uniform %73
332          %75 = OpVariable %74 Uniform
333          %76 = OpTypeInt 32 0
334          %77 = OpConstant %76 0
335          %78 = OpTypePointer Uniform %6
336          %83 = OpTypeVector %6 4
337          %84 = OpTypePointer Input %83
338          %85 = OpVariable %84 Input
339          %87 = OpTypePointer Input %6
340          %95 = OpConstant %76 1
341         %107 = OpConstant %76 2
342         %116 = OpConstant %15 3
343         %121 = OpConstant %6 1
344         %136 = OpTypePointer Output %83
345         %137 = OpVariable %136 Output
346         %149 = OpConstantFalse %26
347         %152 = OpConstantTrue %26
348         %261 = OpUndef %6
349         %289 = OpConstant %6 0.125
350           %4 = OpFunction %2 None %3
351           %5 = OpLabel
352          %66 = OpVariable %65 Function
353                OpStore %66 %70
354          %79 = OpAccessChain %78 %75 %31 %77
355          %80 = OpLoad %6 %79
356          %81 = OpFMul %6 %80 %289
357          %82 = OpExtInst %6 %1 Round %81
358          %88 = OpAccessChain %87 %85 %77
359          %89 = OpLoad %6 %88
360                OpSelectionMerge %199 None
361                OpSwitch %77 %161
362         %161 = OpLabel
363                OpBranch %162
364         %162 = OpLabel
365         %248 = OpPhi %6 %14 %161 %251 %192
366         %247 = OpPhi %15 %18 %161 %194 %192
367         %165 = OpSLessThan %26 %247 %25
368                OpLoopMerge %195 %192 None
369                OpBranchConditional %165 %166 %195
370         %166 = OpLabel
371         %168 = OpSMod %15 %247 %29
372         %169 = OpIEqual %26 %168 %31
373                OpSelectionMerge %184 None
374                OpBranchConditional %169 %170 %173
375         %170 = OpLabel
376         %172 = OpFAdd %6 %248 %35
377                OpBranch %184
378         %173 = OpLabel
379         %175 = OpConvertSToF %6 %247
380         %177 = OpExtInst %6 %1 Round %82
381         %178 = OpFMod %6 %175 %177
382         %179 = OpFOrdLessThanEqual %26 %178 %44
383                OpSelectionMerge %183 None
384                OpBranchConditional %179 %180 %183
385         %180 = OpLabel
386         %182 = OpFAdd %6 %248 %48
387                OpBranch %183
388         %183 = OpLabel
389         %252 = OpPhi %6 %248 %173 %182 %180
390                OpBranch %184
391         %184 = OpLabel
392         %251 = OpPhi %6 %172 %170 %252 %183
393         %186 = OpConvertSToF %6 %247
394         %188 = OpFOrdGreaterThanEqual %26 %186 %89
395                OpSelectionMerge %191 None
396                OpBranchConditional %188 %189 %191
397         %189 = OpLabel
398                OpBranch %195
399         %191 = OpLabel
400                OpBranch %192
401         %192 = OpLabel
402         %194 = OpIAdd %15 %247 %18
403                OpBranch %162
404         %195 = OpLabel
405         %259 = OpPhi %6 %261 %162 %251 %189
406         %257 = OpPhi %6 %248 %162 %251 %189
407         %253 = OpPhi %26 %149 %162 %152 %189
408                OpSelectionMerge %197 None
409                OpBranchConditional %253 %199 %197
410         %197 = OpLabel
411                OpBranch %199
412         %199 = OpLabel
413         %258 = OpPhi %6 %259 %195 %257 %197
414          %93 = OpAccessChain %7 %66 %77
415                OpStore %93 %258
416          %96 = OpAccessChain %87 %85 %95
417          %97 = OpLoad %6 %96
418                OpSelectionMerge %245 None
419                OpSwitch %77 %207
420         %207 = OpLabel
421                OpBranch %208
422         %208 = OpLabel
423         %265 = OpPhi %6 %14 %207 %268 %238
424         %264 = OpPhi %15 %18 %207 %240 %238
425         %211 = OpSLessThan %26 %264 %25
426                OpLoopMerge %241 %238 None
427                OpBranchConditional %211 %212 %241
428         %212 = OpLabel
429         %214 = OpSMod %15 %264 %29
430         %215 = OpIEqual %26 %214 %31
431                OpSelectionMerge %230 None
432                OpBranchConditional %215 %216 %219
433         %219 = OpLabel
434         %221 = OpConvertSToF %6 %264
435         %223 = OpExtInst %6 %1 Round %82
436         %224 = OpFMod %6 %221 %223
437         %225 = OpFOrdLessThanEqual %26 %224 %44
438                OpSelectionMerge %229 None
439                OpBranchConditional %225 %226 %229
440         %226 = OpLabel
441         %228 = OpFAdd %6 %265 %48
442                OpBranch %229
443         %229 = OpLabel
444         %269 = OpPhi %6 %265 %219 %228 %226
445                OpBranch %230
446         %230 = OpLabel
447         %268 = OpPhi %6 %218 %216 %269 %229
448         %232 = OpConvertSToF %6 %264
449         %234 = OpFOrdGreaterThanEqual %26 %232 %97
450                OpSelectionMerge %237 None
451                OpBranchConditional %234 %235 %237
452         %235 = OpLabel
453                OpBranch %241
454         %241 = OpLabel
455         %276 = OpPhi %6 %261 %208 %268 %235
456         %274 = OpPhi %6 %265 %208 %268 %235
457         %270 = OpPhi %26 %149 %208 %152 %235
458                OpSelectionMerge %243 None
459                OpBranchConditional %270 %245 %243
460         %216 = OpLabel
461         %218 = OpFAdd %6 %265 %35
462                OpBranch %230
463         %237 = OpLabel
464                OpBranch %238
465         %238 = OpLabel
466         %240 = OpIAdd %15 %264 %18
467                OpBranch %208
468         %243 = OpLabel
469                OpBranch %245
470         %245 = OpLabel
471         %275 = OpPhi %6 %276 %241 %274 %243
472         %101 = OpAccessChain %7 %66 %95
473                OpStore %101 %275
474         %103 = OpLoad %6 %93
475         %105 = OpLoad %6 %101
476         %106 = OpFAdd %6 %103 %105
477         %108 = OpAccessChain %7 %66 %107
478                OpStore %108 %106
479                OpBranch %110
480         %110 = OpLabel
481         %285 = OpPhi %15 %31 %245 %135 %113
482         %117 = OpSLessThan %26 %285 %116
483                OpLoopMerge %112 %113 None
484                OpBranchConditional %117 %111 %112
485         %111 = OpLabel
486         %119 = OpAccessChain %7 %66 %285
487         %120 = OpLoad %6 %119
488         %122 = OpFOrdGreaterThanEqual %26 %120 %121
489                OpSelectionMerge %124 None
490                OpBranchConditional %122 %123 %124
491         %123 = OpLabel
492         %128 = OpLoad %6 %119
493         %131 = OpLoad %6 %119
494         %132 = OpFMul %6 %128 %131
495                OpStore %119 %132
496                OpBranch %124
497         %124 = OpLabel
498                OpBranch %113
499         %113 = OpLabel
500         %135 = OpIAdd %15 %285 %18
501                OpBranch %110
502         %112 = OpLabel
503         %138 = OpLoad %64 %66
504         %139 = OpExtInst %64 %1 FAbs %138
505         %140 = OpExtInst %64 %1 Normalize %139
506         %141 = OpCompositeExtract %6 %140 0
507         %142 = OpCompositeExtract %6 %140 1
508         %143 = OpCompositeExtract %6 %140 2
509         %144 = OpCompositeConstruct %83 %141 %142 %143 %121
510                OpStore %137 %144
511                OpReturn
512                OpFunctionEnd
513 END
514
515 # uniforms for variant
516
517 # resolution
518 BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
519  256.0 256.0
520 END
521
522 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
523
524 PIPELINE graphics variant_pipeline
525   ATTACH variant_vertex_shader
526   ATTACH variant_fragment_shader
527   FRAMEBUFFER_SIZE 256 256
528   BIND BUFFER variant_framebuffer AS color LOCATION 0
529   BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
530 END
531 CLEAR_COLOR variant_pipeline 0 0 0 255
532
533 CLEAR variant_pipeline
534 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
535
536 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005