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