Merge branch 'update-command-buffer-freeing' into 'main'

vulkan: Don't attempt to free 0 command buffers

See merge request GNOME/gtk!4705
This commit is contained in:
Matthias Clasen 2022-05-27 12:25:48 +00:00
commit 38b393ff5d

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);
}