• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "vktPipelineBinaryTests.hpp"
31 #include "vktPipelineBlendTests.hpp"
32 #include "vktPipelineDepthTests.hpp"
33 #include "vktPipelineDescriptorLimitsTests.hpp"
34 #include "vktPipelineDynamicOffsetTests.hpp"
35 #include "vktPipelineDynamicVertexAttributeTests.hpp"
36 #include "vktPipelineEarlyDestroyTests.hpp"
37 #include "vktPipelineLogicOpTests.hpp"
38 #include "vktPipelineImageTests.hpp"
39 #include "vktPipelineInputAssemblyTests.hpp"
40 #include "vktPipelineInterfaceMatchingTests.hpp"
41 #include "vktPipelineSamplerTests.hpp"
42 #include "vktPipelineImageViewTests.hpp"
43 #include "vktPipelineImage2DViewOf3DTests.hpp"
44 #include "vktPipelinePushConstantTests.hpp"
45 #include "vktPipelinePushDescriptorTests.hpp"
46 #include "vktPipelineSpecConstantTests.hpp"
47 #include "vktPipelineMatchedAttachmentsTests.hpp"
48 #include "vktPipelineMultisampleTests.hpp"
49 #include "vktPipelineMultisampleInterpolationTests.hpp"
50 #include "vktPipelineMultisampleShaderBuiltInTests.hpp"
51 #include "vktPipelineVertexInputTests.hpp"
52 #include "vktPipelineTimestampTests.hpp"
53 #include "vktPipelineCacheTests.hpp"
54 #include "vktPipelineRenderToImageTests.hpp"
55 #include "vktPipelineFramebufferAttachmentTests.hpp"
56 #include "vktPipelineStencilExportTests.hpp"
57 #include "vktPipelineCreationFeedbackTests.hpp"
58 #include "vktPipelineDepthRangeUnrestrictedTests.hpp"
59 #include "vktPipelineExecutablePropertiesTests.hpp"
60 #include "vktPipelineMiscTests.hpp"
61 #include "vktPipelineMaxVaryingsTests.hpp"
62 #include "vktPipelineBlendOperationAdvancedTests.hpp"
63 #include "vktPipelineExtendedDynamicStateTests.hpp"
64 #include "vktPipelineDynamicControlPoints.hpp"
65 #ifndef CTS_USES_VULKANSC
66 #include "vktPipelineCreationCacheControlTests.hpp"
67 #include "vktPipelineBindPointTests.hpp"
68 #include "vktPipelineDerivativeTests.hpp"
69 #endif // CTS_USES_VULKANSC
70 #include "vktPipelineNoPositionTests.hpp"
71 #include "vktPipelineColorWriteEnableTests.hpp"
72 #include "vktPipelineLibraryTests.hpp"
73 #include "vktPipelineAttachmentFeedbackLoopLayoutTests.hpp"
74 #include "vktPipelineShaderModuleIdentifierTests.hpp"
75 #include "vktPipelineImageSlicedViewOf3DTests.hpp"
76 #include "vktPipelineBindVertexBuffers2Tests.hpp"
77 #include "vktPipelineRobustnessCacheTests.hpp"
78 #include "vktPipelineInputAttributeOffsetTests.hpp"
79 #include "vktPipelineEmptyFSTests.hpp"
80 #include "vktTestGroupUtil.hpp"
81 
82 namespace vkt
83 {
84 namespace pipeline
85 {
86 
87 using namespace vk;
88 
89 namespace
90 {
91 
createChildren(tcu::TestCaseGroup * group,PipelineConstructionType pipelineConstructionType)92 void createChildren(tcu::TestCaseGroup *group, PipelineConstructionType pipelineConstructionType)
93 {
94     const auto isNotShaderObjectVariant = !vk::isConstructionTypeShaderObject(pipelineConstructionType);
95     const auto isNotExtraShaderObjectVariant =
96         (isNotShaderObjectVariant ||
97          pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV);
98     const auto isMonolithicOrBaseESOVariant =
99         (pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC ||
100          pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV);
101 
102     tcu::TestContext &testCtx = group->getTestContext();
103 
104     group->addChild(createDynamicControlPointTests(testCtx, pipelineConstructionType));
105     if (isNotExtraShaderObjectVariant)
106         group->addChild(createStencilTests(testCtx, pipelineConstructionType));
107     group->addChild(createBlendTests(testCtx, pipelineConstructionType));
108     group->addChild(createDepthTests(testCtx, pipelineConstructionType));
109     group->addChild(createDescriptorLimitsTests(testCtx, pipelineConstructionType));
110     group->addChild(createDynamicOffsetTests(testCtx, pipelineConstructionType));
111     group->addChild(createDynamicVertexAttributeTests(testCtx, pipelineConstructionType));
112 #ifndef CTS_USES_VULKANSC
113     group->addChild(createEarlyDestroyTests(testCtx, pipelineConstructionType));
114 #endif // CTS_USES_VULKANSC
115     if (isMonolithicOrBaseESOVariant)
116         group->addChild(createImageTests(testCtx, pipelineConstructionType));
117     group->addChild(createSamplerTests(testCtx, pipelineConstructionType));
118     if (isMonolithicOrBaseESOVariant)
119         group->addChild(createImageViewTests(testCtx, pipelineConstructionType));
120 #ifndef CTS_USES_VULKANSC
121     group->addChild(createImage2DViewOf3DTests(testCtx, pipelineConstructionType));
122 #endif // CTS_USES_VULKANSC
123     group->addChild(createLogicOpTests(testCtx, pipelineConstructionType));
124 #ifndef CTS_USES_VULKANSC
125     group->addChild(createPushConstantTests(testCtx, pipelineConstructionType));
126     group->addChild(createPushDescriptorTests(testCtx, pipelineConstructionType));
127     group->addChild(createMatchedAttachmentsTests(testCtx, pipelineConstructionType));
128 #endif // CTS_USES_VULKANSC
129     group->addChild(createSpecConstantTests(testCtx, pipelineConstructionType));
130     group->addChild(createMultisampleTests(testCtx, pipelineConstructionType, false));
131     group->addChild(createMultisampleTests(testCtx, pipelineConstructionType, true));
132     group->addChild(createMultisampleInterpolationTests(testCtx, pipelineConstructionType));
133 #ifndef CTS_USES_VULKANSC
134     // Input attachments aren't supported for dynamic rendering and shader objects
135     if (isNotShaderObjectVariant)
136     {
137         group->addChild(createMultisampleShaderBuiltInTests(testCtx, pipelineConstructionType));
138     }
139 #endif // CTS_USES_VULKANSC
140     group->addChild(createTestGroup(testCtx, "vertex_input", createVertexInputTests, pipelineConstructionType));
141     group->addChild(createInputAssemblyTests(testCtx, pipelineConstructionType));
142     group->addChild(createInterfaceMatchingTests(testCtx, pipelineConstructionType));
143     group->addChild(createTimestampTests(testCtx, pipelineConstructionType));
144 #ifndef CTS_USES_VULKANSC
145     group->addChild(createCacheTests(testCtx, pipelineConstructionType));
146     if (isNotShaderObjectVariant)
147     {
148         // pipeline binary reuses cache and creation_feedback tests but it was requested to have them under one group
149         de::MovePtr<tcu::TestCaseGroup> pipelineBinaryTests(new tcu::TestCaseGroup(testCtx, "pipeline_binary"));
150         pipelineBinaryTests = addPipelineBinaryBasicTests(testCtx, pipelineConstructionType, pipelineBinaryTests);
151         pipelineBinaryTests =
152             addPipelineBinaryCreationFeedbackTests(testCtx, pipelineConstructionType, pipelineBinaryTests);
153         pipelineBinaryTests = addPipelineBinaryDedicatedTests(testCtx, pipelineConstructionType, pipelineBinaryTests);
154         group->addChild(pipelineBinaryTests.release());
155     }
156     group->addChild(createFramebufferAttachmentTests(testCtx, pipelineConstructionType));
157 #endif // CTS_USES_VULKANSC
158     group->addChild(createRenderToImageTests(testCtx, pipelineConstructionType));
159     group->addChild(createStencilExportTests(testCtx, pipelineConstructionType));
160 #ifndef CTS_USES_VULKANSC
161     group->addChild(createCreationFeedbackTests(testCtx, pipelineConstructionType));
162     group->addChild(createDepthRangeUnrestrictedTests(testCtx, pipelineConstructionType));
163     if (isNotShaderObjectVariant)
164     {
165         group->addChild(createExecutablePropertiesTests(testCtx, pipelineConstructionType));
166     }
167 #endif // CTS_USES_VULKANSC
168     group->addChild(createMaxVaryingsTests(testCtx, pipelineConstructionType));
169     group->addChild(createBlendOperationAdvancedTests(testCtx, pipelineConstructionType));
170     if (isNotExtraShaderObjectVariant)
171         group->addChild(createExtendedDynamicStateTests(testCtx, pipelineConstructionType));
172     group->addChild(createNoPositionTests(testCtx, pipelineConstructionType));
173 #ifndef CTS_USES_VULKANSC
174     group->addChild(createBindPointTests(testCtx, pipelineConstructionType));
175 #endif // CTS_USES_VULKANSC
176     group->addChild(createColorWriteEnableTests(testCtx, pipelineConstructionType));
177 #ifndef CTS_USES_VULKANSC
178     group->addChild(createAttachmentFeedbackLoopLayoutTests(testCtx, pipelineConstructionType));
179     if (isNotShaderObjectVariant)
180     {
181         group->addChild(createShaderModuleIdentifierTests(testCtx, pipelineConstructionType));
182         group->addChild(createPipelineRobustnessCacheTests(testCtx, pipelineConstructionType));
183     }
184 #endif // CTS_USES_VULKANSC
185     group->addChild(createColorWriteEnable2Tests(testCtx, pipelineConstructionType));
186     group->addChild(createMiscTests(testCtx, pipelineConstructionType));
187     group->addChild(createCmdBindBuffers2Tests(testCtx, pipelineConstructionType));
188     group->addChild(createInputAttributeOffsetTests(testCtx, pipelineConstructionType));
189 
190     // NOTE: all new pipeline tests should use GraphicsPipelineWrapper for pipeline creation
191     // ShaderWrapper for shader creation
192     // PipelineLayoutWrapper for pipeline layout creation
193     // RenderPassWrapper for render pass creation
194 
195     if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC)
196     {
197 #ifndef CTS_USES_VULKANSC
198         // compute pipeline tests should not be repeated basing on pipelineConstructionType
199         group->addChild(createDerivativeTests(testCtx));
200 
201         // dont repeat tests requiring timing execution of vkCreate*Pipelines
202         group->addChild(createCacheControlTests(testCtx));
203 
204         // No need to repeat tests checking sliced view of 3D images for different construction types.
205         group->addChild(createImageSlicedViewOf3DTests(testCtx));
206 #endif // CTS_USES_VULKANSC
207     }
208 #ifndef CTS_USES_VULKANSC
209     else if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY)
210     {
211         // execute pipeline library specific tests only once
212         group->addChild(createPipelineLibraryTests(testCtx));
213         // Monolithic pipeline tests
214     }
215 #endif // CTS_USES_VULKANSC
216     group->addChild(createEmptyFSTests(testCtx, pipelineConstructionType));
217 }
218 
219 } // namespace
220 
createTests(tcu::TestContext & testCtx,const std::string & name)221 tcu::TestCaseGroup *createTests(tcu::TestContext &testCtx, const std::string &name)
222 {
223     de::MovePtr<tcu::TestCaseGroup> monolithicGroup(
224         createTestGroup(testCtx, "monolithic", createChildren, PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC));
225 #ifndef CTS_USES_VULKANSC
226     // Graphics pipeline library tests
227     de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup(createTestGroup(
228         testCtx, "pipeline_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY));
229     // Fast linked graphics pipeline library tests
230     de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup(createTestGroup(
231         testCtx, "fast_linked_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY));
232     // Unlinked spirv shader object tests
233     de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedSpirvGroup(
234         createTestGroup(testCtx, "shader_object_unlinked_spirv", createChildren,
235                         PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV));
236     // Unlinked binary shader object tests
237     de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedBinaryGroup(
238         createTestGroup(testCtx, "shader_object_unlinked_binary", createChildren,
239                         PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_BINARY));
240     // Linked spirv shader object tests
241     de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedSpirvGroup(createTestGroup(
242         testCtx, "shader_object_linked_spirv", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_SPIRV));
243     // Linked binary shader object tests
244     de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedBinaryGroup(
245         createTestGroup(testCtx, "shader_object_linked_binary", createChildren,
246                         PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_BINARY));
247 #endif
248 
249     de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, name.c_str()));
250     mainGroup->addChild(monolithicGroup.release());
251 #ifndef CTS_USES_VULKANSC
252     mainGroup->addChild(pipelineLibraryGroup.release());
253     mainGroup->addChild(fastLinkedLibraryGroup.release());
254     mainGroup->addChild(shaderObjectUnlinkedSpirvGroup.release());
255     mainGroup->addChild(shaderObjectUnlinkedBinaryGroup.release());
256     mainGroup->addChild(shaderObjectLinkedSpirvGroup.release());
257     mainGroup->addChild(shaderObjectLinkedBinaryGroup.release());
258 #endif
259     return mainGroup.release();
260 }
261 
262 } // namespace pipeline
263 } // namespace vkt
264