From 2180280c8e6059aae776d6f8cd2a6dd5f9bed567 Mon Sep 17 00:00:00 2001 From: DrChat Date: Fri, 2 Mar 2018 22:13:59 -0600 Subject: [PATCH] [Vulkan UI] Stash the last signalled fence to speed up Scavenge --- src/xenia/ui/vulkan/circular_buffer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/ui/vulkan/circular_buffer.cc b/src/xenia/ui/vulkan/circular_buffer.cc index 46b3df9c4..9230df48e 100644 --- a/src/xenia/ui/vulkan/circular_buffer.cc +++ b/src/xenia/ui/vulkan/circular_buffer.cc @@ -249,20 +249,25 @@ void CircularBuffer::Clear() { } void CircularBuffer::Scavenge() { + // Stash the last signalled fence + VkFence fence = nullptr; while (!allocations_.empty()) { Allocation& alloc = allocations_.front(); - if (vkGetFenceStatus(*device_, alloc.fence) != VK_SUCCESS) { + if (fence != alloc.fence && + vkGetFenceStatus(*device_, alloc.fence) != VK_SUCCESS) { // Don't bother freeing following allocations to ensure proper ordering. break; } - allocations_.pop(); + fence = alloc.fence; if (capacity_ - read_head_ < alloc.aligned_length) { // This allocation is stored at the beginning of the buffer. read_head_ = alloc.aligned_length; } else { read_head_ += alloc.aligned_length; } + + allocations_.pop(); } if (allocations_.empty()) {