aboutsummaryrefslogtreecommitdiff
path: root/src/strategies/low_latency2/device_strategy.cc
diff options
context:
space:
mode:
authorNicolas James <nj3ahxac@gmail.com>2026-04-06 12:18:10 +1000
committerNicolas James <nj3ahxac@gmail.com>2026-04-06 12:18:10 +1000
commita9a083ea5c649498d2f12e611dbc7c767d152130 (patch)
treee67cfd11bc37a4faa0f1fbd448e66307cd75a624 /src/strategies/low_latency2/device_strategy.cc
parentfcdac1c3287d314d7127516d56f0dec788392063 (diff)
Add WIP refactored reflex impl
Diffstat (limited to 'src/strategies/low_latency2/device_strategy.cc')
-rw-r--r--src/strategies/low_latency2/device_strategy.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/strategies/low_latency2/device_strategy.cc b/src/strategies/low_latency2/device_strategy.cc
index 7c10088..3a970a2 100644
--- a/src/strategies/low_latency2/device_strategy.cc
+++ b/src/strategies/low_latency2/device_strategy.cc
@@ -1,5 +1,8 @@
#include "device_strategy.hh"
+#include "helper.hh"
+#include <mutex>
+
namespace low_latency {
LowLatency2DeviceStrategy::LowLatency2DeviceStrategy(DeviceContext& device)
@@ -7,4 +10,32 @@ LowLatency2DeviceStrategy::LowLatency2DeviceStrategy(DeviceContext& device)
LowLatency2DeviceStrategy::~LowLatency2DeviceStrategy() {}
+void LowLatency2DeviceStrategy::notify_create_swapchain(
+ const VkSwapchainKHR& swapchain, const VkSwapchainCreateInfoKHR& info) {
+
+ // VK_NV_low_latency2 allows a swapchain to be created with the low latency
+ // mode already on via VkSwapchainLatencyCreateInfoNV.
+ auto was_low_latency_requested = bool{false};
+ if (const auto slci = find_next<VkSwapchainLatencyCreateInfoNV>(
+ &info, VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV);
+ slci) {
+
+ was_low_latency_requested = slci->latencyModeEnable;
+ }
+
+ 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});
+}
+
+void LowLatency2DeviceStrategy::notify_destroy_swapchain(
+ const VkSwapchainKHR& swapchain) {
+
+ const auto lock = std::scoped_lock{this->mutex};
+
+ this->swapchain_monitors.erase(swapchain);
+}
+
} // namespace low_latency