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