diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-05 11:09:31 +1000 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-05 11:09:31 +1000 |
| commit | bdc26a286db6d9460c92ee6326e4a591726f59a1 (patch) | |
| tree | 5b4899f308082f56d5052dbf8f9ef9c975b146ca | |
| parent | 3e99ed233e6ca3be1f066ff9f4cd1a6a9fe16eea (diff) | |
Signal oldest semaphore instead of newest for Reflex
| -rw-r--r-- | src/swapchain_monitor.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/swapchain_monitor.cc b/src/swapchain_monitor.cc index de950a3..e3be104 100644 --- a/src/swapchain_monitor.cc +++ b/src/swapchain_monitor.cc @@ -67,11 +67,10 @@ void ReflexSwapchainMonitor::do_monitor(const std::stop_token stoken) { break; } - // Grab the most recent semaphore we want to signal off the queue and - // clear it. + // Pop the oldest semaphore we want to signal off the queue. const auto semaphore_submission = - std::move(this->semaphore_submissions.back()); - this->semaphore_submissions.clear(); + std::move(this->semaphore_submissions.front()); + this->semaphore_submissions.pop_front(); // If we're stopping, signal the semaphore and don't worry about work // actually completing. @@ -89,10 +88,13 @@ void ReflexSwapchainMonitor::do_monitor(const std::stop_token stoken) { void ReflexSwapchainMonitor::notify_semaphore( const VkSemaphore& timeline_semaphore, const std::uint64_t& value) { + auto lock = std::unique_lock{this->mutex}; const auto wakeup_semaphore = WakeupSemaphore{ .timeline_semaphore = timeline_semaphore, .value = value}; + + // Signal immediately if reflex is off or it's a no-op submit. if (!this->was_low_latency_requested || this->in_flight_submissions.empty()) { @@ -100,6 +102,7 @@ void ReflexSwapchainMonitor::notify_semaphore( return; } + // Signal immediately if our outstanding work has already completed. if (this->in_flight_submissions.back()->has_completed()) { this->in_flight_submissions.clear(); wakeup_semaphore.signal(this->device); |
