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