• Peng Huang's avatar
    Fix crash in gpu::VulkanSwapChain::ScopedWrite::ScopedWrite · 9dfaeca2
    Peng Huang authored
    The crash is because the vkAcquireNextImageKHR() fails with
    VK_ERROR_SURFACE_LOST_KHR, probably the platform window is
    closed, or a new swapchain is created with the same platform
    window. Since vkAcquireNextImageKHR() is called just before
    rendering DDL to the vkmage, if there isn't a new vkimage
    is available, it is too late to properly handle it. Fix
    the problem by call vkAcquireNextImageKHR() immemorially after
    vkQueuePresentKHR() call. If vkQueuePresentKHR() call is successful,
    then the surface should be good, and vkAcquireNextImageKHR()
    should be successful too. If surface is lost, vkQueuePresentKHR()
    will return VK_ERROR_SURFACE_LOST_KHR., and then the PresentBuffer()
    will return SWAP_FAILED to caller. Caller should be able to handle it
    properly like it does with GL and glSwapBuffers().
    
    Bug: 1070754
    Change-Id: I697cca3a282d046e9592d554403f7c10c811cf19
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155197
    Commit-Queue: Peng Huang <penghuang@chromium.org>
    Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
    Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
    Auto-Submit: Peng Huang <penghuang@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#760555}
    9dfaeca2
vulkan_swap_chain.h 4.54 KB