On Thu, Mar 11, 2021 at 12:53 PM Henri Verbeet <hverbeet(a)gmail.com> wrote:
On Wed, 10 Mar 2021 at 20:50, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
@@ -1142,8 +1162,21 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, present_desc.pSwapchains = &swapchain_vk->vk_swapchain; present_desc.pImageIndices = &image_idx; present_desc.pResults = NULL; - if ((vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc)))) + vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc)); + if (vr == VK_ERROR_OUT_OF_DATE_KHR || vr == VK_SUBOPTIMAL_KHR) + { + if (FAILED(hr = wined3d_swapchain_vk_recreate(swapchain_vk))) + ERR("Failed to recreate swapchain, hr %#x.\n", hr); + if (vr == VK_ERROR_OUT_OF_DATE_KHR) + { + if ((vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc)))) + ERR("Present returned vr %s.\n", wined3d_debug_vkresult(vr)); Does that work? I'd expect swapchain image content to be undefined after recreating the swapchain. (For reference, what I had in mind was to return a VkResult from wined3d_swapchain_vk_blit(), either from vkAcquireNextImageKHR() or vkQueuePresentKHR(), and then recreate the swapchain and redo the blit in the caller.)
That makes a lot more sense than what I did here...