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