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