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