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