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