From 108801fe96d855c5ccf532639a6db8ff0065310e Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Mon, 30 Mar 2026 22:47:12 +1100 Subject: Move timestamp pool reacquisition to an asynchronous worker queue, fix device_context race during destructor --- src/queue_context.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/queue_context.cc') diff --git a/src/queue_context.cc b/src/queue_context.cc index 437a183..0356c5c 100644 --- a/src/queue_context.cc +++ b/src/queue_context.cc @@ -59,6 +59,10 @@ void QueueContext::notify_submit( if (submissions == nullptr) { submissions = std::make_shared>>(); + + if (present_id) { + this->present_id_ring.emplace_back(present_id); + } } submissions->push_back( @@ -66,12 +70,17 @@ void QueueContext::notify_submit( .tail_handle = tail_handle, .cpu_present_time = now})); - // This is probably hit if our queue never actually presents to anything, - // because the only time we manually evict our unpresent_submissions is - // when we present to something. + // This is probably hit if our queue never actually presents to anything. if (std::size(*submissions) > this->MAX_TRACKED_SUBMISSIONS) { submissions->pop_front(); } + + if (std::size(this->present_id_ring) > MAX_TRACKED_PRESENT_IDS) { + const auto evicted_present_id = this->present_id_ring.front(); + this->present_id_ring.pop_front(); + + this->unpresented_submissions.erase(evicted_present_id); + } } void QueueContext::notify_present(const VkSwapchainKHR& swapchain, -- cgit v1.2.3