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