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