From c15c9449de938158b0dbc521935fd36170dd61db Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Wed, 20 Feb 2019 17:19:13 +0300 Subject: [PATCH] [vulkan] Fixed recreation of command buffers. --- drape/vulkan/vulkan_base_context.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drape/vulkan/vulkan_base_context.cpp b/drape/vulkan/vulkan_base_context.cpp index cc04c38abc..4432e30dc9 100644 --- a/drape/vulkan/vulkan_base_context.cpp +++ b/drape/vulkan/vulkan_base_context.cpp @@ -791,7 +791,10 @@ void VulkanBaseContext::CreateCommandPool() void VulkanBaseContext::DestroyCommandPool() { if (m_commandPool != VK_NULL_HANDLE) + { vkDestroyCommandPool(m_device, m_commandPool, nullptr); + m_commandPool = VK_NULL_HANDLE; + } } void VulkanBaseContext::CreateCommandBuffers() @@ -809,10 +812,16 @@ void VulkanBaseContext::CreateCommandBuffers() void VulkanBaseContext::DestroyCommandBuffers() { if (m_memoryCommandBuffer != VK_NULL_HANDLE) + { vkFreeCommandBuffers(m_device, m_commandPool, 1, &m_memoryCommandBuffer); + m_memoryCommandBuffer = VK_NULL_HANDLE; + } if (m_renderingCommandBuffer != VK_NULL_HANDLE) + { vkFreeCommandBuffers(m_device, m_commandPool, 1, &m_renderingCommandBuffer); + m_renderingCommandBuffer = VK_NULL_HANDLE; + } } void VulkanBaseContext::CreateSyncPrimitives() @@ -833,13 +842,22 @@ void VulkanBaseContext::CreateSyncPrimitives() void VulkanBaseContext::DestroySyncPrimitives() { if (m_fence != VK_NULL_HANDLE) + { vkDestroyFence(m_device, m_fence, nullptr); + m_fence = VK_NULL_HANDLE; + } if (m_presentComplete != VK_NULL_HANDLE) + { vkDestroySemaphore(m_device, m_presentComplete, nullptr); + m_presentComplete = VK_NULL_HANDLE; + } if (m_renderComplete != VK_NULL_HANDLE) + { vkDestroySemaphore(m_device, m_renderComplete, nullptr); + m_renderComplete = VK_NULL_HANDLE; + } } void VulkanBaseContext::RecreateDepthTexture()