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.hh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/queue_context.hh') diff --git a/src/queue_context.hh b/src/queue_context.hh index a52e718..873a85a 100644 --- a/src/queue_context.hh +++ b/src/queue_context.hh @@ -20,6 +20,7 @@ class QueueContext final : public Context { // we give up tracking them. This is neccessary for queues which do not // present anything. static constexpr auto MAX_TRACKED_SUBMISSIONS = 50u; + static constexpr auto MAX_TRACKED_PRESENT_IDS = 50u; public: DeviceContext& device; @@ -79,6 +80,13 @@ class QueueContext final : public Context { using present_id_t = std::uint64_t; std::unordered_map unpresented_submissions; + // We might be tracking present_ids which aren't presented to - and as a + // result we don't ever clear those Submissions. So manually evict them by + // removing the n'th oldest. This is elegant because even if our + // SwapchainMonitor has these stored (unlikely) they won't be destructed as + // it just decrements their std::shared_ptr use count. + std::deque present_id_ring; + public: QueueContext(DeviceContext& device_context, const VkQueue& queue, const std::uint32_t& queue_family_index); -- cgit v1.2.3