mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user