summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Forbes <chrisforbes@google.com> 2017-03-30 19:47:37 +1300
committer Chris Forbes <chrisforbes@google.com> 2017-03-31 17:50:40 +1300
commitc88409c2b8e99be8d5f134e260c4c29b1e632b3c (patch)
tree7e69ee021080525d0f72ecfa87f93242ea479fa2
parente0ced03e62565f42b3005ec34481ef2be7ae2d4b (diff)
vulkan: Don't dequeue in AcquireNextImageKHR if in shared mode
We've already got the shared buffer dequeued. All we need to do here is make the semaphore and fence work. Test: build Change-Id: I77a49c312e91b5e0657b87ac2748428c631bdbc0
-rw-r--r--vulkan/libvulkan/swapchain.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index e2e733e0a3..a4f968a7b2 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1210,6 +1210,16 @@ VkResult AcquireNextImageKHR(VkDevice device,
timeout != UINT64_MAX,
"vkAcquireNextImageKHR: non-infinite timeouts not yet implemented");
+ if (swapchain.shared) {
+ // In shared mode, we keep the buffer dequeued all the time, so we don't
+ // want to dequeue a buffer here. Instead, just ask the driver to ensure
+ // the semaphore and fence passed to us will be signalled.
+ *image_index = 0;
+ result = GetData(device).driver.AcquireImageANDROID(
+ device, swapchain.images[*image_index].image, -1, semaphore, vk_fence);
+ return result;
+ }
+
ANativeWindowBuffer* buffer;
int fence_fd;
err = window->dequeueBuffer(window, &buffer, &fence_fd);