mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 04:40:30 +00:00
disp/vulkan: Don't crash when image acquire fails multiple times
It is not uncommon for swapchain image acquire to fail multiple times in a row e.g. when the user is continuously resizing the windown with the mouse cursor. There is really no need to raise an exception and crash the whole process.
This commit is contained in:
@@ -564,9 +564,12 @@ bool VulkanDisplay::display_queued_image() {
|
||||
int swapchain_recreation_attempt = 0;
|
||||
while (swapchain_image_id == swapchain_image_out_of_date || swapchain_image_id == swapchain_image_timeout)
|
||||
{
|
||||
const int swapchain_recreation_warn_tries = 50;
|
||||
swapchain_recreation_attempt++;
|
||||
if (swapchain_recreation_attempt > 3) {
|
||||
throw VulkanError{"Cannot acquire swapchain image"};
|
||||
if (swapchain_image_id == swapchain_image_timeout){
|
||||
vulkan_log_msg(LogLevel::warning, "Swapchain image acquire timed out\n");
|
||||
} else if (swapchain_recreation_attempt > swapchain_recreation_warn_tries) {
|
||||
vulkan_log_msg(LogLevel::warning, "Swapchain image acquire failed "s + std::to_string(swapchain_recreation_warn_tries) + "times in a row\n");
|
||||
}
|
||||
|
||||
auto window_parameters = window->get_window_parameters();
|
||||
|
||||
Reference in New Issue
Block a user