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
80namespace vkt
81{
82namespace pipeline
83{
84
85using namespace vk;
86
87namespace
88{
89
90void createChildren (tcu::TestCaseGroup* group, PipelineConstructionType pipelineConstructionType)
91{
92	tcu::TestContext& testCtx = group->getTestContext();
93
94	group->addChild(createDynamicControlPointTests		(testCtx, pipelineConstructionType));
95	group->addChild(createStencilTests					(testCtx, pipelineConstructionType));
96	group->addChild(createBlendTests					(testCtx, pipelineConstructionType));
97	group->addChild(createDepthTests					(testCtx, pipelineConstructionType));
98	group->addChild(createDescriptorLimitsTests			(testCtx, pipelineConstructionType));
99	group->addChild(createDynamicOffsetTests			(testCtx, pipelineConstructionType));
100	group->addChild(createDynamicVertexAttributeTests	(testCtx, pipelineConstructionType));
101#ifndef CTS_USES_VULKANSC
102	group->addChild(createEarlyDestroyTests				(testCtx, pipelineConstructionType));
103#endif // CTS_USES_VULKANSC
104	group->addChild(createImageTests					(testCtx, pipelineConstructionType));
105	group->addChild(createSamplerTests					(testCtx, pipelineConstructionType));
106	group->addChild(createImageViewTests				(testCtx, pipelineConstructionType));
107#ifndef CTS_USES_VULKANSC
108	group->addChild(createImage2DViewOf3DTests			(testCtx, pipelineConstructionType));
109#endif // CTS_USES_VULKANSC
110	group->addChild(createLogicOpTests					(testCtx, pipelineConstructionType));
111#ifndef CTS_USES_VULKANSC
112	group->addChild(createPushConstantTests				(testCtx, pipelineConstructionType));
113	group->addChild(createPushDescriptorTests			(testCtx, pipelineConstructionType));
114	group->addChild(createMatchedAttachmentsTests		(testCtx, pipelineConstructionType));
115#endif // CTS_USES_VULKANSC
116	group->addChild(createSpecConstantTests				(testCtx, pipelineConstructionType));
117	group->addChild(createMultisampleTests				(testCtx, pipelineConstructionType, false));
118	group->addChild(createMultisampleTests				(testCtx, pipelineConstructionType, true));
119	group->addChild(createMultisampleInterpolationTests	(testCtx, pipelineConstructionType));
120#ifndef CTS_USES_VULKANSC
121	// Input attachments aren't supported for dynamic rendering and shader objects
122	if (!vk::isConstructionTypeShaderObject(pipelineConstructionType))
123	{
124		group->addChild(createMultisampleShaderBuiltInTests(testCtx, pipelineConstructionType));
125	}
126#endif // CTS_USES_VULKANSC
127	group->addChild(createTestGroup						(testCtx, "vertex_input", createVertexInputTests, pipelineConstructionType));
128	group->addChild(createInputAssemblyTests			(testCtx, pipelineConstructionType));
129	group->addChild(createInterfaceMatchingTests		(testCtx, pipelineConstructionType));
130	group->addChild(createTimestampTests				(testCtx, pipelineConstructionType));
131#ifndef CTS_USES_VULKANSC
132	group->addChild(createCacheTests					(testCtx, pipelineConstructionType));
133	group->addChild(createFramebufferAttachmentTests	(testCtx, pipelineConstructionType));
134#endif // CTS_USES_VULKANSC
135	group->addChild(createRenderToImageTests			(testCtx, pipelineConstructionType));
136	group->addChild(createStencilExportTests			(testCtx, pipelineConstructionType));
137#ifndef CTS_USES_VULKANSC
138	group->addChild(createCreationFeedbackTests			(testCtx, pipelineConstructionType));
139	group->addChild(createDepthRangeUnrestrictedTests	(testCtx, pipelineConstructionType));
140	if (!isConstructionTypeShaderObject(pipelineConstructionType))
141	{
142		group->addChild(createExecutablePropertiesTests(testCtx, pipelineConstructionType));
143	}
144#endif // CTS_USES_VULKANSC
145	group->addChild(createMaxVaryingsTests				(testCtx, pipelineConstructionType));
146	group->addChild(createBlendOperationAdvancedTests	(testCtx, pipelineConstructionType));
147	group->addChild(createExtendedDynamicStateTests		(testCtx, pipelineConstructionType));
148	group->addChild(createNoPositionTests				(testCtx, pipelineConstructionType));
149#ifndef CTS_USES_VULKANSC
150	group->addChild(createBindPointTests				(testCtx, pipelineConstructionType));
151#endif // CTS_USES_VULKANSC
152	group->addChild(createColorWriteEnableTests			(testCtx, pipelineConstructionType));
153#ifndef CTS_USES_VULKANSC
154	group->addChild(createAttachmentFeedbackLoopLayoutTests (testCtx, pipelineConstructionType));
155	if (!isConstructionTypeShaderObject(pipelineConstructionType))
156	{
157		group->addChild(createShaderModuleIdentifierTests	(testCtx, pipelineConstructionType));
158	}
159	group->addChild(createPipelineRobustnessCacheTests	(testCtx, pipelineConstructionType));
160#endif // CTS_USES_VULKANSC
161	group->addChild(createColorWriteEnable2Tests		(testCtx, pipelineConstructionType));
162	group->addChild(createMiscTests						(testCtx, pipelineConstructionType));
163	group->addChild(createCmdBindBuffers2Tests			(testCtx, pipelineConstructionType));
164	group->addChild(createInputAttributeOffsetTests		(testCtx, pipelineConstructionType));
165
166	// NOTE: all new pipeline tests should use GraphicsPipelineWrapper for pipeline creation
167	// ShaderWrapper for shader creation
168	// PipelineLayoutWrapper for pipeline layout creation
169	// RenderPassWrapper for render pass creation
170
171	if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC)
172	{
173#ifndef CTS_USES_VULKANSC
174		// compute pipeline tests should not be repeated basing on pipelineConstructionType
175		group->addChild(createDerivativeTests				(testCtx));
176
177		// dont repeat tests requiring timing execution of vkCreate*Pipelines
178		group->addChild(createCacheControlTests				(testCtx));
179
180		// No need to repeat tests checking sliced view of 3D images for different construction types.
181		group->addChild(createImageSlicedViewOf3DTests		(testCtx));
182#endif // CTS_USES_VULKANSC
183	}
184#ifndef CTS_USES_VULKANSC
185	else if (pipelineConstructionType == PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY)
186	{
187		// execute pipeline library specific tests only once
188		group->addChild(createPipelineLibraryTests		(testCtx));
189	// Monolithic pipeline tests
190	}
191#endif // CTS_USES_VULKANSC
192}
193
194} // anonymous
195
196tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx, const std::string& name)
197{
198	de::MovePtr<tcu::TestCaseGroup> monolithicGroup					(createTestGroup(testCtx, "monolithic", createChildren, PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC));
199	// Graphics pipeline library tests
200	de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup			(createTestGroup(testCtx, "pipeline_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY));
201	// Fast linked graphics pipeline library tests
202	de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup			(createTestGroup(testCtx, "fast_linked_library", createChildren, PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY));
203	// Unlinked spirv shader object tests
204	de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedSpirvGroup	(createTestGroup(testCtx, "shader_object_unlinked_spirv", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV));
205	// Unlinked binary shader object tests
206	de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedBinaryGroup	(createTestGroup(testCtx, "shader_object_unlinked_binary", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_BINARY));
207	// Linked spirv shader object tests
208	de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedSpirvGroup	(createTestGroup(testCtx, "shader_object_linked_spirv", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_SPIRV));
209	// Linked binary shader object tests
210	de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedBinaryGroup	(createTestGroup(testCtx, "shader_object_linked_binary", createChildren, PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_BINARY));
211
212	de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, name.c_str()));
213	mainGroup->addChild(monolithicGroup.release());
214	mainGroup->addChild(pipelineLibraryGroup.release());
215	mainGroup->addChild(fastLinkedLibraryGroup.release());
216	mainGroup->addChild(shaderObjectUnlinkedSpirvGroup.release());
217	mainGroup->addChild(shaderObjectUnlinkedBinaryGroup.release());
218	mainGroup->addChild(shaderObjectLinkedSpirvGroup.release());
219	mainGroup->addChild(shaderObjectLinkedBinaryGroup.release());
220	return mainGroup.release();
221}
222
223} // pipeline
224} // vkt
225