[gtk: 1/2] vulkan: Don't attempt to free 0 command buffers




commit 2f98de06bc94252cefaf21410c498b71f25b03f9
Author: TestingPlant <49836-TestingPlant users noreply gitlab gnome org>
Date:   Sun May 8 04:32:26 2022 +0000

    vulkan: Don't attempt to free 0 command buffers
    
    vkFreeCommandBuffers can't be called with commandBufferCount set to 0.

 gsk/vulkan/gskvulkancommandpool.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gsk/vulkan/gskvulkancommandpool.c b/gsk/vulkan/gskvulkancommandpool.c
index 03d4bdc6ed..0afb59c24d 100644
--- a/gsk/vulkan/gskvulkancommandpool.c
+++ b/gsk/vulkan/gskvulkancommandpool.c
@@ -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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]