Commit 9047ce5b by Jamie Madill Committed by Commit Bot

Vulkan: Fix bad delete of swapchain.

We could end up deleting a dirty pointer if the driver set an output value during a call to vkCreateSwapchainKHR that generates an error. In practice this turned up in some edge cases with SwiftShader. Fix this by using a temporary variable. Bug: chromium:1079475 Change-Id: Ia40e1fac94cbd56fd3bb800a179bb38b7f11fa26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2216292Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 30298dc2
...@@ -896,7 +896,9 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context, ...@@ -896,7 +896,9 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context,
// TODO(syoussefi): Once EGL_SWAP_BEHAVIOR_PRESERVED_BIT is supported, the contents of the old // TODO(syoussefi): Once EGL_SWAP_BEHAVIOR_PRESERVED_BIT is supported, the contents of the old
// swapchain need to carry over to the new one. http://anglebug.com/2942 // swapchain need to carry over to the new one. http://anglebug.com/2942
ANGLE_VK_TRY(context, vkCreateSwapchainKHR(device, &swapchainInfo, nullptr, &mSwapchain)); VkSwapchainKHR newSwapChain = VK_NULL_HANDLE;
ANGLE_VK_TRY(context, vkCreateSwapchainKHR(device, &swapchainInfo, nullptr, &newSwapChain));
mSwapchain = newSwapChain;
mSwapchainPresentMode = mDesiredSwapchainPresentMode; mSwapchainPresentMode = mDesiredSwapchainPresentMode;
// Intialize the swapchain image views. // Intialize the swapchain image views.
......
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