Fix freeing custom device in dynamic state tests
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / dynamic_state / vktDynamicStateTests.cpp
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2015 The Khronos Group Inc.
6  * Copyright (c) 2015 Intel Corporation
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  *//*!
21  * \file
22  * \brief Dynamic State Tests
23  *//*--------------------------------------------------------------------*/
24
25 #include "vktDynamicStateTests.hpp"
26
27 #include "vktDynamicStateVPTests.hpp"
28 #include "vktDynamicStateRSTests.hpp"
29 #include "vktDynamicStateCBTests.hpp"
30 #include "vktDynamicStateDSTests.hpp"
31 #include "vktDynamicStateGeneralTests.hpp"
32 #include "vktDynamicStateComputeTests.hpp"
33 #include "vktDynamicStateInheritanceTests.hpp"
34 #include "vktTestGroupUtil.hpp"
35
36 namespace vkt
37 {
38 namespace DynamicState
39 {
40
41 namespace
42 {
43
44 void createChildren (tcu::TestCaseGroup* group, vk::PipelineConstructionType pipelineConstructionType)
45 {
46         tcu::TestContext&       testCtx         = group->getTestContext();
47
48         group->addChild(new DynamicStateVPTests                         (testCtx, pipelineConstructionType));
49         group->addChild(new DynamicStateRSTests                         (testCtx, pipelineConstructionType));
50         group->addChild(new DynamicStateCBTests                         (testCtx, pipelineConstructionType));
51         group->addChild(new DynamicStateDSTests                         (testCtx, pipelineConstructionType));
52         group->addChild(new DynamicStateGeneralTests            (testCtx, pipelineConstructionType));
53         group->addChild(new DynamicStateInheritanceTests        (testCtx, pipelineConstructionType));
54
55         if (pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC)
56                 group->addChild(createDynamicStateComputeTests  (testCtx));
57 }
58
59 static void cleanupGroup(tcu::TestCaseGroup*, vk::PipelineConstructionType)
60 {
61         // Destroy singleton objects.
62         cleanupDevice();
63 }
64
65 } // anonymous
66
67 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
68 {
69         de::MovePtr<tcu::TestCaseGroup> monolithicGroup                 (createTestGroup(testCtx, "monolithic",                         "Monolithic pipeline tests",                                    createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC, cleanupGroup));
70         de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup    (createTestGroup(testCtx, "pipeline_library",           "Graphics pipeline library tests",                              createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY, cleanupGroup));
71         de::MovePtr<tcu::TestCaseGroup> fastLinkedLibraryGroup  (createTestGroup(testCtx, "fast_linked_library",        "Fast linked graphics pipeline library tests",  createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_FAST_LINKED_LIBRARY, cleanupGroup));
72
73         de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, "dynamic_state", "Dynamic State Tests"));
74         mainGroup->addChild(monolithicGroup.release());
75         mainGroup->addChild(pipelineLibraryGroup.release());
76         mainGroup->addChild(fastLinkedLibraryGroup.release());
77         return mainGroup.release();
78 }
79
80 } // DynamicState
81 } // vkt