Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-two-loops-never-iterated.amber
1 #!amber
2
3 # Copyright 2022 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 specific LLVM code paths
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 320 es
28 # #define _int_1 _GLF_uniform_int_values[0]
29 # #define _int_0 _GLF_uniform_int_values[1]
30 #
31 # precision highp float;
32 # precision highp int;
33 #
34 # // Contents of _GLF_uniform_int_values: [1, 0]
35 # layout(set = 0, binding = 0) uniform buf0
36 # {
37 #     int _GLF_uniform_int_values[2];
38 # };
39 #
40 # // Contents of one: 1
41 # layout(set = 0, binding = 1) uniform buf1
42 # {
43 #     int one;
44 # };
45 #
46 # layout(location = 0) out vec4 _GLF_color;
47 #
48 # void main()
49 # {
50 #     _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
51 #
52 #     // Never iterated.
53 #     for(int i = _int_1; one != _int_1; _int_1)
54 #     {
55 #         _GLF_color = vec4(_int_0);
56 #     }
57 #
58 #     // Never iterated.
59 #     for(int i = _int_1; i < one; i ++)
60 #     {
61 #         _GLF_color = vec4(_int_0);
62 #     }
63 # }
64 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
65 ; SPIR-V
66 ; Version: 1.0
67 ; Generator: Khronos Glslang Reference Front End; 10
68 ; Bound: 73
69 ; Schema: 0
70                OpCapability Shader
71           %1 = OpExtInstImport "GLSL.std.450"
72                OpMemoryModel Logical GLSL450
73                OpEntryPoint Fragment %4 "main" %9
74                OpExecutionMode %4 OriginUpperLeft
75                OpSource ESSL 320
76                OpName %4 "main"
77                OpName %9 "_GLF_color"
78                OpName %14 "buf0"
79                OpMemberName %14 0 "_GLF_uniform_int_values"
80                OpName %16 ""
81                OpName %34 "i"
82                OpName %42 "buf1"
83                OpMemberName %42 0 "one"
84                OpName %44 ""
85                OpName %55 "i"
86                OpDecorate %9 Location 0
87                OpDecorate %13 ArrayStride 16
88                OpMemberDecorate %14 0 Offset 0
89                OpDecorate %14 Block
90                OpDecorate %16 DescriptorSet 0
91                OpDecorate %16 Binding 0
92                OpMemberDecorate %42 0 Offset 0
93                OpDecorate %42 Block
94                OpDecorate %44 DescriptorSet 0
95                OpDecorate %44 Binding 1
96           %2 = OpTypeVoid
97           %3 = OpTypeFunction %2
98           %6 = OpTypeFloat 32
99           %7 = OpTypeVector %6 4
100           %8 = OpTypePointer Output %7
101           %9 = OpVariable %8 Output
102          %10 = OpTypeInt 32 1
103          %11 = OpTypeInt 32 0
104          %12 = OpConstant %11 2
105          %13 = OpTypeArray %10 %12
106          %14 = OpTypeStruct %13
107          %15 = OpTypePointer Uniform %14
108          %16 = OpVariable %15 Uniform
109          %17 = OpConstant %10 0
110          %18 = OpTypePointer Uniform %10
111          %22 = OpConstant %10 1
112          %33 = OpTypePointer Function %10
113          %42 = OpTypeStruct %10
114          %43 = OpTypePointer Uniform %42
115          %44 = OpVariable %43 Uniform
116          %49 = OpTypeBool
117           %4 = OpFunction %2 None %3
118           %5 = OpLabel
119          %34 = OpVariable %33 Function
120          %55 = OpVariable %33 Function
121          %19 = OpAccessChain %18 %16 %17 %17
122          %20 = OpLoad %10 %19
123          %21 = OpConvertSToF %6 %20
124          %23 = OpAccessChain %18 %16 %17 %22
125          %24 = OpLoad %10 %23
126          %25 = OpConvertSToF %6 %24
127          %26 = OpAccessChain %18 %16 %17 %22
128          %27 = OpLoad %10 %26
129          %28 = OpConvertSToF %6 %27
130          %29 = OpAccessChain %18 %16 %17 %17
131          %30 = OpLoad %10 %29
132          %31 = OpConvertSToF %6 %30
133          %32 = OpCompositeConstruct %7 %21 %25 %28 %31
134                OpStore %9 %32
135          %35 = OpAccessChain %18 %16 %17 %17
136          %36 = OpLoad %10 %35
137                OpStore %34 %36
138                OpBranch %37
139          %37 = OpLabel
140                OpLoopMerge %39 %40 None
141                OpBranch %41
142          %41 = OpLabel
143          %45 = OpAccessChain %18 %44 %17
144          %46 = OpLoad %10 %45
145          %47 = OpAccessChain %18 %16 %17 %17
146          %48 = OpLoad %10 %47
147          %50 = OpINotEqual %49 %46 %48
148                OpBranchConditional %50 %38 %39
149          %38 = OpLabel
150          %51 = OpAccessChain %18 %16 %17 %22
151          %52 = OpLoad %10 %51
152          %53 = OpConvertSToF %6 %52
153          %54 = OpCompositeConstruct %7 %53 %53 %53 %53
154                OpStore %9 %54
155                OpBranch %40
156          %40 = OpLabel
157                OpBranch %37
158          %39 = OpLabel
159          %56 = OpAccessChain %18 %16 %17 %17
160          %57 = OpLoad %10 %56
161                OpStore %55 %57
162                OpBranch %58
163          %58 = OpLabel
164                OpLoopMerge %60 %61 None
165                OpBranch %62
166          %62 = OpLabel
167          %63 = OpLoad %10 %55
168          %64 = OpAccessChain %18 %44 %17
169          %65 = OpLoad %10 %64
170          %66 = OpSLessThan %49 %63 %65
171                OpBranchConditional %66 %59 %60
172          %59 = OpLabel
173          %67 = OpAccessChain %18 %16 %17 %22
174          %68 = OpLoad %10 %67
175          %69 = OpConvertSToF %6 %68
176          %70 = OpCompositeConstruct %7 %69 %69 %69 %69
177                OpStore %9 %70
178                OpBranch %61
179          %61 = OpLabel
180          %71 = OpLoad %10 %55
181          %72 = OpIAdd %10 %71 %22
182                OpStore %55 %72
183                OpBranch %58
184          %60 = OpLabel
185                OpReturn
186                OpFunctionEnd
187 END
188
189 # uniforms for variant
190
191 # one
192 BUFFER variant_one DATA_TYPE int32 STD140 DATA
193  1
194 END
195 # _GLF_uniform_int_values
196 BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
197  1 0
198 END
199
200 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
201
202 PIPELINE graphics variant_pipeline
203   ATTACH variant_vertex_shader
204   ATTACH variant_fragment_shader
205   FRAMEBUFFER_SIZE 32 32
206   BIND BUFFER variant_framebuffer AS color LOCATION 0
207   BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 1
208   BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0
209 END
210 CLEAR_COLOR variant_pipeline 0 0 0 255
211
212 CLEAR variant_pipeline
213 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
214
215 EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255