Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-loop-increment-integer-set-output-color-break.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 #
29 # precision highp int;
30 # precision highp float;
31 #
32 # layout(location = 0) out vec4 _GLF_color;
33 #
34 # // Contents of one: 1.0
35 # layout(set = 0, binding = 0) uniform buf0
36 # {
37 #     float one;
38 # };
39 #
40 # void main()
41 # {
42 #     int a = 1;
43 #
44 #     // Iterated until the break is executed.
45 #     while(int(one) >= 1)
46 #     {
47 #         if(a++ >= 5)
48 #         {
49 #             _GLF_color = vec4(1, 0, 0, 1);
50 #             break;
51 #         }
52 #     }
53 # }
54 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
55 ; SPIR-V
56 ; Version: 1.0
57 ; Generator: Khronos Glslang Reference Front End; 10
58 ; Bound: 39
59 ; Schema: 0
60                OpCapability Shader
61           %1 = OpExtInstImport "GLSL.std.450"
62                OpMemoryModel Logical GLSL450
63                OpEntryPoint Fragment %4 "main" %34
64                OpExecutionMode %4 OriginUpperLeft
65                OpSource ESSL 320
66                OpName %4 "main"
67                OpName %8 "a"
68                OpName %16 "buf0"
69                OpMemberName %16 0 "one"
70                OpName %18 ""
71                OpName %34 "_GLF_color"
72                OpMemberDecorate %16 0 Offset 0
73                OpDecorate %16 Block
74                OpDecorate %18 DescriptorSet 0
75                OpDecorate %18 Binding 0
76                OpDecorate %34 Location 0
77           %2 = OpTypeVoid
78           %3 = OpTypeFunction %2
79           %6 = OpTypeInt 32 1
80           %7 = OpTypePointer Function %6
81           %9 = OpConstant %6 1
82          %15 = OpTypeFloat 32
83          %16 = OpTypeStruct %15
84          %17 = OpTypePointer Uniform %16
85          %18 = OpVariable %17 Uniform
86          %19 = OpConstant %6 0
87          %20 = OpTypePointer Uniform %15
88          %24 = OpTypeBool
89          %28 = OpConstant %6 5
90          %32 = OpTypeVector %15 4
91          %33 = OpTypePointer Output %32
92          %34 = OpVariable %33 Output
93          %35 = OpConstant %15 1
94          %36 = OpConstant %15 0
95          %37 = OpConstantComposite %32 %35 %36 %36 %35
96           %4 = OpFunction %2 None %3
97           %5 = OpLabel
98           %8 = OpVariable %7 Function
99                OpStore %8 %9
100                OpBranch %10
101          %10 = OpLabel
102                OpLoopMerge %12 %13 None
103                OpBranch %14
104          %14 = OpLabel
105          %21 = OpAccessChain %20 %18 %19
106          %22 = OpLoad %15 %21
107          %23 = OpConvertFToS %6 %22
108          %25 = OpSGreaterThanEqual %24 %23 %9
109                OpBranchConditional %25 %11 %12
110          %11 = OpLabel
111          %26 = OpLoad %6 %8
112          %27 = OpIAdd %6 %26 %9
113                OpStore %8 %27
114          %29 = OpSGreaterThanEqual %24 %26 %28
115                OpSelectionMerge %31 None
116                OpBranchConditional %29 %30 %31
117          %30 = OpLabel
118                OpStore %34 %37
119                OpBranch %12
120          %31 = OpLabel
121                OpBranch %13
122          %13 = OpLabel
123                OpBranch %10
124          %12 = OpLabel
125                OpReturn
126                OpFunctionEnd
127 END
128
129 # uniforms for variant
130
131 # one
132 BUFFER variant_one DATA_TYPE float STD140 DATA
133  1.0
134 END
135
136 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
137
138 PIPELINE graphics variant_pipeline
139   ATTACH variant_vertex_shader
140   ATTACH variant_fragment_shader
141   FRAMEBUFFER_SIZE 256 256
142   BIND BUFFER variant_framebuffer AS color LOCATION 0
143   BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0
144 END
145 CLEAR_COLOR variant_pipeline 0 0 0 255
146
147 CLEAR variant_pipeline
148 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
149
150 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255