vulkan: Don't attempt to free 0 command buffers

vkFreeCommandBuffers can't be called with commandBufferCount set to 0.
This commit is contained in:
TestingPlant 2022-05-08 04:32:26 +00:00
parent 9e6855cdb8
commit 2f98de06bc

View File

@ -37,10 +37,11 @@ gsk_vulkan_command_pool_new (GdkVulkanContext *context)
static void
gsk_vulkan_command_pool_free_buffers (GskVulkanCommandPool *self)
{
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
self->vk_command_pool,
self->buffers->len,
(VkCommandBuffer *) self->buffers->pdata);
if (self->buffers->len != 0)
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
self->vk_command_pool,
self->buffers->len,
(VkCommandBuffer *) self->buffers->pdata);
g_ptr_array_set_size (self->buffers, 0);
}