Fixed viewport swapchains not getting recreated in some cases

docking
TheCherno 3 years ago
parent 9a345cfb61
commit 65b4553490

@ -1477,7 +1477,20 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
info.pSwapchains = &wd->Swapchain;
info.pImageIndices = &present_index;
err = vkQueuePresentKHR(v->Queue, &info);
check_vk_result(err);
//check_vk_result(err);
if (err != VK_SUCCESS || err == VK_SUBOPTIMAL_KHR)
{
if (err == VK_ERROR_OUT_OF_DATE_KHR)
{
// Swap chain is no longer compatible with the surface and needs to be recreated
ImGui_ImplVulkanH_CreateOrResizeWindow(v->Instance, v->PhysicalDevice, v->Device, wd, v->QueueFamily, v->Allocator, (int)viewport->Size.x, (int)viewport->Size.y, v->MinImageCount);
return;
}
else
{
check_vk_result(err);
}
}
wd->FrameIndex = (wd->FrameIndex + 1) % wd->ImageCount; // This is for the next vkWaitForFences()
wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->ImageCount; // Now we can use the next set of semaphores

Loading…
Cancel
Save