[gtk+] vulkan: Destroy image before releasing associate memory



commit 147a4551711e5ce762094c13bbdcd8cadf55965a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Dec 13 22:43:50 2017 -0200

    vulkan: Destroy image before releasing associate memory
    
    VkImage contains a reference to the VkDeviceMemory and, because
    the current code frees the VkDeviceMemory before destroying the
    VkImage that references it, a warning is triggered by the validation
    layers.
    
    This is not critical, since we release both resources at the same
    place. But the warning triggered by the validation layers sums up
    adding 1 MB per second of extra debug logging, making the debugging
    process much more painful.
    
    This commit simply swaps the destruction order, and destroys the
    VkImage first, then the now unused VkDeviceMemory.

 gsk/gskvulkanimage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskvulkanimage.c b/gsk/gskvulkanimage.c
index 8ebcd9e..8d3bdb4 100644
--- a/gsk/gskvulkanimage.c
+++ b/gsk/gskvulkanimage.c
@@ -772,11 +772,11 @@ gsk_vulkan_image_finalize (GObject *object)
    * the VkImage */
   if (self->memory)
     {
-      gsk_vulkan_memory_free (self->memory);
-
       vkDestroyImage (gdk_vulkan_context_get_device (self->vulkan),
                       self->vk_image,
                       NULL);
+
+      gsk_vulkan_memory_free (self->memory);
     }
 
   g_object_unref (self->vulkan);


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