Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-value-tracking-inclusive-or.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 GraphicsFuzz.
19
20 # Short description: A fragment shader that covers a specific value tracking path
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 310 es
28 # precision highp float;
29 # precision highp int;
30 #
31 # layout(location = 0) out vec4 _GLF_color;
32 # layout(set = 0, binding = 0) uniform buf0
33 # {
34 #     int two;
35 # };
36 #
37 # void main()
38 # {
39 #   int a = 0;
40 #   for (int i = 0; i < 2; i++)
41 #   {
42 #     a = (i | -2) - 1;
43 #   }
44 #
45 #   if (a == -2)
46 #   {
47 #     _GLF_color = vec4(1, 0, 0, 1);
48 #   }
49 #   else
50 #   {
51 #     _GLF_color = vec4(0);
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; 8
58 ; Bound: 43
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 310
66                OpName %4 "main"
67                OpName %8 "a"
68                OpName %10 "i"
69                OpName %34 "_GLF_color"
70                OpName %40 "buf0"
71                OpMemberName %40 0 "two"
72                OpName %42 ""
73                OpDecorate %34 Location 0
74                OpMemberDecorate %40 0 Offset 0
75                OpDecorate %40 Block
76                OpDecorate %42 DescriptorSet 0
77                OpDecorate %42 Binding 0
78           %2 = OpTypeVoid
79           %3 = OpTypeFunction %2
80           %6 = OpTypeInt 32 1
81           %7 = OpTypePointer Function %6
82           %9 = OpConstant %6 0
83          %17 = OpConstant %6 2
84          %18 = OpTypeBool
85          %21 = OpConstant %6 -2
86          %23 = OpConstant %6 1
87          %31 = OpTypeFloat 32
88          %32 = OpTypeVector %31 4
89          %33 = OpTypePointer Output %32
90          %34 = OpVariable %33 Output
91          %35 = OpConstant %31 1
92          %36 = OpConstant %31 0
93          %37 = OpConstantComposite %32 %35 %36 %36 %35
94          %39 = OpConstantComposite %32 %36 %36 %36 %36
95          %40 = OpTypeStruct %6
96          %41 = OpTypePointer Uniform %40
97          %42 = OpVariable %41 Uniform
98           %4 = OpFunction %2 None %3
99           %5 = OpLabel
100           %8 = OpVariable %7 Function
101          %10 = OpVariable %7 Function
102                OpStore %8 %9
103                OpStore %10 %9
104                OpBranch %11
105          %11 = OpLabel
106                OpLoopMerge %13 %14 None
107                OpBranch %15
108          %15 = OpLabel
109          %16 = OpLoad %6 %10
110          %19 = OpSLessThan %18 %16 %17
111                OpBranchConditional %19 %12 %13
112          %12 = OpLabel
113          %20 = OpLoad %6 %10
114          %22 = OpBitwiseOr %6 %20 %21
115          %24 = OpISub %6 %22 %23
116                OpStore %8 %24
117                OpBranch %14
118          %14 = OpLabel
119          %25 = OpLoad %6 %10
120          %26 = OpIAdd %6 %25 %23
121                OpStore %10 %26
122                OpBranch %11
123          %13 = OpLabel
124          %27 = OpLoad %6 %8
125          %28 = OpIEqual %18 %27 %21
126                OpSelectionMerge %30 None
127                OpBranchConditional %28 %29 %38
128          %29 = OpLabel
129                OpStore %34 %37
130                OpBranch %30
131          %38 = OpLabel
132                OpStore %34 %39
133                OpBranch %30
134          %30 = OpLabel
135                OpReturn
136                OpFunctionEnd
137 END
138
139 # uniforms for variant
140
141 # two
142 BUFFER variant_two DATA_TYPE int32 DATA
143  2
144 END
145
146 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
147
148 PIPELINE graphics variant_pipeline
149   ATTACH variant_vertex_shader
150   ATTACH variant_fragment_shader
151   FRAMEBUFFER_SIZE 256 256
152   BIND BUFFER variant_framebuffer AS color LOCATION 0
153   BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0
154 END
155 CLEAR_COLOR variant_pipeline 0 0 0 255
156
157 CLEAR variant_pipeline
158 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
159
160 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255