From 674ee33309739d50429db91b2fc812db90bcaec9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 9 Aug 2019 11:07:04 +0100 Subject: [PATCH] If present returns OUT_OF_DATE, force repaint in CheckResizeOutputWindow --- renderdoc/driver/vulkan/vk_outputwindow.cpp | 27 ++++++++++----------- renderdoc/driver/vulkan/vk_replay.h | 3 ++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_outputwindow.cpp b/renderdoc/driver/vulkan/vk_outputwindow.cpp index 1169f91a7..7ee1a8daa 100644 --- a/renderdoc/driver/vulkan/vk_outputwindow.cpp +++ b/renderdoc/driver/vulkan/vk_outputwindow.cpp @@ -35,8 +35,6 @@ VulkanReplay::OutputWindow::OutputWindow() WINDOW_HANDLE_INIT; - fresh = true; - hasDepth = false; failures = recreatePause = 0; @@ -802,6 +800,14 @@ bool VulkanReplay::CheckResizeOutputWindow(uint64_t id) outw.Create(m_pDriver, m_pDriver->GetDev(), outw.hasDepth); else outw.recreatePause--; + + return true; + } + + if(outw.outofdate) + { + outw.outofdate = false; + return true; } return false; @@ -1156,22 +1162,15 @@ void VulkanReplay::FlipOutputWindow(uint64_t id) VkResult retvkr = vt->QueuePresentKHR(Unwrap(m_pDriver->GetQ()), &presentInfo); + m_pDriver->FlushQ(); + if(retvkr == VK_ERROR_OUT_OF_DATE_KHR) { - // force a swapchain recreate. - outw.width = 0; - outw.height = 0; + // this will check the current extent and use that if possible + outw.Create(m_pDriver, m_pDriver->GetDev(), outw.hasDepth); - CheckResizeOutputWindow(id); - - // skip this present - retvkr = vkr = VK_SUCCESS; + outw.outofdate = true; } - - RDCASSERTEQUAL(vkr, VK_SUCCESS); - RDCASSERTEQUAL(retvkr, VK_SUCCESS); - - m_pDriver->FlushQ(); } void VulkanReplay::DestroyOutputWindow(uint64_t id) diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 7aeecc2cd..fe5f399e2 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -423,7 +423,8 @@ private: WINDOW_HANDLE_DECL; - bool fresh; + bool fresh = true; + bool outofdate = false; uint32_t width, height;