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