summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/vk-device-queue.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-07-23 09:37:58 -0400
committerGitHub <noreply@github.com>2020-07-23 09:37:58 -0400
commitcf503553eb44f104072d8add4069f8352f7bad22 (patch)
tree0fc7cfadd2f5ff10b9c10d5f4861efec22834a7a /tools/gfx/vulkan/vk-device-queue.cpp
parent115920406ebd747e02e1e6a8e4595f7d88eef0d9 (diff)
Fix for vulkan tests failing (#1456)
* Clean up device when VKRenderer dtor is run. Added destroy methods to VulkanSwapChain & VulkanDeviceQueue * Small fixes around testing if DeviceQueue is valid. * Disable active-mask tests. Different drivers appear to change the results.
Diffstat (limited to 'tools/gfx/vulkan/vk-device-queue.cpp')
-rw-r--r--tools/gfx/vulkan/vk-device-queue.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/vk-device-queue.cpp b/tools/gfx/vulkan/vk-device-queue.cpp
index 3b9e6cbcd..0cc9a0a0d 100644
--- a/tools/gfx/vulkan/vk-device-queue.cpp
+++ b/tools/gfx/vulkan/vk-device-queue.cpp
@@ -10,6 +10,11 @@ using namespace Slang;
VulkanDeviceQueue::~VulkanDeviceQueue()
{
+ destroy();
+}
+
+void VulkanDeviceQueue::destroy()
+{
if (m_api)
{
for (int i = 0; i < int(EventType::CountOf); ++i)
@@ -23,14 +28,14 @@ VulkanDeviceQueue::~VulkanDeviceQueue()
m_api->vkDestroyFence(m_api->m_device, m_fences[i].fence, nullptr);
}
m_api->vkDestroyCommandPool(m_api->m_device, m_commandPool, nullptr);
+ m_api = nullptr;
}
}
SlangResult VulkanDeviceQueue::init(const VulkanApi& api, VkQueue queue, int queueIndex)
{
assert(m_api == nullptr);
- m_api = &api;
-
+
for (int i = 0; i < int(EventType::CountOf); ++i)
{
m_semaphores[i] = VK_NULL_HANDLE;
@@ -79,6 +84,9 @@ SlangResult VulkanDeviceQueue::init(const VulkanApi& api, VkQueue queue, int que
api.vkCreateSemaphore(api.m_device, &semaphoreCreateInfo, nullptr, &m_semaphores[i]);
}
+ // Set the api - also marks that the queue appears to be valid
+ m_api = &api;
+
// Second step of flush to prime command buffer
flushStepB();