From 3a5299c81884e8b28fa6a1a57f31c3375a4b633d Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 19 Feb 2026 13:16:14 +1100 Subject: Don't mess with timeline semaphores in submit, spin on vkGetQueryPoolResults instead, fix start = end submission issue --- src/timestamp_pool.hh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/timestamp_pool.hh') diff --git a/src/timestamp_pool.hh b/src/timestamp_pool.hh index b7aa54e..bfdad2e 100644 --- a/src/timestamp_pool.hh +++ b/src/timestamp_pool.hh @@ -59,6 +59,11 @@ class TimestampPool final { private: friend class TimestampPool; + private: + // For our spinlock functions this is the period in which we sleep + // between attempts. + static constexpr auto SPINLOCK_MAX_DELAY = std::chrono::microseconds(1); + private: const TimestampPool& timestamp_pool; const std::weak_ptr origin_chunk; @@ -82,7 +87,20 @@ class TimestampPool final { void setup_command_buffers(const Handle& tail, const QueueContext& queue_context) const; - DeviceContext::Clock::time_point_t get_time(); + // Attempts to get_time, but returns an optional if it's not available + // yet. + std::optional get_time(); + + // Calls get_time() repeatedly under a spinlock, or gives up at + // time_point_t and returns std::nullopt. + std::optional + get_time_spinlock(const DeviceContext::Clock::time_point_t& until); + + // Calls get_time() repeatedly under a spinlock until it's available. + DeviceContext::Clock::time_point_t get_time_spinlock(); + + // Calls get_time with the assumption it's already available. + DeviceContext::Clock::time_point_t get_time_required(); }; public: -- cgit v1.2.3