1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2016 The Khronos Group Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Synchronization tests
22 *//*--------------------------------------------------------------------*/
24 #include "vktSynchronizationTests.hpp"
25 #include "vktTestGroupUtil.hpp"
26 #include "vktSynchronizationSmokeTests.hpp"
27 #include "vktSynchronizationBasicFenceTests.hpp"
28 #include "vktSynchronizationBasicSemaphoreTests.hpp"
29 #include "vktSynchronizationBasicEventTests.hpp"
30 #include "vktSynchronizationOperationSingleQueueTests.hpp"
31 #include "vktSynchronizationOperationMultiQueueTests.hpp"
32 #include "vktSynchronizationInternallySynchronizedObjectsTests.hpp"
33 #include "vktSynchronizationCrossInstanceSharingTests.hpp"
34 #include "vktSynchronizationSignalOrderTests.hpp"
35 #include "vktSynchronizationTimelineSemaphoreTests.hpp"
36 #include "vktSynchronizationWin32KeyedMutexTests.hpp"
37 #include "vktSynchronizationNoneStageTests.hpp"
38 #include "vktSynchronizationUtil.hpp"
39 #include "vktSynchronizationImageLayoutTransitionTests.hpp"
40 #include "vktGlobalPriorityQueueTests.hpp"
42 #include "deUniquePtr.hpp"
46 namespace synchronization
52 tcu::TestCaseGroup* createBasicTests (tcu::TestContext& testCtx, SynchronizationType type)
54 de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(testCtx, "basic", ""));
56 if (type == SynchronizationType::LEGACY)
58 group->addChild(createBasicEventTests(testCtx));
59 group->addChild(createBasicFenceTests(testCtx));
63 group->addChild(createSynchronization2BasicEventTests(testCtx));
66 group->addChild(createBasicBinarySemaphoreTests (testCtx, type));
67 group->addChild(createBasicTimelineSemaphoreTests (testCtx, type));
69 return group.release();
72 class OperationTests : public tcu::TestCaseGroup
75 OperationTests (tcu::TestContext& testCtx, SynchronizationType type)
76 : tcu::TestCaseGroup(testCtx, "op", "Synchronization of a memory-modifying operation")
83 addChild(createSynchronizedOperationSingleQueueTests(m_testCtx, m_type, m_pipelineCacheData));
84 addChild(createSynchronizedOperationMultiQueueTests (m_testCtx, m_type, m_pipelineCacheData));
88 SynchronizationType m_type;
90 // synchronization.op tests share pipeline cache data to speed up test execution.
91 PipelineCacheData m_pipelineCacheData;
94 tcu::TestCaseGroup* createTestsInternal (tcu::TestContext& testCtx, SynchronizationType type)
96 const bool isSynchronization2 (type == SynchronizationType::SYNCHRONIZATION2);
97 const char* groupName[] { "synchronization", "synchronization2" };
98 const char* groupDescription[] { "Synchronization tests", "VK_KHR_synchronization2 tests" };
100 de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, groupName[isSynchronization2], groupDescription[isSynchronization2]));
102 if (isSynchronization2)
104 testGroup->addChild(createSynchronization2SmokeTests(testCtx));
105 testGroup->addChild(createSynchronization2TimelineSemaphoreTests(testCtx));
106 #ifndef CTS_USES_VULKANSC
107 testGroup->addChild(createNoneStageTests(testCtx));
108 #endif // CTS_USES_VULKANSC
109 testGroup->addChild(createImageLayoutTransitionTests(testCtx));
111 else // legacy synchronization
113 testGroup->addChild(createSmokeTests(testCtx));
114 testGroup->addChild(createTimelineSemaphoreTests(testCtx));
116 testGroup->addChild(createInternallySynchronizedObjects(testCtx));
117 #ifndef CTS_USES_VULKANSC
118 testGroup->addChild(createWin32KeyedMutexTest(testCtx));
119 testGroup->addChild(createGlobalPriorityQueueTests(testCtx));
120 #endif // CTS_USES_VULKANSC
123 testGroup->addChild(createBasicTests(testCtx, type));
124 testGroup->addChild(new OperationTests(testCtx, type));
125 #ifndef CTS_USES_VULKANSC
126 testGroup->addChild(createCrossInstanceSharingTest(testCtx, type));
127 testGroup->addChild(createSignalOrderTests(testCtx, type));
128 #endif // CTS_USES_VULKANSC
130 return testGroup.release();
137 tcu::TestCaseGroup* createSynchronizationTests (tcu::TestContext& testCtx)
139 using namespace synchronization;
140 return createTestsInternal(testCtx, SynchronizationType::LEGACY);
143 tcu::TestCaseGroup* createSynchronization2Tests(tcu::TestContext& testCtx)
145 using namespace synchronization;
146 return createTestsInternal(testCtx, SynchronizationType::SYNCHRONIZATION2);