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