Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-tail-duplicator-for-for-for.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 coverage-gap found by the GraphicsFuzz project.
19
20 # Short description: A fragment shader that covers a specific tail duplicator code path
21
22 # The test passes because the shader always writes red.
23
24 SHADER vertex variant_vertex_shader PASSTHROUGH
25
26 # variant_fragment_shader is derived from the following GLSL:
27 # #version 310 es
28 # #define _int_0 _GLF_uniform_int_values[0]
29 # #define _int_4 _GLF_uniform_int_values[1]
30 # #define _float_0_0 _GLF_uniform_float_values[0]
31 #
32 # precision highp float;
33 #
34 # precision highp int;
35 #
36 # // Contents of _GLF_uniform_int_values: 0
37 # layout(set = 0, binding = 0) uniform buf0
38 # {
39 #     int _GLF_uniform_int_values[2];
40 # };
41 #
42 # // Contents of _GLF_uniform_float_values: 0.0
43 # layout(set = 0, binding = 1) uniform buf1
44 # {
45 #     float _GLF_uniform_float_values[1];
46 # };
47 #
48 # layout(location = 0) out vec4 _GLF_color;
49 #
50 # void main()
51 # {
52 #     vec4 color = vec4(1.0);
53 #
54 #     for (int i = _int_0; i < _int_4; i++)
55 #     {
56 #         switch (i)
57 #         {
58 #             case 1:
59 #                 // Never entered.
60 #                 for (int j = _int_0; i > i; j++)
61 #                 {
62 #                     for (int k = _int_0; k < i; k++)
63 #                     {
64 #                         color[k] = _float_0_0;
65 #                     }
66 #                 }
67 #
68 #                 color[i] = _float_0_0;
69 #                 break;
70 #
71 #             case 2:
72 #                 color[i] = _float_0_0;
73 #                 break;
74 #         }
75 #     }
76 #
77 #     _GLF_color = color;
78 # }
79 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
80 ; SPIR-V
81 ; Version: 1.0
82 ; Generator: Khronos Glslang Reference Front End; 8
83 ; Bound: 93
84 ; Schema: 0
85                OpCapability Shader
86           %1 = OpExtInstImport "GLSL.std.450"
87                OpMemoryModel Logical GLSL450
88                OpEntryPoint Fragment %4 "main" %91
89                OpExecutionMode %4 OriginUpperLeft
90                OpSource ESSL 310
91                OpName %4 "main"
92                OpName %9 "color"
93                OpName %14 "i"
94                OpName %18 "buf0"
95                OpMemberName %18 0 "_GLF_uniform_int_values"
96                OpName %20 ""
97                OpName %40 "j"
98                OpName %51 "k"
99                OpName %65 "buf1"
100                OpMemberName %65 0 "_GLF_uniform_float_values"
101                OpName %67 ""
102                OpName %91 "_GLF_color"
103                OpDecorate %17 ArrayStride 16
104                OpMemberDecorate %18 0 Offset 0
105                OpDecorate %18 Block
106                OpDecorate %20 DescriptorSet 0
107                OpDecorate %20 Binding 0
108                OpDecorate %64 ArrayStride 16
109                OpMemberDecorate %65 0 Offset 0
110                OpDecorate %65 Block
111                OpDecorate %67 DescriptorSet 0
112                OpDecorate %67 Binding 1
113                OpDecorate %91 Location 0
114           %2 = OpTypeVoid
115           %3 = OpTypeFunction %2
116           %6 = OpTypeFloat 32
117           %7 = OpTypeVector %6 4
118           %8 = OpTypePointer Function %7
119          %10 = OpConstant %6 1
120          %11 = OpConstantComposite %7 %10 %10 %10 %10
121          %12 = OpTypeInt 32 1
122          %13 = OpTypePointer Function %12
123          %15 = OpTypeInt 32 0
124          %16 = OpConstant %15 2
125          %17 = OpTypeArray %12 %16
126          %18 = OpTypeStruct %17
127          %19 = OpTypePointer Uniform %18
128          %20 = OpVariable %19 Uniform
129          %21 = OpConstant %12 0
130          %22 = OpTypePointer Uniform %12
131          %31 = OpConstant %12 1
132          %34 = OpTypeBool
133          %63 = OpConstant %15 1
134          %64 = OpTypeArray %6 %63
135          %65 = OpTypeStruct %64
136          %66 = OpTypePointer Uniform %65
137          %67 = OpVariable %66 Uniform
138          %68 = OpTypePointer Uniform %6
139          %71 = OpTypePointer Function %6
140          %90 = OpTypePointer Output %7
141          %91 = OpVariable %90 Output
142           %4 = OpFunction %2 None %3
143           %5 = OpLabel
144           %9 = OpVariable %8 Function
145          %14 = OpVariable %13 Function
146          %40 = OpVariable %13 Function
147          %51 = OpVariable %13 Function
148                OpStore %9 %11
149          %23 = OpAccessChain %22 %20 %21 %21
150          %24 = OpLoad %12 %23
151                OpStore %14 %24
152                OpBranch %25
153          %25 = OpLabel
154                OpLoopMerge %27 %28 None
155                OpBranch %29
156          %29 = OpLabel
157          %30 = OpLoad %12 %14
158          %32 = OpAccessChain %22 %20 %21 %31
159          %33 = OpLoad %12 %32
160          %35 = OpSLessThan %34 %30 %33
161                OpBranchConditional %35 %26 %27
162          %26 = OpLabel
163          %36 = OpLoad %12 %14
164                OpSelectionMerge %39 None
165                OpSwitch %36 %39 1 %37 2 %38
166          %37 = OpLabel
167          %41 = OpAccessChain %22 %20 %21 %21
168          %42 = OpLoad %12 %41
169                OpStore %40 %42
170                OpBranch %43
171          %43 = OpLabel
172                OpLoopMerge %45 %46 None
173                OpBranch %47
174          %47 = OpLabel
175          %48 = OpLoad %12 %14
176          %49 = OpLoad %12 %14
177          %50 = OpSGreaterThan %34 %48 %49
178                OpBranchConditional %50 %44 %45
179          %44 = OpLabel
180          %52 = OpAccessChain %22 %20 %21 %21
181          %53 = OpLoad %12 %52
182                OpStore %51 %53
183                OpBranch %54
184          %54 = OpLabel
185                OpLoopMerge %56 %57 None
186                OpBranch %58
187          %58 = OpLabel
188          %59 = OpLoad %12 %51
189          %60 = OpLoad %12 %14
190          %61 = OpSLessThan %34 %59 %60
191                OpBranchConditional %61 %55 %56
192          %55 = OpLabel
193          %62 = OpLoad %12 %51
194          %69 = OpAccessChain %68 %67 %21 %21
195          %70 = OpLoad %6 %69
196          %72 = OpAccessChain %71 %9 %62
197                OpStore %72 %70
198                OpBranch %57
199          %57 = OpLabel
200          %73 = OpLoad %12 %51
201          %74 = OpIAdd %12 %73 %31
202                OpStore %51 %74
203                OpBranch %54
204          %56 = OpLabel
205                OpBranch %46
206          %46 = OpLabel
207          %75 = OpLoad %12 %40
208          %76 = OpIAdd %12 %75 %31
209                OpStore %40 %76
210                OpBranch %43
211          %45 = OpLabel
212          %77 = OpLoad %12 %14
213          %78 = OpAccessChain %68 %67 %21 %21
214          %79 = OpLoad %6 %78
215          %80 = OpAccessChain %71 %9 %77
216                OpStore %80 %79
217                OpBranch %39
218          %38 = OpLabel
219          %82 = OpLoad %12 %14
220          %83 = OpAccessChain %68 %67 %21 %21
221          %84 = OpLoad %6 %83
222          %85 = OpAccessChain %71 %9 %82
223                OpStore %85 %84
224                OpBranch %39
225          %39 = OpLabel
226                OpBranch %28
227          %28 = OpLabel
228          %88 = OpLoad %12 %14
229          %89 = OpIAdd %12 %88 %31
230                OpStore %14 %89
231                OpBranch %25
232          %27 = OpLabel
233          %92 = OpLoad %7 %9
234                OpStore %91 %92
235                OpReturn
236                OpFunctionEnd
237 END
238
239 # uniforms for variant
240
241 # _GLF_uniform_int_values
242 BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
243  0 4
244 END
245 # _GLF_uniform_float_values
246 BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
247  0.0
248 END
249
250 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
251
252 PIPELINE graphics variant_pipeline
253   ATTACH variant_vertex_shader
254   ATTACH variant_fragment_shader
255   FRAMEBUFFER_SIZE 256 256
256   BIND BUFFER variant_framebuffer AS color LOCATION 0
257   BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0
258   BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1
259 END
260 CLEAR_COLOR variant_pipeline 0 0 0 255
261
262 CLEAR variant_pipeline
263 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
264
265 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255