1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2015 The Khronos Group Inc.
6 * Copyright (c) 2015 Imagination Technologies Ltd.
7 * Copyright (c) 2023 LunarG, Inc.
8 * Copyright (c) 2023 Nintendo
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 *//*!
23 * \file
24 * \brief Pipeline Tests
25 *//*--------------------------------------------------------------------*/
26
27 #include "vktPipelineTests.hpp"
28 #include "vktPipelineImageUtil.hpp"
29 #include "vktPipelineStencilTests.hpp"
30 #include "vktPipelineBlendTests.hpp"
31 #include "vktPipelineDepthTests.hpp"
32 #include "vktPipelineDescriptorLimitsTests.hpp"
33 #include "vktPipelineDynamicOffsetTests.hpp"
34 #include "vktPipelineDynamicVertexAttributeTests.hpp"
35 #include "vktPipelineEarlyDestroyTests.hpp"
36 #include "vktPipelineLogicOpTests.hpp"
37 #include "vktPipelineImageTests.hpp"
38 #include "vktPipelineInputAssemblyTests.hpp"
39 #include "vktPipelineInterfaceMatchingTests.hpp"
40 #include "vktPipelineSamplerTests.hpp"
41 #include "vktPipelineImageViewTests.hpp"
42 #include "vktPipelineImage2DViewOf3DTests.hpp"
43 #include "vktPipelinePushConstantTests.hpp"
44 #include "vktPipelinePushDescriptorTests.hpp"
45 #include "vktPipelineSpecConstantTests.hpp"
46 #include "vktPipelineMatchedAttachmentsTests.hpp"
47 #include "vktPipelineMultisampleTests.hpp"
48 #include "vktPipelineMultisampleInterpolationTests.hpp"
49 #include "vktPipelineMultisampleShaderBuiltInTests.hpp"
50 #include "vktPipelineVertexInputTests.hpp"
51 #include "vktPipelineTimestampTests.hpp"
52 #include "vktPipelineCacheTests.hpp"
53 #include "vktPipelineRenderToImageTests.hpp"
54 #include "vktPipelineFramebufferAttachmentTests.hpp"
55 #include "vktPipelineStencilExportTests.hpp"
56 #include "vktPipelineCreationFeedbackTests.hpp"
57 #include "vktPipelineDepthRangeUnrestrictedTests.hpp"
58 #include "vktPipelineExecutablePropertiesTests.hpp"
59 #include "vktPipelineMiscTests.hpp"
60 #include "vktPipelineMaxVaryingsTests.hpp"
61 #include "vktPipelineBlendOperationAdvancedTests.hpp"
62 #include "vktPipelineExtendedDynamicStateTests.hpp"
63 #include "vktPipelineDynamicControlPoints.hpp"
64 #ifndef CTS_USES_VULKANSC
65 #include "vktPipelineCreationCacheControlTests.hpp"
66 #include "vktPipelineBindPointTests.hpp"
67 #include "vktPipelineDerivativeTests.hpp"
68 #endif // CTS_USES_VULKANSC
69 #include "vktPipelineNoPositionTests.hpp"
70 #include "vktPipelineColorWriteEnableTests.hpp"
71 #include "vktPipelineLibraryTests.hpp"
72 #include "vktPipelineAttachmentFeedbackLoopLayoutTests.hpp"
73 #include "vktPipelineShaderModuleIdentifierTests.hpp"
74 #include "vktPipelineImageSlicedViewOf3DTests.hpp"
75 #include "vktPipelineBindVertexBuffers2Tests.hpp"
76 #include "vktPipelineRobustnessCacheTests.hpp"
77 #include "vktPipelineInputAttributeOffsetTests.hpp"
78 #include "vktTestGroupUtil.hpp"
79
80 namespace vkt
81 {
82 namespace pipeline
83 {
84
85 using namespace vk;
86
87 namespace
88 {
89
createChildren(tcu::TestCaseGroup * group,PipelineConstructionType pipelineConstructionType)90 void createChildren(tcu::TestCaseGroup *group, PipelineConstructionType pipelineConstructionType)
91 {
92 const auto isNotShaderObjectVariant = !vk::isConstructionTypeShaderObject(pipelineConstructionType);
93 const auto isNotExtraShaderObjectVariant =
94 (isNotShaderObjectVariant ||
95 pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV);
96 const auto isMonolithicOrBaseESOVariant =
97 (pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC ||
98 pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV);
99
100 tcu::TestContext &testCtx = group->getTestContext();
101
102 group->addChild(createDynamicControlPointTests(testCtx, pipelineConstructionType));
103 if (isNotExtraShaderObjectVariant)
104 group->addChild(createStencilTests(testCtx, pipelineConstructionType));
105 group->addChild(createBlendTests(testCtx, pipelineConstructionType));
106 group->addChild(createDepthTests(testCtx, pipelineConstructionType));
107 group->addChild(createDescriptorLimitsTests(testCtx, pipelineConstructionType));
108 group->addChild(createDynamicOffsetTests(testCtx, pipelineConstructionType));
109 group->addChild(createDynamicVertexAttributeTests(testCtx, pipelineConstructionType));
110 #ifndef CTS_USES_VULKANSC
111 group->addChild(createEarlyDestroyTests(testCtx, pipelineConstructionType));
112 #endif // CTS_USES_VULKANSC
113 if (isMonolithicOrBaseESOVariant)
114 group->addChild(createImageTests(testCtx, pipelineConstructionType));
115 group->addChild(createSamplerTests(testCtx, pipelineConstructionType));
116 if (isMonolithicOrBaseESOVariant)
117 group->addChild(createImageViewTests(testCtx, pipelineConstructionType));
118 #ifndef CTS_USES_VULKANSC
119 group->addChild(createImage2DViewOf3DTests(testCtx, pipelineConstructionType));
120 #endif // CTS_USES_VULKANSC
121 group->addChild(createLogicOpTests(testCtx, pipelineConstructionType));
122 #ifndef CTS_USES_VULKANSC
123 group->addChild(createPushConstantTests(testCtx, pipelineConstructionType));
124 group->addChild(createPushDescriptorTests(testCtx, pipelineConstructionType));
125 group->addChild(createMatchedAttachmentsTests(testCtx, pipelineConstructionType));
126 #endif // CTS_USES_VULKANSC
127 group->addChild(createSpecConstantTests(testCtx, pipelineConstructionType));
128 group->addChild(createMultisampleTests(testCtx, pipelineConstructionType, false));
129 group->addChild(createMultisampleTests(testCtx, pipelineConstructionType, true));
130 group->addChild(createMultisampleInterpolationTests(testCtx, pipelineConstructionType));
131 #ifndef CTS_USES_VULKANSC
132 // Input attachments aren't supported for dynamic rendering and shader objects
133 if (isNotShaderObjectVariant)
134 {
135 group->addChild(createMultisampleShaderBuiltInTests(testCtx, pipelineConstructionType));
136 }
137 #endif // CTS_USES_VULKANSC
138 group->addChild(createTestGroup(testCtx, "vertex_input", createVertexInputTests, pipelineConstructionType));
139 group->addChild(createInputAssemblyTests(testCtx, pipelineConstructionType));
140 group->addChild(createInterfaceMatchingTests(testCtx, pipelineConstructionType));
141 group->addChild(createTimestampTests(testCtx, pipelineConstructionType));
142 #ifndef CTS_USES_VULKANSC
143 group->addChild(createCacheTests(testCtx, pipelineConstructionType));
144 group->addChild(createFramebufferAttachmentTests(testCtx, pipelineConstructionType));
145 #endif // CTS_USES_VULKANSC
146 group->addChild(createRenderToImageTests(testCtx, pipelineConstructionType));
147 group->addChild(createStencilExportTests(testCtx, pipelineConstructionType));
148 #ifndef CTS_USES_VULKANSC
149 group->addChild(createCreationFeedbackTests(testCtx, pipelineConstructionType));
150 group->addChild(createDepthRangeUnrestrictedTests(testCtx, pipelineConstructionType));
151 if (isNotShaderObjectVariant)
152 {
153 group->addChild(createExecutablePropertiesTests(testCtx, pipelineConstructionType));
154 }
155 #endif // CTS_USES_VULKANSC
156 group->addChild(createMaxVaryingsTests(testCtx, pipelineConstructionType));
157 group->addChild(createBlendOperationAdvancedTests(testCtx, pipelineConstructionType));
158 if (isNotExtraShaderObjectVariant)
159 group->addChild(createExtendedDynamicStateTests(testCtx, pipelineConstructionType));
160 group->addChild(createNoPositionTests(testCtx, pipelineConstructionType));
161 #ifndef CTS_USES_VULKANSC
162 group->addChild(createBindPointTests(testCtx, pipelineConstructionType));
163 #endif // CTS_USES_VULKANSC
164 group->addChild(createColorWriteEnableTests(testCtx, pipelineConstructionType));
165 #ifndef CTS_USES_VULKANSC
166 group->addChild(createAttachmentFeedbackLoopLayoutTests(testCtx, pipelineConstructionType));
167 if (isNotShaderObjectVariant)
168 {
169 group->addChild(createShaderModuleIdentifierTests(testCtx, pipelineConstructionType));
170 group->addChild(createPipelineRobustnessCacheTests(testCtx, pipelineConstructionType));
171 }
172 #endif // CTS_USES_VULKANSC
173 group->addChild(createColorWriteEnable2Tests(testCtx, pipelineConstructionType));
174 group->addChild(createMiscTests(testCtx, pipelineConstructionType));
175 group->addChild(createCmdBindBuffers2Tests(testCtx, pipelineConstructionType));
176 group->addChild(createInputAttributeOffsetTests(testCtx, pipelineConstructionType));
177
178 // NOTE: all new pipeline tests should use GraphicsPipelineWrapper for pipeline creation
179 // ShaderWrapper for shader creation
180 // PipelineLayoutWrapper for pipeline layout creation
181 // RenderPassWrapper for render pass creation
182
183 if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC)
184 {
185 #ifndef CTS_USES_VULKANSC
186 // compute pipeline tests should not be repeated basing on pipelineConstructionType
187 group->addChild(createDerivativeTests(testCtx));
188
189 // dont repeat tests requiring timing execution of vkCreate*Pipelines
190 group->addChild(createCacheControlTests(testCtx));
191
192 // No need to repeat tests checking sliced view of 3D images for different construction types.
193 group->addChild(createImageSlicedViewOf3DTests(testCtx));
194 #endif // CTS_USES_VULKANSC
195 }
196 #ifndef CTS_USES_VULKANSC
197 else if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY)
198 {
199 // execute pipeline library specific tests only once
200 group->addChild(createPipelineLibraryTests(testCtx));
201 // Monolithic pipeline tests
202 }
203 #endif // CTS_USES_VULKANSC
204 }
205
206 } // namespace
207
createTests(tcu::TestContext & testCtx,const std::string & name)208 tcu::TestCaseGroup *createTests(tcu::TestContext &testCtx, const std::string &name)
209 {
210 de::MovePtr<tcu::TestCaseGroup> monolithicGroup(
211 createTestGroup(testCtx, "monolithic", createChildren, PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC));
212 #ifndef CTS_USES_VULKANSC
213 // Graphics pipeline library tests
214 de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup(createTestGroup(
215 testCtx, "pipeline_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY));
216 // Fast linked graphics pipeline library tests
217 de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup(createTestGroup(
218 testCtx, "fast_linked_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY));
219 // Unlinked spirv shader object tests
220 de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedSpirvGroup(
221 createTestGroup(testCtx, "shader_object_unlinked_spirv", createChildren,
222 PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV));
223 // Unlinked binary shader object tests
224 de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedBinaryGroup(
225 createTestGroup(testCtx, "shader_object_unlinked_binary", createChildren,
226 PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_BINARY));
227 // Linked spirv shader object tests
228 de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedSpirvGroup(createTestGroup(
229 testCtx, "shader_object_linked_spirv", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_SPIRV));
230 // Linked binary shader object tests
231 de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedBinaryGroup(
232 createTestGroup(testCtx, "shader_object_linked_binary", createChildren,
233 PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_BINARY));
234 #endif
235
236 de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, name.c_str()));
237 mainGroup->addChild(monolithicGroup.release());
238 #ifndef CTS_USES_VULKANSC
239 mainGroup->addChild(pipelineLibraryGroup.release());
240 mainGroup->addChild(fastLinkedLibraryGroup.release());
241 mainGroup->addChild(shaderObjectUnlinkedSpirvGroup.release());
242 mainGroup->addChild(shaderObjectUnlinkedBinaryGroup.release());
243 mainGroup->addChild(shaderObjectLinkedSpirvGroup.release());
244 mainGroup->addChild(shaderObjectLinkedBinaryGroup.release());
245 #endif
246 return mainGroup.release();
247 }
248
249 } // namespace pipeline
250 } // namespace vkt
251