Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recoverable Error Code VK_ERROR_OUT_OF_DATE_KHR Causes a Crash #632

Open
PatRibas opened this issue Oct 23, 2024 · 0 comments
Open

Recoverable Error Code VK_ERROR_OUT_OF_DATE_KHR Causes a Crash #632

PatRibas opened this issue Oct 23, 2024 · 0 comments

Comments

@PatRibas
Copy link

In SwapChainVkImpl::SwapChainVkImpl, we have the following code:

auto res = AcquireNextImage(pDeviceContextVk);
DEV_CHECK_ERR(res == VK_SUCCESS, "Failed to acquire next image for the newly created swap chain");

which, if this call to vkAcquireNextImageKHR inside AcquireNextImage

auto res = vkAcquireNextImageKHR(LogicalDevice.GetVkDevice(), m_VkSwapChain, UINT64_MAX, ImageAcquiredSemaphore, ImageAcquiredFence, &m_BackBufferIndex);

m_ImageAcquiredFenceSubmitted[m_SemaphoreIndex] = (res == VK_SUCCESS);
if (res == VK_SUCCESS)
{
    /* we never get here */
}

return res;

happens to return VK_ERROR_OUT_OF_DATE_KHR, will immediately crash at the DEV_CHECK_ERR. However, this error should be recoverable; https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkResult.html states

VK_ERROR_OUT_OF_DATE_KHR A surface has changed in such a way that it is no longer compatible with the swapchain, and further presentation requests using the swapchain will fail. Applications must query the new surface properties and recreate their swapchain if they wish to continue presenting to the surface.

It would be great if, in the future, the Vulkan swapchain implementation could check for this error, and either try to recreate the swapchain, or propagate this error to the user and allow users to provide new parameters in a future call (or something along those lines that does not result in a crash). Right now, this sometimes fails on my first call to factoryVk->CreateSwapChainVk on Ubuntu 24.04, which is problematic as it seems there is nothing I can without modifying Diligent code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant