diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index c1e358e97..485496da9 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -289,6 +289,7 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_ const VulkanFunctions &vk = m_pDriver->m_Real; VkDeviceMemory readbackmem = VK_NULL_HANDLE; + VkBuffer destbuf = VK_NULL_HANDLE; { VkMemoryAllocInfo allocInfo = { @@ -307,8 +308,6 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_ VK_SHARING_MODE_EXCLUSIVE, 0, NULL, }; - VkBuffer destbuf; - res = vk.vkCreateBuffer(dev, &bufInfo, &destbuf); RDCASSERT(res == VK_SUCCESS); @@ -365,6 +364,7 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_ vk.vkDeviceWaitIdle(dev); + vk.vkDestroyBuffer(dev, destbuf); vk.vkFreeMemory(dev, readbackmem); }