diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.h b/WickedEngine/wiGraphicsDevice_Vulkan.h index f7e91c41c..5abbddb33 100644 --- a/WickedEngine/wiGraphicsDevice_Vulkan.h +++ b/WickedEngine/wiGraphicsDevice_Vulkan.h @@ -372,8 +372,8 @@ namespace wiGraphics struct BindlessDescriptorHeap { - VkDescriptorPool descriptorPool = VK_NULL_HANDLE; VkDescriptorSetLayout descriptorSetLayout = VK_NULL_HANDLE; + VkDescriptorPool descriptorPool = VK_NULL_HANDLE; VkDescriptorSet descriptorSet = VK_NULL_HANDLE; std::vector freelist; std::mutex locker; @@ -438,8 +438,17 @@ namespace wiGraphics } void destroy(VkDevice device) { - vkDestroyDescriptorPool(device, descriptorPool, nullptr); - vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr); + if (descriptorSetLayout != VK_NULL_HANDLE) + { + vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr); + descriptorSetLayout = VK_NULL_HANDLE; + } + + if (descriptorPool != VK_NULL_HANDLE) + { + vkDestroyDescriptorPool(device, descriptorPool, nullptr); + descriptorPool = VK_NULL_HANDLE; + } } int allocate() @@ -485,7 +494,6 @@ namespace wiGraphics std::deque> destroyer_renderpasses; std::deque> destroyer_framebuffers; std::deque> destroyer_querypools; - std::deque> destroyer_bindlessUniformBuffers; std::deque> destroyer_bindlessSampledImages; std::deque> destroyer_bindlessUniformTexelBuffers; std::deque> destroyer_bindlessStorageBuffers; @@ -709,18 +717,6 @@ namespace wiGraphics break; } } - while (!destroyer_bindlessUniformBuffers.empty()) - { - if (destroyer_bindlessUniformBuffers.front().second + BUFFERCOUNT < FRAMECOUNT) - { - int index= destroyer_bindlessUniformBuffers.front().first; - destroyer_bindlessUniformBuffers.pop_front(); - } - else - { - break; - } - } while (!destroyer_bindlessSampledImages.empty()) { if (destroyer_bindlessSampledImages.front().second + BUFFERCOUNT < FRAMECOUNT)