Commit 28383fb2 by Geoff Lang Committed by Commit Bot

Vulkan: Wrap aquire semaphore in a vk::Scoped

If vkAcquireNextImageKHR fails, the aquireImageSemaphore would be leaked, wrap it in a vk::Scoped so it is always cleaned up. BUG=angleproject:2464 Change-Id: Ic4a0e16c89ea7c35cf060e5601760422e673c080 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1585318Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 82133763
......@@ -827,17 +827,17 @@ angle::Result WindowSurfaceVk::nextSwapchainImage(DisplayVk *displayVk)
{
VkDevice device = displayVk->getDevice();
vk::Semaphore aquireImageSemaphore;
ANGLE_VK_TRY(displayVk, aquireImageSemaphore.init(device));
vk::Scoped<vk::Semaphore> aquireImageSemaphore(device);
ANGLE_VK_TRY(displayVk, aquireImageSemaphore.get().init(device));
ANGLE_VK_TRY(displayVk, vkAcquireNextImageKHR(device, mSwapchain, UINT64_MAX,
aquireImageSemaphore.getHandle(), VK_NULL_HANDLE,
&mCurrentSwapchainImageIndex));
aquireImageSemaphore.get().getHandle(),
VK_NULL_HANDLE, &mCurrentSwapchainImageIndex));
// After presenting, the flush semaphore chain is cleared. The semaphore returned by
// vkAcquireNextImage will start a new chain.
ASSERT(mFlushSemaphoreChain.empty());
mFlushSemaphoreChain.push_back(std::move(aquireImageSemaphore));
mFlushSemaphoreChain.push_back(aquireImageSemaphore.release());
SwapchainImage &image = mSwapchainImages[mCurrentSwapchainImageIndex];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment