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