Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-x86-isel-lowering-determinant-exp-acos.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 x86 isel lowering code path
21
22 # The test passes because the shader always writes red.
23
24 # Optimized using spirv-opt with the following arguments:
25 # '--eliminate-dead-branches'
26 # '--merge-return'
27 # '--eliminate-dead-branches'
28 # '--merge-blocks'
29 # spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a
30
31
32
33 SHADER vertex variant_vertex_shader PASSTHROUGH
34
35 # variant_fragment_shader is derived from the following GLSL:
36 # #version 310 es
37 # #define _float_0_0 _GLF_uniform_float_values[0]
38 # #define _float_790_0 _GLF_uniform_float_values[1]
39 # #define _float_2_0 _GLF_uniform_float_values[2]
40 # #define _float_4_0 _GLF_uniform_float_values[3]
41 # #define _float_1_0 _GLF_uniform_float_values[4]
42 #
43 # precision highp float;
44 #
45 # // Contents of _GLF_uniform_float_values: [0.0, 790.0, 2.0, 4.0, 1.0]
46 # layout(set = 0, binding = 0) uniform buf0
47 # {
48 #     float _GLF_uniform_float_values[5];
49 # };
50 #
51 # layout(location = 0) out vec4 _GLF_color;
52 #
53 # void main()
54 # {
55 #     // a becomes 0.
56 #     float a = determinant(mat2(_float_2_0, _float_4_0, _float_1_0, _float_2_0));
57 #
58 #     //b becomes 0.
59 #     float b = float(mat2(a));
60 #
61 #     // This results in an undefined value, but not in undefined behavior.
62 #     // v1.x becomes undefined and v1.y becomes 0.
63 #     vec2 v1 = acos(exp(vec2(_float_790_0, b)));
64 #
65 #     _GLF_color = vec4(v1.x);
66 #
67 #     if (v1.y == _float_0_0)
68 #     {
69 #         _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0);
70 #     }
71 # }
72 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
73 ; SPIR-V
74 ; Version: 1.0
75 ; Generator: Khronos Glslang Reference Front End; 10
76 ; Bound: 77
77 ; Schema: 0
78                OpCapability Shader
79           %1 = OpExtInstImport "GLSL.std.450"
80                OpMemoryModel Logical GLSL450
81                OpEntryPoint Fragment %4 "main" %54
82                OpExecutionMode %4 OriginUpperLeft
83                OpSource ESSL 310
84                OpName %4 "main"
85                OpName %8 "a"
86                OpName %12 "buf0"
87                OpMemberName %12 0 "_GLF_uniform_float_values"
88                OpName %14 ""
89                OpName %37 "b"
90                OpName %44 "v1"
91                OpName %54 "_GLF_color"
92                OpDecorate %11 ArrayStride 16
93                OpMemberDecorate %12 0 Offset 0
94                OpDecorate %12 Block
95                OpDecorate %14 DescriptorSet 0
96                OpDecorate %14 Binding 0
97                OpDecorate %54 Location 0
98           %2 = OpTypeVoid
99           %3 = OpTypeFunction %2
100           %6 = OpTypeFloat 32
101           %7 = OpTypePointer Function %6
102           %9 = OpTypeInt 32 0
103          %10 = OpConstant %9 5
104          %11 = OpTypeArray %6 %10
105          %12 = OpTypeStruct %11
106          %13 = OpTypePointer Uniform %12
107          %14 = OpVariable %13 Uniform
108          %15 = OpTypeInt 32 1
109          %16 = OpConstant %15 0
110          %17 = OpConstant %15 2
111          %18 = OpTypePointer Uniform %6
112          %21 = OpConstant %15 3
113          %24 = OpConstant %15 4
114          %29 = OpTypeVector %6 2
115          %30 = OpTypeMatrix %29 2
116          %31 = OpConstant %6 1
117          %32 = OpConstant %6 0
118          %43 = OpTypePointer Function %29
119          %45 = OpConstant %15 1
120          %52 = OpTypeVector %6 4
121          %53 = OpTypePointer Output %52
122          %54 = OpVariable %53 Output
123          %55 = OpConstant %9 0
124          %59 = OpConstant %9 1
125          %64 = OpTypeBool
126           %4 = OpFunction %2 None %3
127           %5 = OpLabel
128           %8 = OpVariable %7 Function
129          %37 = OpVariable %7 Function
130          %44 = OpVariable %43 Function
131          %19 = OpAccessChain %18 %14 %16 %17
132          %20 = OpLoad %6 %19
133          %22 = OpAccessChain %18 %14 %16 %21
134          %23 = OpLoad %6 %22
135          %25 = OpAccessChain %18 %14 %16 %24
136          %26 = OpLoad %6 %25
137          %27 = OpAccessChain %18 %14 %16 %17
138          %28 = OpLoad %6 %27
139          %33 = OpCompositeConstruct %29 %20 %23
140          %34 = OpCompositeConstruct %29 %26 %28
141          %35 = OpCompositeConstruct %30 %33 %34
142          %36 = OpExtInst %6 %1 Determinant %35
143                OpStore %8 %36
144          %38 = OpLoad %6 %8
145          %39 = OpCompositeConstruct %29 %38 %32
146          %40 = OpCompositeConstruct %29 %32 %38
147          %41 = OpCompositeConstruct %30 %39 %40
148          %42 = OpCompositeExtract %6 %41 0 0
149                OpStore %37 %42
150          %46 = OpAccessChain %18 %14 %16 %45
151          %47 = OpLoad %6 %46
152          %48 = OpLoad %6 %37
153          %49 = OpCompositeConstruct %29 %47 %48
154          %50 = OpExtInst %29 %1 Exp %49
155          %51 = OpExtInst %29 %1 Acos %50
156                OpStore %44 %51
157          %56 = OpAccessChain %7 %44 %55
158          %57 = OpLoad %6 %56
159          %58 = OpCompositeConstruct %52 %57 %57 %57 %57
160                OpStore %54 %58
161          %60 = OpAccessChain %7 %44 %59
162          %61 = OpLoad %6 %60
163          %62 = OpAccessChain %18 %14 %16 %16
164          %63 = OpLoad %6 %62
165          %65 = OpFOrdEqual %64 %61 %63
166                OpSelectionMerge %67 None
167                OpBranchConditional %65 %66 %67
168          %66 = OpLabel
169          %68 = OpAccessChain %18 %14 %16 %24
170          %69 = OpLoad %6 %68
171          %70 = OpAccessChain %18 %14 %16 %16
172          %71 = OpLoad %6 %70
173          %72 = OpAccessChain %18 %14 %16 %16
174          %73 = OpLoad %6 %72
175          %74 = OpAccessChain %18 %14 %16 %24
176          %75 = OpLoad %6 %74
177          %76 = OpCompositeConstruct %52 %69 %71 %73 %75
178                OpStore %54 %76
179                OpBranch %67
180          %67 = OpLabel
181                OpReturn
182                OpFunctionEnd
183 END
184
185 # uniforms for variant
186
187 # _GLF_uniform_float_values
188 BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
189  0.0 790.0 2.0 4.0 1.0
190 END
191
192 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
193
194 PIPELINE graphics variant_pipeline
195   ATTACH variant_vertex_shader
196   ATTACH variant_fragment_shader
197   FRAMEBUFFER_SIZE 256 256
198   BIND BUFFER variant_framebuffer AS color LOCATION 0
199   BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0
200 END
201 CLEAR_COLOR variant_pipeline 0 0 0 255
202
203 CLEAR variant_pipeline
204 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
205
206 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255