wined3d: Destroy the Vulkan command pool after cleaning up resources.

This fixes an issue exposed (but not caused) by commit
e553be7e77. Calling vkFreeCommandBuffers()
after the corresponding command pool was destroyed causes invalid memory
accesses. Thanks to Jacek for pointing this out.
This commit is contained in:
Henri Verbeet 2022-09-14 15:14:44 +02:00 committed by Alexandre Julliard
parent 99a3bc3c2b
commit 51466755ad

View file

@ -1684,10 +1684,13 @@ void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
heap_free(context_vk->vk_descriptor_pools);
if (context_vk->vk_framebuffer)
VK_CALL(vkDestroyFramebuffer(device_vk->vk_device, context_vk->vk_framebuffer, NULL));
VK_CALL(vkDestroyCommandPool(device_vk->vk_device, context_vk->vk_command_pool, NULL));
if (context_vk->vk_so_counter_bo.vk_buffer)
wined3d_context_vk_destroy_bo(context_vk, &context_vk->vk_so_counter_bo);
wined3d_context_vk_cleanup_resources(context_vk, VK_NULL_HANDLE);
/* Destroy the command pool after cleaning up resources. In particular,
* this needs to happen after all command buffers are freed, because
* vkFreeCommandBuffers() requires a valid pool handle. */
VK_CALL(vkDestroyCommandPool(device_vk->vk_device, context_vk->vk_command_pool, NULL));
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_occlusion_query_pools);
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_timestamp_query_pools);
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_pipeline_statistics_query_pools);