Jason Simmons a1e7c05d18 [Impeller] Fix a race between SwapchainImplVK::Present and WaitForFence (flutter/engine#49777)
The previous implementation used an fml::CountDownLatch to synchronize between FrameSynchronizer::WaitForFence and the task queued by SwapchainImplVK::Present.

fml::CountDownLatch:Wait always waits, even if the count is already zero.  So the raster thread would deadlock if the present task signals the latch before FrameSynchronizer::WaitForFence enters the wait.

This PR instead uses a semaphore that is set each time SwapchainImplVK::Present is called.  FrameSynchronizer::WaitForFence will check the semaphore to determine whether a present task is pending and if so wait for its completion.
2024-01-16 22:30:57 +00:00
..