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