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