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.
This commit is contained in:
Georges Basile Stavracas Neto 2017-12-13 22:43:50 -02:00
parent 192bdae280
commit 147a455171

View File

@ -772,11 +772,11 @@ gsk_vulkan_image_finalize (GObject *object)
* the VkImage */ * the VkImage */
if (self->memory) if (self->memory)
{ {
gsk_vulkan_memory_free (self->memory);
vkDestroyImage (gdk_vulkan_context_get_device (self->vulkan), vkDestroyImage (gdk_vulkan_context_get_device (self->vulkan),
self->vk_image, self->vk_image,
NULL); NULL);
gsk_vulkan_memory_free (self->memory);
} }
g_object_unref (self->vulkan); g_object_unref (self->vulkan);