summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2018-05-29 15:03:28 -0700
committerChris Forbes <chrisforbes@google.com>2018-05-29 17:14:32 -0700
commit31b85c2326ea082733a848d47b630f44c7888549 (patch)
tree905282a37c329ad29c68dc4eaca8c9478bb2252d
parentb06767b778718f9e1cf12850f1fd3b0dfa17d2d3 (diff)
downloadnative-31b85c2326ea082733a848d47b630f44c7888549.tar.gz
Fix cleanup of swapchain images in the shared case
Previously we'd fail to call DestroyImage for images in the shared swapchain. We only need to skip cancelBuffer. Bug: b/78779994 Test: dEQP-VK.wsi.android.* Change-Id: Ic95887fb76a8ab5d01e6e3aaa3f63dddc697ea4c
-rw-r--r--vulkan/libvulkan/swapchain.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index c42e81132c..3db8a3962e 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1268,19 +1268,19 @@ VkResult CreateSwapchainKHR(VkDevice device,
//
// 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);
}
}