Fix freeing custom device in dynamic state tests
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / dynamic_state / vktDynamicStateTests.cpp
index e7398cf..9d13c5d 100644 (file)
@@ -41,24 +41,40 @@ namespace DynamicState
 namespace
 {
 
-void createChildren (tcu::TestCaseGroup* group)
+void createChildren (tcu::TestCaseGroup* group, vk::PipelineConstructionType pipelineConstructionType)
 {
        tcu::TestContext&       testCtx         = group->getTestContext();
 
-       group->addChild(new DynamicStateVPTests(testCtx));
-       group->addChild(new DynamicStateRSTests(testCtx));
-       group->addChild(new DynamicStateCBTests(testCtx));
-       group->addChild(new DynamicStateDSTests(testCtx));
-       group->addChild(new DynamicStateGeneralTests(testCtx));
-       group->addChild(createDynamicStateComputeTests(testCtx));
-       group->addChild(new DynamicStateInheritanceTests(testCtx));
+       group->addChild(new DynamicStateVPTests                         (testCtx, pipelineConstructionType));
+       group->addChild(new DynamicStateRSTests                         (testCtx, pipelineConstructionType));
+       group->addChild(new DynamicStateCBTests                         (testCtx, pipelineConstructionType));
+       group->addChild(new DynamicStateDSTests                         (testCtx, pipelineConstructionType));
+       group->addChild(new DynamicStateGeneralTests            (testCtx, pipelineConstructionType));
+       group->addChild(new DynamicStateInheritanceTests        (testCtx, pipelineConstructionType));
+
+       if (pipelineConstructionType == vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC)
+               group->addChild(createDynamicStateComputeTests  (testCtx));
+}
+
+static void cleanupGroup(tcu::TestCaseGroup*, vk::PipelineConstructionType)
+{
+       // Destroy singleton objects.
+       cleanupDevice();
 }
 
 } // anonymous
 
 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
 {
-       return createTestGroup(testCtx, "dynamic_state", "Dynamic State Tests", createChildren);
+       de::MovePtr<tcu::TestCaseGroup> monolithicGroup                 (createTestGroup(testCtx, "monolithic",                         "Monolithic pipeline tests",                                    createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_MONOLITHIC, cleanupGroup));
+       de::MovePtr<tcu::TestCaseGroup> pipelineLibraryGroup    (createTestGroup(testCtx, "pipeline_library",           "Graphics pipeline library tests",                              createChildren, vk::PIPELINE_CONSTRUCTION_TYPE_LINK_TIME_OPTIMIZED_LIBRARY, cleanupGroup));
+       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));
+
+       de::MovePtr<tcu::TestCaseGroup> mainGroup(new tcu::TestCaseGroup(testCtx, "dynamic_state", "Dynamic State Tests"));
+       mainGroup->addChild(monolithicGroup.release());
+       mainGroup->addChild(pipelineLibraryGroup.release());
+       mainGroup->addChild(fastLinkedLibraryGroup.release());
+       return mainGroup.release();
 }
 
 } // DynamicState