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