Waits Vulkan device idle also on window resize

Fixes the case when a swapchain was recreated on resize rather than
by VK_ERROR_OUT_OF_DATE_KHR.
This commit is contained in:
Vladislav Belov
2025-11-10 00:06:51 +01:00
parent de36c75023
commit 8a64182ca2
+12 -8
View File
@@ -805,13 +805,6 @@ bool CDevice::AcquireNextBackbuffer()
{
if (!IsSwapChainValid())
{
vkDeviceWaitIdle(m_Device);
// Since we know there is no GPU work in progress we can free resources
// queued for deletion.
ProcessDeviceObjectToDestroyQueue(true);
ProcessObjectToDestroyQueue(true);
RecreateSwapChain();
if (!IsSwapChainValid())
return false;
@@ -1042,7 +1035,18 @@ std::unique_ptr<CRingCommandContext> CDevice::CreateRingCommandContext(const siz
void CDevice::RecreateSwapChain()
{
m_BackbufferReadbackTexture.reset();
if (m_SwapChain)
{
vkDeviceWaitIdle(m_Device);
m_BackbufferReadbackTexture.reset();
// Since we know there is no GPU work in progress we can free resources
// queued for deletion.
ProcessDeviceObjectToDestroyQueue(true);
ProcessObjectToDestroyQueue(true);
}
int surfaceDrawableWidth = 0, surfaceDrawableHeight = 0;
SDL_Vulkan_GetDrawableSize(m_Window, &surfaceDrawableWidth, &surfaceDrawableHeight);
m_SwapChain = CSwapChain::Create(