diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-07-23 09:37:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-23 09:37:58 -0400 |
| commit | cf503553eb44f104072d8add4069f8352f7bad22 (patch) | |
| tree | 0fc7cfadd2f5ff10b9c10d5f4861efec22834a7a /tools/gfx/vulkan/render-vk.cpp | |
| parent | 115920406ebd747e02e1e6a8e4595f7d88eef0d9 (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/render-vk.cpp')
| -rw-r--r-- | tools/gfx/vulkan/render-vk.cpp | 73 |
1 files changed, 27 insertions, 46 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index 2221187ed..53c210a20 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -356,49 +356,6 @@ public: List<Binding> m_bindings; ///< Records entities are bound to this descriptor set, and keeps the associated resources/views/state in scope }; -#if 0 - struct BindingDetail - { - VkImageView m_srv = VK_NULL_HANDLE; - VkBufferView m_uav = VK_NULL_HANDLE; - VkSampler m_sampler = VK_NULL_HANDLE; - }; - - class BindingStateImpl: public BindingState - { - public: - typedef BindingState Parent; - - BindingStateImpl(const Desc& desc, const VulkanApi* api): - Parent(desc), - m_api(api) - { - } - ~BindingStateImpl() - { - for (int i = 0; i < int(m_bindingDetails.Count()); ++i) - { - BindingDetail& detail = m_bindingDetails[i]; - if (detail.m_sampler != VK_NULL_HANDLE) - { - m_api->vkDestroySampler(m_api->m_device, detail.m_sampler, nullptr); - } - if (detail.m_srv != VK_NULL_HANDLE) - { - m_api->vkDestroyImageView(m_api->m_device, detail.m_srv, nullptr); - } - if (detail.m_uav != VK_NULL_HANDLE) - { - m_api->vkDestroyBufferView(m_api->m_device, detail.m_uav, nullptr); - } - } - } - - const VulkanApi* m_api; - List<BindingDetail> m_bindingDetails; - }; -#endif - struct BoundVertexBuffer { RefPtr<BufferResourceImpl> m_buffer; @@ -423,11 +380,8 @@ public: const VulkanApi* m_api; -// VkPrimitiveTopology m_primitiveTopology; - RefPtr<PipelineLayoutImpl> m_pipelineLayout; -// RefPtr<InputLayoutImpl> m_inputLayout; RefPtr<ShaderProgramImpl> m_shaderProgram; VkPipeline m_pipeline = VK_NULL_HANDLE; @@ -804,11 +758,38 @@ Renderer* createVKRenderer() VKRenderer::~VKRenderer() { + // Check the device queue is valid else, we can't wait on it.. + if (m_deviceQueue.isValid()) + { + waitForGpu(); + } + + m_currentPipeline.setNull(); + + // Same as clear but, also dtors all elements, which clear does not + m_boundVertexBuffers = List<BoundVertexBuffer>(); + + m_currentPipelineLayout.setNull(); + for (auto& impl : m_currentDescriptorSetImpls) + { + impl.setNull(); + } + if (m_renderPass != VK_NULL_HANDLE) { m_api.vkDestroyRenderPass(m_device, m_renderPass, nullptr); m_renderPass = VK_NULL_HANDLE; } + + m_swapChain.destroy(); + + m_deviceQueue.destroy(); + + if (m_device != VK_NULL_HANDLE) + { + m_api.vkDestroyDevice(m_device, nullptr); + m_device = VK_NULL_HANDLE; + } } |
