diff options
author | Chris Forbes <chrisforbes@google.com> | 2017-03-30 19:44:15 +1300 |
---|---|---|
committer | Chris Forbes <chrisforbes@google.com> | 2017-03-31 17:50:40 +1300 |
commit | e0ced03e62565f42b3005ec34481ef2be7ae2d4b (patch) | |
tree | c53e91097bae221ba81757cc2e64b2efc87ef3f6 /vulkan | |
parent | 97ef461b1b6277f0f31f00e9c390424eb71392df (diff) | |
download | native-e0ced03e62565f42b3005ec34481ef2be7ae2d4b.tar.gz |
vulkan: Only cancel buffers during swapchain creation if not shared
When a buffer queue is in shared mode, we're not allowed to cancel
buffers. Just keep the shared buffer dequeued all the time.
Test: build
Change-Id: I9ad4588ebd792ccdfee247d030579e2ef68aaef1
Diffstat (limited to 'vulkan')
-rw-r--r-- | vulkan/libvulkan/swapchain.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp index 5cfe27ce52..e2e733e0a3 100644 --- a/vulkan/libvulkan/swapchain.cpp +++ b/vulkan/libvulkan/swapchain.cpp @@ -1114,17 +1114,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. - for (uint32_t i = 0; i < num_images; i++) { - Swapchain::Image& img = swapchain->images[i]; - if (img.dequeued) { - 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 (!swapchain->shared) { + for (uint32_t i = 0; i < num_images; i++) { + Swapchain::Image& img = swapchain->images[i]; + if (img.dequeued) { + 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); + } } } |