From 8f4501215c0dbbbde59da2d015fdec3dbe5131bc Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Fri, 13 Feb 2026 18:21:04 +1100 Subject: add working frame tracking and commit before i break everything --- src/queue_context.hh | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'src/queue_context.hh') diff --git a/src/queue_context.hh b/src/queue_context.hh index 184e31d..a6f43e5 100644 --- a/src/queue_context.hh +++ b/src/queue_context.hh @@ -7,8 +7,11 @@ #include #include -#include +#include #include +#include +#include +#include namespace low_latency { @@ -21,19 +24,56 @@ class QueueContext final : public Context { const VkQueue queue; const std::uint32_t queue_family_index; - // this is incremented and tied to our semaphore std::uint64_t semaphore_sequence = 0; VkSemaphore semaphore; VkCommandPool command_pool; std::unique_ptr timestamp_pool; - std::deque> handle_hack; + + // Potentially in flight queue submissions + struct Submission { + const std::unordered_set signals; + const std::unordered_set waits; + const std::uint64_t target_semaphore_sequence; + const std::shared_ptr timestamp_handle; + }; + std::deque> submissions; + + // In flight frames! + // These might come from different contexts. + struct Frame { + const QueueContext& start_context; + const std::shared_ptr start; + const std::uint64_t target_start_sequence; + + const QueueContext& end_context; + const std::shared_ptr end; + const std::uint64_t target_end_sequence; + }; + // These can be null, it means we made presented without finding the + // timestamps associated with the present. + std::deque> in_flight_frames; public: QueueContext(DeviceContext& device_context, const VkQueue& queue, const std::uint32_t& queue_family_index); virtual ~QueueContext(); + + public: + void notify_submit(std::span infos, + const std::uint64_t target_semaphore_sequence, + std::shared_ptr&& handle); + void notify_submit(std::span infos, + const std::uint64_t target_semaphore_sequence, + std::shared_ptr&& handle); + + void notify_present(const VkPresentInfoKHR& info); + + public: + // Computes the amount we should delay... + using duration_t = std::chrono::steady_clock::duration; + std::optional get_delay_time(); }; }; // namespace low_latency -- cgit v1.2.3