From 147a4551711e5ce762094c13bbdcd8cadf55965a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 13 Dec 2017 22:43:50 -0200 Subject: [PATCH] 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 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gsk/gskvulkanimage.c b/gsk/gskvulkanimage.c index 8ebcd9e358..8d3bdb42e0 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);