Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-one-bitwise-and-bitwise-or-full-bits.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 # Optimized using spirv-opt with the following arguments:
25 # '--eliminate-dead-branches'
26 # '--merge-blocks'
27 # '--eliminate-dead-code-aggressive'
28 # '--convert-local-access-chains'
29 # '--eliminate-dead-branches'
30 # '--merge-blocks'
31 # '--eliminate-local-multi-store'
32 # '--reduce-load-size'
33 # '--convert-local-access-chains'
34 # '--eliminate-local-multi-store'
35 # '--combine-access-chains'
36 # '--vector-dce'
37 # '--scalar-replacement=100'
38 # '--eliminate-dead-branches'
39 # '--merge-blocks'
40 # '--copy-propagate-arrays'
41 # '--eliminate-dead-branches'
42 # '--scalar-replacement=100'
43 # '--eliminate-dead-branches'
44 # '--merge-blocks'
45 # '--vector-dce'
46 # '--convert-local-access-chains'
47 # '--combine-access-chains'
48 # '--redundancy-elimination'
49 # '--inline-entry-points-exhaustive'
50 # '--combine-access-chains'
51 # '--eliminate-dead-branches'
52 # '--eliminate-local-multi-store'
53 # spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af
54
55
56
57 SHADER vertex variant_vertex_shader PASSTHROUGH
58
59 # variant_fragment_shader is derived from the following GLSL:
60 # #version 320 es
61 # #define _int_1 _GLF_uniform_int_values[0]
62 # #define _int_0 _GLF_uniform_int_values[1]
63 #
64 # precision highp int;
65 # precision highp float;
66 #
67 # // Contents of _GLF_uniform_int_values: [1, 0]
68 # layout(set = 0, binding = 0) uniform buf0
69 # {
70 #     int _GLF_uniform_int_values[2];
71 # };
72 #
73 # layout(location = 0) out vec4 _GLF_color;
74 #
75 # void func(int x)
76 # {
77 #     // Always false.
78 #     if(x > _int_1)
79 #     {
80 #         return;
81 #     }
82 #
83 #     ivec2 a = ivec2(_int_1);
84 #     // b = 1 & ((~0 | ~0) >> 1) = 1 & (~0 >> 1) = 1 & ~0 = 1
85 #     int b = _int_1 & (((a.x != _int_1 ? 0 : ~ 0) | (a.x != _int_1 ? 0 : ~ 0)) >> _int_1);
86 #
87 #     // Always true.
88 #     if(b == _int_1)
89 #     {
90 #         _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
91 #     }
92 #     else
93 #     {
94 #         _GLF_color = vec4(_int_0);
95 #     }
96 # }
97 #
98 # void main()
99 # {
100 #     func(_int_1);
101 # }
102 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
103 ; SPIR-V
104 ; Version: 1.0
105 ; Generator: Khronos Glslang Reference Front End; 10
106 ; Bound: 91
107 ; Schema: 0
108                OpCapability Shader
109           %1 = OpExtInstImport "GLSL.std.450"
110                OpMemoryModel Logical GLSL450
111                OpEntryPoint Fragment %4 "main" %65
112                OpExecutionMode %4 OriginUpperLeft
113                OpSource ESSL 320
114                OpName %4 "main"
115                OpName %10 "func(i1;"
116                OpName %9 "x"
117                OpName %16 "buf0"
118                OpMemberName %16 0 "_GLF_uniform_int_values"
119                OpName %18 ""
120                OpName %30 "a"
121                OpName %34 "b"
122                OpName %65 "_GLF_color"
123                OpName %85 "param"
124                OpDecorate %15 ArrayStride 16
125                OpMemberDecorate %16 0 Offset 0
126                OpDecorate %16 Block
127                OpDecorate %18 DescriptorSet 0
128                OpDecorate %18 Binding 0
129                OpDecorate %65 Location 0
130           %2 = OpTypeVoid
131           %3 = OpTypeFunction %2
132           %6 = OpTypeInt 32 1
133           %7 = OpTypePointer Function %6
134           %8 = OpTypeFunction %2 %7
135          %13 = OpTypeInt 32 0
136          %14 = OpConstant %13 2
137          %15 = OpTypeArray %6 %14
138          %16 = OpTypeStruct %15
139          %17 = OpTypePointer Uniform %16
140          %18 = OpVariable %17 Uniform
141          %19 = OpConstant %6 0
142          %20 = OpTypePointer Uniform %6
143          %23 = OpTypeBool
144          %28 = OpTypeVector %6 2
145          %29 = OpTypePointer Function %28
146          %37 = OpConstant %13 0
147          %43 = OpConstant %6 -1
148          %62 = OpTypeFloat 32
149          %63 = OpTypeVector %62 4
150          %64 = OpTypePointer Output %63
151          %65 = OpVariable %64 Output
152          %69 = OpConstant %6 1
153           %4 = OpFunction %2 None %3
154           %5 = OpLabel
155          %85 = OpVariable %7 Function
156          %86 = OpAccessChain %20 %18 %19 %19
157          %87 = OpLoad %6 %86
158                OpStore %85 %87
159          %88 = OpFunctionCall %2 %10 %85
160                OpReturn
161                OpFunctionEnd
162          %10 = OpFunction %2 None %8
163           %9 = OpFunctionParameter %7
164          %11 = OpLabel
165          %30 = OpVariable %29 Function
166          %34 = OpVariable %7 Function
167          %12 = OpLoad %6 %9
168          %21 = OpAccessChain %20 %18 %19 %19
169          %22 = OpLoad %6 %21
170          %24 = OpSGreaterThan %23 %12 %22
171                OpSelectionMerge %26 None
172                OpBranchConditional %24 %25 %26
173          %25 = OpLabel
174                OpReturn
175          %26 = OpLabel
176          %33 = OpCompositeConstruct %28 %22 %22
177                OpStore %30 %33
178          %38 = OpAccessChain %7 %30 %37
179          %89 = OpLoad %28 %30
180          %39 = OpCompositeExtract %6 %89 0
181          %42 = OpINotEqual %23 %39 %22
182          %44 = OpSelect %6 %42 %19 %43
183          %90 = OpLoad %28 %30
184          %46 = OpCompositeExtract %6 %90 0
185          %49 = OpINotEqual %23 %46 %22
186          %50 = OpSelect %6 %49 %19 %43
187          %51 = OpBitwiseOr %6 %44 %50
188          %54 = OpShiftRightArithmetic %6 %51 %22
189          %55 = OpBitwiseAnd %6 %22 %54
190                OpStore %34 %55
191          %59 = OpIEqual %23 %55 %22
192                OpSelectionMerge %61 None
193                OpBranchConditional %59 %60 %80
194          %60 = OpLabel
195          %68 = OpConvertSToF %62 %22
196          %70 = OpAccessChain %20 %18 %19 %69
197          %71 = OpLoad %6 %70
198          %72 = OpConvertSToF %62 %71
199          %79 = OpCompositeConstruct %63 %68 %72 %72 %68
200                OpStore %65 %79
201                OpBranch %61
202          %80 = OpLabel
203          %81 = OpAccessChain %20 %18 %19 %69
204          %82 = OpLoad %6 %81
205          %83 = OpConvertSToF %62 %82
206          %84 = OpCompositeConstruct %63 %83 %83 %83 %83
207                OpStore %65 %84
208                OpBranch %61
209          %61 = OpLabel
210                OpReturn
211                OpFunctionEnd
212 END
213
214 # uniforms for variant
215
216 # _GLF_uniform_int_values
217 BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
218  1 0
219 END
220
221 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
222
223 PIPELINE graphics variant_pipeline
224   ATTACH variant_vertex_shader
225   ATTACH variant_fragment_shader
226   FRAMEBUFFER_SIZE 32 32
227   BIND BUFFER variant_framebuffer AS color LOCATION 0
228   BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0
229 END
230 CLEAR_COLOR variant_pipeline 0 0 0 255
231
232 CLEAR variant_pipeline
233 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
234
235 EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255