mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
- recreate Vulkan swapchain in case of surface lost error
Do not abort with fatal error when VK_ERROR_SURFACE_LOST_KHR was returned from vkAcquireNextImageKHR() or vkQueuePresentKHR() So far, only gfx-portability implementation is reporting this error from time to time, usually on startup, entering the game, or task switching
This commit is contained in:
parent
154af34cd9
commit
5870cb7ea1
1 changed files with 2 additions and 10 deletions
|
@ -44,7 +44,7 @@ uint32_t VulkanSwapChain::AcquireImage(int width, int height, VulkanSemaphore *s
|
|||
{
|
||||
break;
|
||||
}
|
||||
else if (result == VK_SUBOPTIMAL_KHR)
|
||||
else if (result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_SURFACE_LOST_KHR)
|
||||
{
|
||||
// Force the recreate to happen next frame.
|
||||
// The spec is not very clear about what happens to the semaphore or the acquired image if the swapchain is recreated before the image is released with a call to vkQueuePresentKHR.
|
||||
|
@ -69,10 +69,6 @@ uint32_t VulkanSwapChain::AcquireImage(int width, int height, VulkanSemaphore *s
|
|||
{
|
||||
VulkanError("vkAcquireNextImageKHR failed: device lost");
|
||||
}
|
||||
else if (result == VK_ERROR_SURFACE_LOST_KHR)
|
||||
{
|
||||
VulkanError("vkAcquireNextImageKHR failed: surface lost");
|
||||
}
|
||||
else
|
||||
{
|
||||
VulkanError("vkAcquireNextImageKHR failed");
|
||||
|
@ -92,7 +88,7 @@ void VulkanSwapChain::QueuePresent(uint32_t imageIndex, VulkanSemaphore *semapho
|
|||
presentInfo.pImageIndices = &imageIndex;
|
||||
presentInfo.pResults = nullptr;
|
||||
VkResult result = vkQueuePresentKHR(device->presentQueue, &presentInfo);
|
||||
if (result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_OUT_OF_DATE_KHR)
|
||||
if (result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_ERROR_SURFACE_LOST_KHR)
|
||||
{
|
||||
lastSwapWidth = 0;
|
||||
lastSwapHeight = 0;
|
||||
|
@ -108,10 +104,6 @@ void VulkanSwapChain::QueuePresent(uint32_t imageIndex, VulkanSemaphore *semapho
|
|||
{
|
||||
VulkanError("vkQueuePresentKHR failed: device lost");
|
||||
}
|
||||
else if (result == VK_ERROR_SURFACE_LOST_KHR)
|
||||
{
|
||||
VulkanError("vkQueuePresentKHR failed: surface lost");
|
||||
}
|
||||
else if (result != VK_SUCCESS)
|
||||
{
|
||||
VulkanError("vkQueuePresentKHR failed");
|
||||
|
|
Loading…
Reference in a new issue