Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-apfloat-determinant.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 GraphicsFuzz.
19
20 # Short description: A fragment shader that covers a specific arbitrary precision float usage.
21
22 # The test passes because 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 # precision highp float;
29 #
30 # layout(location = 0) out vec4 _GLF_color;
31 #
32 # void main()
33 # {
34 #
35 #     float det1 = determinant(mat4(0, 1,  0, 1,
36 #                                   1, 1,  1, 2,
37 #                                   1, 4,  6, 1,
38 #                                   5, 35, 7, 63));
39 #
40 #     float det2 = determinant(mat3(1,  0, 1,
41 #                                   4,  6, 1,
42 #                                   35, 7, 63));
43 #
44 #     float det3 = determinant(mat3(1, 0, 1,
45 #                                   1, 1, 2,
46 #                                   35, 7, 63));
47 #
48 #     float det4 = determinant(mat3(1, 0, 1,
49 #                                   1, 1, 2,
50 #                                   4, 6, 1));
51 #
52 #     float ref = -det2 + det3 - 5.0 * det4;
53 #
54 #     if (abs(ref - det1) < 0.1) // Always true.
55 #         _GLF_color = vec4(1, 0, 0, 1);
56 #     else
57 #         _GLF_color = vec4(0);
58 # }
59 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
60 ; SPIR-V
61 ; Version: 1.0
62 ; Generator: Khronos Glslang Reference Front End; 8
63 ; Bound: 63
64 ; Schema: 0
65                OpCapability Shader
66           %1 = OpExtInstImport "GLSL.std.450"
67                OpMemoryModel Logical GLSL450
68                OpEntryPoint Fragment %4 "main" %59
69                OpExecutionMode %4 OriginUpperLeft
70                OpSource ESSL 310
71                OpName %4 "main"
72                OpName %8 "det1"
73                OpName %26 "det2"
74                OpName %34 "det3"
75                OpName %38 "det4"
76                OpName %41 "ref"
77                OpName %59 "_GLF_color"
78                OpDecorate %59 Location 0
79           %2 = OpTypeVoid
80           %3 = OpTypeFunction %2
81           %6 = OpTypeFloat 32
82           %7 = OpTypePointer Function %6
83           %9 = OpTypeVector %6 4
84          %10 = OpTypeMatrix %9 4
85          %11 = OpConstant %6 0
86          %12 = OpConstant %6 1
87          %13 = OpConstantComposite %9 %11 %12 %11 %12
88          %14 = OpConstant %6 2
89          %15 = OpConstantComposite %9 %12 %12 %12 %14
90          %16 = OpConstant %6 4
91          %17 = OpConstant %6 6
92          %18 = OpConstantComposite %9 %12 %16 %17 %12
93          %19 = OpConstant %6 5
94          %20 = OpConstant %6 35
95          %21 = OpConstant %6 7
96          %22 = OpConstant %6 63
97          %23 = OpConstantComposite %9 %19 %20 %21 %22
98          %24 = OpConstantComposite %10 %13 %15 %18 %23
99          %27 = OpTypeVector %6 3
100          %28 = OpTypeMatrix %27 3
101          %29 = OpConstantComposite %27 %12 %11 %12
102          %30 = OpConstantComposite %27 %16 %17 %12
103          %31 = OpConstantComposite %27 %20 %21 %22
104          %32 = OpConstantComposite %28 %29 %30 %31
105          %35 = OpConstantComposite %27 %12 %12 %14
106          %36 = OpConstantComposite %28 %29 %35 %31
107          %39 = OpConstantComposite %28 %29 %35 %30
108          %53 = OpConstant %6 0.100000001
109          %54 = OpTypeBool
110          %58 = OpTypePointer Output %9
111          %59 = OpVariable %58 Output
112          %60 = OpConstantComposite %9 %12 %11 %11 %12
113          %62 = OpConstantComposite %9 %11 %11 %11 %11
114           %4 = OpFunction %2 None %3
115           %5 = OpLabel
116           %8 = OpVariable %7 Function
117          %26 = OpVariable %7 Function
118          %34 = OpVariable %7 Function
119          %38 = OpVariable %7 Function
120          %41 = OpVariable %7 Function
121          %25 = OpExtInst %6 %1 Determinant %24
122                OpStore %8 %25
123          %33 = OpExtInst %6 %1 Determinant %32
124                OpStore %26 %33
125          %37 = OpExtInst %6 %1 Determinant %36
126                OpStore %34 %37
127          %40 = OpExtInst %6 %1 Determinant %39
128                OpStore %38 %40
129          %42 = OpLoad %6 %26
130          %43 = OpFNegate %6 %42
131          %44 = OpLoad %6 %34
132          %45 = OpFAdd %6 %43 %44
133          %46 = OpLoad %6 %38
134          %47 = OpFMul %6 %19 %46
135          %48 = OpFSub %6 %45 %47
136                OpStore %41 %48
137          %49 = OpLoad %6 %41
138          %50 = OpLoad %6 %8
139          %51 = OpFSub %6 %49 %50
140          %52 = OpExtInst %6 %1 FAbs %51
141          %55 = OpFOrdLessThan %54 %52 %53
142                OpSelectionMerge %57 None
143                OpBranchConditional %55 %56 %61
144          %56 = OpLabel
145                OpStore %59 %60
146                OpBranch %57
147          %61 = OpLabel
148                OpStore %59 %62
149                OpBranch %57
150          %57 = OpLabel
151                OpReturn
152                OpFunctionEnd
153 END
154
155
156 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
157
158 PIPELINE graphics variant_pipeline
159   ATTACH variant_vertex_shader
160   ATTACH variant_fragment_shader
161   FRAMEBUFFER_SIZE 256 256
162   BIND BUFFER variant_framebuffer AS color LOCATION 0
163 END
164 CLEAR_COLOR variant_pipeline 0 0 0 255
165
166 CLEAR variant_pipeline
167 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
168
169 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255