diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-02-19 13:16:14 +1100 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-02-19 13:16:14 +1100 |
| commit | 3a5299c81884e8b28fa6a1a57f31c3375a4b633d (patch) | |
| tree | c494bf7c192cb965daf469615ff7c65f63fa6dc5 /src/timestamp_pool.hh | |
| parent | bb6195afa0fc2ae2a5fe00b718fc71630a696855 (diff) | |
Don't mess with timeline semaphores in submit, spin on vkGetQueryPoolResults instead, fix start = end submission issue
Diffstat (limited to 'src/timestamp_pool.hh')
| -rw-r--r-- | src/timestamp_pool.hh | 20 |
1 files changed, 19 insertions, 1 deletions
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 @@ -60,6 +60,11 @@ class TimestampPool final { 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<QueryChunk> 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<DeviceContext::Clock::time_point_t> get_time(); + + // Calls get_time() repeatedly under a spinlock, or gives up at + // time_point_t and returns std::nullopt. + std::optional<DeviceContext::Clock::time_point_t> + 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: |
