Fix cleanup of swapchain images in the shared case
am: 31b85c2326
Change-Id: Iea63a324be09030e9cf25362472d74061d071225
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index c42e811..3db8a39 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1268,19 +1268,19 @@
//
// TODO(jessehall): The error path here is the same as DestroySwapchain,
// but not the non-error path. Should refactor/unify.
- if (!swapchain->shared) {
- for (uint32_t i = 0; i < num_images; i++) {
- Swapchain::Image& img = swapchain->images[i];
- if (img.dequeued) {
+ for (uint32_t i = 0; i < num_images; i++) {
+ Swapchain::Image& img = swapchain->images[i];
+ if (img.dequeued) {
+ if (!swapchain->shared) {
surface.window->cancelBuffer(surface.window.get(), img.buffer.get(),
img.dequeue_fence);
img.dequeue_fence = -1;
img.dequeued = false;
}
- if (result != VK_SUCCESS) {
- if (img.image)
- dispatch.DestroyImage(device, img.image, nullptr);
- }
+ }
+ if (result != VK_SUCCESS) {
+ if (img.image)
+ dispatch.DestroyImage(device, img.image, nullptr);
}
}