1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2020 The Khronos Group Inc.
6 *
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
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
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.
18 *
19 *//*!
20 * \file
21 * \brief Utilties for experimental crash postmortem tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "vktPostmortemTests.hpp"
25 #include "vktPostmortemShaderTimeoutTests.hpp"
26 #include "vktTestGroupUtil.hpp"
27 #include "vktTestCase.hpp"
28 #include "vkBarrierUtil.hpp"
29 #include "vkBufferWithMemory.hpp"
30 #include "vkBuilderUtil.hpp"
31 #include "vkCmdUtil.hpp"
32 #include "vkDefs.hpp"
33 #include "vkObjUtil.hpp"
34 #include "vkTypeUtil.hpp"
35 #include "deUniquePtr.hpp"
36 #include "tcuCommandLine.hpp"
37 #include "vktCustomInstancesDevices.hpp"
38
39 #include "vktPostmortemUtil.hpp"
40
41 using namespace vk;
42
43 namespace vkt
44 {
45 namespace postmortem
46 {
47 namespace
48 {
49
createPostmortemDevice(Context & context)50 Move<VkDevice> createPostmortemDevice(Context &context)
51 {
52 const float queuePriority = 1.0f;
53
54 // Create a universal queue that supports graphics and compute
55 const VkDeviceQueueCreateInfo queueParams = {
56 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // VkStructureType sType;
57 DE_NULL, // const void* pNext;
58 0u, // VkDeviceQueueCreateFlags flags;
59 context.getUniversalQueueFamilyIndex(), // uint32_t queueFamilyIndex;
60 1u, // uint32_t queueCount;
61 &queuePriority // const float* pQueuePriorities;
62 };
63
64 const VkDeviceCreateInfo deviceParams = {
65 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // VkStructureType sType;
66 DE_NULL, // const void* pNext;
67 0u, // VkDeviceCreateFlags flags;
68 1u, // uint32_t queueCreateInfoCount;
69 &queueParams, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
70 0u, // uint32_t enabledLayerCount;
71 DE_NULL, // const char* const* ppEnabledLayerNames;
72 0u, // uint32_t enabledExtensionCount;
73 DE_NULL, // const char* const* ppEnabledExtensionNames;
74 DE_NULL // const VkPhysicalDeviceFeatures* pEnabledFeatures;
75 };
76
77 return createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(),
78 context.getPlatformInterface(), context.getInstance(), context.getInstanceInterface(),
79 context.getPhysicalDevice(), &deviceParams);
80 }
81 } // namespace
82
PostmortemTestInstance(Context & context)83 PostmortemTestInstance::PostmortemTestInstance(Context &context)
84 : TestInstance(context)
85 , m_logicalDevice(createPostmortemDevice(context))
86 , m_deviceDriver(context.getPlatformInterface(), context.getInstance(), *m_logicalDevice,
87 context.getUsedApiVersion(), context.getTestContext().getCommandLine())
88 , m_queueFamilyIndex(0)
89 , m_queue(getDeviceQueue(m_deviceDriver, *m_logicalDevice, m_queueFamilyIndex, 0))
90 , m_allocator(m_deviceDriver, *m_logicalDevice,
91 getPhysicalDeviceMemoryProperties(context.getInstanceInterface(), context.getPhysicalDevice()))
92 {
93 }
94
~PostmortemTestInstance()95 PostmortemTestInstance::~PostmortemTestInstance()
96 {
97 }
98
99 } // namespace postmortem
100 } // namespace vkt
101