From cf503553eb44f104072d8add4069f8352f7bad22 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 23 Jul 2020 09:37:58 -0400 Subject: 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. --- tools/gfx/vulkan/vk-device-queue.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tools/gfx/vulkan/vk-device-queue.cpp') 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 @@ -9,6 +9,11 @@ namespace gfx { using namespace Slang; VulkanDeviceQueue::~VulkanDeviceQueue() +{ + destroy(); +} + +void VulkanDeviceQueue::destroy() { if (m_api) { @@ -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(); -- cgit v1.2.3