aboutsummaryrefslogtreecommitdiff
path: root/src/swapchain_monitor.hh
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-04-05 16:59:32 +1000
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-04-05 16:59:32 +1000
commit411f7acb1f92db88d2a3c92bb40da2133852b40e (patch)
treea37377abea35bb01e6e1074e15e4c1b50f66ccf1 /src/swapchain_monitor.hh
parent6cae1c14ebdd9d026134212ed8561fb845a11ff6 (diff)
Nuke old implementation, silence warnings
Diffstat (limited to 'src/swapchain_monitor.hh')
-rw-r--r--src/swapchain_monitor.hh122
1 files changed, 0 insertions, 122 deletions
diff --git a/src/swapchain_monitor.hh b/src/swapchain_monitor.hh
deleted file mode 100644
index 8ffcd04..0000000
--- a/src/swapchain_monitor.hh
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef SWAPCHAIN_MONITOR_HH_
-#define SWAPCHAIN_MONITOR_HH_
-
-// The purpose of this file is to provide a SwapchainMonitor
-
-#include <vulkan/vulkan_core.h>
-
-#include <chrono>
-#include <condition_variable>
-#include <deque>
-#include <memory>
-#include <mutex>
-#include <thread>
-
-#include "queue_context.hh"
-
-namespace low_latency {
-
-class DeviceContext;
-
-// Abstract base class for swapchain completion monitoring. Both implementations
-// currently have an option to frame pace, to disable low_latency mode
-// (become a no-op), and must track in_flight_submissions to function.
-class SwapchainMonitor {
- private:
- static constexpr auto MAX_TRACKED_IN_FLIGHT_SUBMISSIONS = 50u;
-
- protected:
- const DeviceContext& device;
-
- std::mutex mutex;
-
- // Configurarable params for this swapchain.
- std::chrono::microseconds present_delay = std::chrono::microseconds{0};
- bool was_low_latency_requested = false;
-
- std::deque<std::unique_ptr<QueueContext::Submissions>>
- in_flight_submissions;
-
- protected:
- // Small fix to avoid submissions growing limitlessly in size if this
- // swapchain is never presented to.
- void prune_submissions();
-
- public:
- SwapchainMonitor(const DeviceContext& device,
- const bool was_low_latency_requested);
- SwapchainMonitor(const SwapchainMonitor&) = delete;
- SwapchainMonitor(SwapchainMonitor&&) = delete;
- SwapchainMonitor operator=(const SwapchainMonitor&) = delete;
- SwapchainMonitor operator=(SwapchainMonitor&&) = delete;
- virtual ~SwapchainMonitor();
-
- public:
- void update_params(const bool was_low_latency_requested,
- const std::chrono::microseconds present_delay);
-
- public:
- virtual void
- notify_present(std::unique_ptr<QueueContext::Submissions> submissions) = 0;
-};
-
-// Provides asynchronous monitoring of submissions and signalling of some
-// timeline semaphore via a worker thread.
-class ReflexSwapchainMonitor final : public SwapchainMonitor {
- private:
- struct WakeupSemaphore {
- VkSemaphore timeline_semaphore;
- std::uint64_t value;
-
- public:
- void signal(const DeviceContext& device) const;
- };
-
- // A pairing of semaphore -> submissions.
- // If the Submissions completes then signal the bundled semaphore.
- struct SemaphoreSubmissions {
- WakeupSemaphore wakeup_semaphore;
- std::unique_ptr<QueueContext::Submissions> submissions;
- };
- std::deque<SemaphoreSubmissions> semaphore_submissions;
-
- std::condition_variable_any cv;
- std::jthread monitor_worker;
-
- private:
- void do_monitor(const std::stop_token stoken);
-
- public:
- ReflexSwapchainMonitor(const DeviceContext& device,
- const bool was_low_latency_requested);
- virtual ~ReflexSwapchainMonitor();
-
- public:
- void notify_semaphore(const VkSemaphore& timeline_semaphore,
- const std::uint64_t& value);
-
- public:
- virtual void notify_present(
- std::unique_ptr<QueueContext::Submissions> submissions) override;
-};
-
-// Much simpler synchronous waiting without another monitor thread - still need
-// to synchronise across threads however.
-class AntiLagSwapchainMonitor final : public SwapchainMonitor {
- public:
- AntiLagSwapchainMonitor(const DeviceContext& device,
- const bool was_low_latency_requested);
- virtual ~AntiLagSwapchainMonitor();
-
- public:
- // Synchronously wait until all in-flight submissions have completed.
- void await_submissions();
-
- public:
- virtual void notify_present(
- std::unique_ptr<QueueContext::Submissions> submissions) override;
-};
-
-} // namespace low_latency
-
-#endif \ No newline at end of file