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