xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2015 The Khronos Group Inc.
6  * Copyright (c) 2015 Intel Corporation
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 Dynamic State Tests
25  *//*--------------------------------------------------------------------*/
26 
27 #include "vktDynamicStateTests.hpp"
28 
29 #include "vktDynamicStateVPTests.hpp"
30 #include "vktDynamicStateRSTests.hpp"
31 #include "vktDynamicStateCBTests.hpp"
32 #include "vktDynamicStateDSTests.hpp"
33 #include "vktDynamicStateGeneralTests.hpp"
34 #include "vktDynamicStateComputeTests.hpp"
35 #include "vktDynamicStateInheritanceTests.hpp"
36 #include "vktDynamicStateClearTests.hpp"
37 #include "vktDynamicStateDiscardTests.hpp"
38 #include "vktDynamicStateLineWidthTests.hpp"
39 #include "vktTestGroupUtil.hpp"
40 
41 namespace vkt
42 {
43 namespace DynamicState
44 {
45 
46 namespace
47 {
48 
createChildren(tcu::TestCaseGroup * group,vk::PipelineConstructionType pipelineConstructionType)49 void createChildren(tcu::TestCaseGroup *group, vk::PipelineConstructionType pipelineConstructionType)
50 {
51     tcu::TestContext &testCtx = group->getTestContext();
52 
53     group->addChild(new DynamicStateVPTests(testCtx, pipelineConstructionType));
54     group->addChild(new DynamicStateRSTests(testCtx, pipelineConstructionType));
55     group->addChild(new DynamicStateCBTests(testCtx, pipelineConstructionType));
56     group->addChild(new DynamicStateDSTests(testCtx, pipelineConstructionType));
57     group->addChild(new DynamicStateGeneralTests(testCtx, pipelineConstructionType));
58     group->addChild(new DynamicStateInheritanceTests(testCtx, pipelineConstructionType));
59     group->addChild(new DynamicStateClearTests(testCtx, pipelineConstructionType));
60     group->addChild(new DynamicStateDiscardTests(testCtx, pipelineConstructionType));
61     group->addChild(new DynamicStateLWTests(testCtx, pipelineConstructionType));
62 
63     if (pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC ||
64         pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV)
65         group->addChild(createDynamicStateComputeTests(testCtx, pipelineConstructionType));
66 }
67 
cleanupGroup(tcu::TestCaseGroup *)68 void cleanupGroup(tcu::TestCaseGroup *)
69 {
70     // Destroy singleton objects.
71     cleanupDevice();
72 }
73 
initDynamicStateTestGroup(tcu::TestCaseGroup * mainGroup)74 void initDynamicStateTestGroup(tcu::TestCaseGroup *mainGroup)
75 {
76     auto &testCtx = mainGroup->getTestContext();
77 
78     de::MovePtr<tcu::TestCaseGroup> monolithicGroup(
79         createTestGroup(testCtx, "monolithic", createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC));
80     de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup(createTestGroup(
81         testCtx, "pipeline_library", createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY));
82     de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup(createTestGroup(
83         testCtx, "fast_linked_library", createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY));
84     de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedSpirvGroup(
85         createTestGroup(testCtx, "shader_object_unlinked_spirv", createChildren,
86                         vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_SPIRV));
87     de::MovePtr<tcu::TestCaseGroup> shaderObjectUnlinkedBinaryGroup(
88         createTestGroup(testCtx, "shader_object_unlinked_binary", createChildren,
89                         vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_UNLINKED_BINARY));
90     de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedSpirvGroup(
91         createTestGroup(testCtx, "shader_object_linked_spirv", createChildren,
92                         vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_SPIRV));
93     de::MovePtr<tcu::TestCaseGroup> shaderObjectLinkedBinaryGroup(
94         createTestGroup(testCtx, "shader_object_linked_binary", createChildren,
95                         vk::PIPELINE_CONSTRUCTION_TYPE_SHADER_OBJECT_LINKED_BINARY));
96 
97     mainGroup->addChild(monolithicGroup.release());
98     mainGroup->addChild(pipelineLibraryGroup.release());
99     mainGroup->addChild(fastLinkedLibraryGroup.release());
100     mainGroup->addChild(shaderObjectUnlinkedSpirvGroup.release());
101     mainGroup->addChild(shaderObjectUnlinkedBinaryGroup.release());
102     mainGroup->addChild(shaderObjectLinkedSpirvGroup.release());
103     mainGroup->addChild(shaderObjectLinkedBinaryGroup.release());
104 }
105 
106 } // namespace
107 
createTests(tcu::TestContext & testCtx,const std::string & name)108 tcu::TestCaseGroup *createTests(tcu::TestContext &testCtx, const std::string &name)
109 {
110     // Dynamic State Tests
111     return createTestGroup(testCtx, name.c_str(), initDynamicStateTestGroup, cleanupGroup);
112 }
113 
114 } // namespace DynamicState
115 } // namespace vkt
116