From ce26014c2e6a0200ea90eac8ec87881a0d55e727 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Tue, 7 Apr 2026 13:43:50 +1000 Subject: Remove dead code, upgrade env bools to const --- src/helper.hh | 6 ------ src/layer_context.cc | 15 +++++++-------- src/layer_context.hh | 6 +++--- src/strategies/low_latency2/device_strategy.cc | 3 --- 4 files changed, 10 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/helper.hh b/src/helper.hh index 6dde9be..f7c38da 100644 --- a/src/helper.hh +++ b/src/helper.hh @@ -53,12 +53,6 @@ static const T* find_link(const void* const head, return nullptr; } -template std::uint64_t extract_present_id(const T& submit) { - const auto lspi = find_next( - &submit, VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV); - return lspi ? lspi->presentID : 0; -} - } // namespace low_latency #endif \ No newline at end of file diff --git a/src/layer_context.cc b/src/layer_context.cc index 93f4a26..120d52e 100644 --- a/src/layer_context.cc +++ b/src/layer_context.cc @@ -5,16 +5,15 @@ namespace low_latency { -LayerContext::LayerContext() { - const auto parse_bool_env = [](const auto& name) -> bool { - const auto env = std::getenv(name); - return env && std::string_view{env} == "1"; - }; - - this->should_expose_reflex = parse_bool_env(EXPOSE_REFLEX_ENV); - this->should_spoof_nvidia = parse_bool_env(SPOOF_NVIDIA_ENV); +static bool parse_bool_env(const auto& name) { + const auto env = std::getenv(name); + return env && std::string_view{env} == "1"; } +LayerContext::LayerContext() + : should_expose_reflex(parse_bool_env(EXPOSE_REFLEX_ENV)), + should_spoof_nvidia(parse_bool_env(SPOOF_NVIDIA_ENV)) {} + LayerContext::~LayerContext() {} } // namespace low_latency \ No newline at end of file diff --git a/src/layer_context.hh b/src/layer_context.hh index e7b24b3..4d4444d 100644 --- a/src/layer_context.hh +++ b/src/layer_context.hh @@ -63,12 +63,12 @@ class LayerContext final : public Context { static constexpr auto NVIDIA_DEVICE_NAME = "NVIDIA GeForce RTX 5090"; public: + const bool should_expose_reflex = false; + const bool should_spoof_nvidia = false; + std::shared_mutex mutex; std::unordered_map> contexts; - bool should_expose_reflex = false; - bool should_spoof_nvidia = false; - public: LayerContext(); virtual ~LayerContext(); diff --git a/src/strategies/low_latency2/device_strategy.cc b/src/strategies/low_latency2/device_strategy.cc index 08002a9..32ff981 100644 --- a/src/strategies/low_latency2/device_strategy.cc +++ b/src/strategies/low_latency2/device_strategy.cc @@ -97,9 +97,6 @@ void LowLatency2DeviceStrategy::submit_swapchain_present_id( }(); const auto lock = std::scoped_lock{this->mutex}; - - // Fail hard here, the swapchain must exist or something has gone wrong with - // Vulkan bookkeeping. const auto iter = this->swapchain_monitors.find(swapchain); if (iter == std::end(this->swapchain_monitors)) { return; -- cgit v1.2.3