diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 14242fe..3a71ea6 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -4556,6 +4556,15 @@ static void VULKAN_DestroyDevice( VULKAN_Wait(device->driverData); + for (i = renderer->swapchainDataCount - 1; i >= 0; i -= 1) + { + VULKAN_INTERNAL_DestroySwapchain(renderer, renderer->swapchainDatas[i]->windowHandle); + } + + SDL_free(renderer->swapchainDatas); + + VULKAN_Wait(device->driverData); + SDL_free(renderer->submittedCommandBuffers); VULKAN_INTERNAL_DestroyBuffer(renderer, renderer->dummyVertexUniformBuffer->vulkanBuffer); @@ -4715,13 +4724,6 @@ static void VULKAN_DestroyDevice( VULKAN_INTERNAL_DestroyUniformBufferPool(renderer, renderer->fragmentUniformBufferPool); VULKAN_INTERNAL_DestroyUniformBufferPool(renderer, renderer->computeUniformBufferPool); - for (i = renderer->swapchainDataCount - 1; i >= 0; i -= 1) - { - VULKAN_INTERNAL_DestroySwapchain(renderer, renderer->swapchainDatas[i]->windowHandle); - } - - SDL_free(renderer->swapchainDatas); - for (i = 0; i < renderer->framebufferHashArray.count; i += 1) { VULKAN_INTERNAL_DestroyFramebuffer(