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