diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-04-06 18:02:18 +1000 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-04-06 18:02:18 +1000 |
| commit | e5087ff69f63e8c1d6f3a2239d05119b686e6935 (patch) | |
| tree | 7dff3a5d62624aef7a289ce941fc24f609e4b9cb | |
| parent | 312d8736ae0df55c9f33e4eb5c00e4cd77e1c33f (diff) | |
Don't fail hard when the swapchain is erased and we can't find it
| -rw-r--r-- | src/strategies/low_latency2/device_strategy.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/strategies/low_latency2/device_strategy.cc b/src/strategies/low_latency2/device_strategy.cc index 18ea21f..08002a9 100644 --- a/src/strategies/low_latency2/device_strategy.cc +++ b/src/strategies/low_latency2/device_strategy.cc @@ -30,7 +30,6 @@ void LowLatency2DeviceStrategy::notify_create_swapchain( const auto lock = std::scoped_lock{this->mutex}; const auto iter = this->swapchain_monitors.emplace(swapchain, this->device); - assert(iter.second); iter.first->second.update_params(was_low_latency_requested, std::chrono::microseconds{0}); } @@ -50,7 +49,9 @@ void LowLatency2DeviceStrategy::notify_latency_sleep_mode( const auto lock = std::shared_lock{this->mutex}; const auto iter = this->swapchain_monitors.find(swapchain); - assert(iter != std::end(this->swapchain_monitors)); + if (iter == std::end(this->swapchain_monitors)) { + return; + } using namespace std::chrono; if (info) { @@ -100,8 +101,9 @@ void LowLatency2DeviceStrategy::submit_swapchain_present_id( // Fail hard here, the swapchain must exist or something has gone wrong with // Vulkan bookkeeping. const auto iter = this->swapchain_monitors.find(swapchain); - assert(iter != std::end(this->swapchain_monitors)); - + if (iter == std::end(this->swapchain_monitors)) { + return; + } // Notify our monitor that this work has to be completed before they signal // whatever semaphore is currently sitting in it. iter->second.attach_work(std::move(work)); @@ -112,10 +114,10 @@ void LowLatency2DeviceStrategy::notify_latency_sleep_nv( const auto lock = std::scoped_lock{this->mutex}; - // Again, fail hard here - something has gone terribly wrong. const auto iter = this->swapchain_monitors.find(swapchain); - assert(iter != std::end(this->swapchain_monitors)); - + if (iter == std::end(this->swapchain_monitors)) { + return; + } iter->second.notify_semaphore(info.signalSemaphore, info.value); } |
