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