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