From 733955de0ae90de26fe98854a1debd6b80ccc27a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 11 Mar 2026 10:32:26 +1100 Subject: Add LOW_LATENCY_LAYER_SLEEP_AFTER_PRESENT env as an explicit AL1 toggle --- src/layer_context.hh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/layer_context.hh') diff --git a/src/layer_context.hh b/src/layer_context.hh index 44857d4..c98768b 100644 --- a/src/layer_context.hh +++ b/src/layer_context.hh @@ -13,17 +13,15 @@ // The purpose of this file is to provide a definition for the highest level // entry point struct of our vulkan state. -// -// All Context structs have deleted copy/move constructors. This is because we -// want to be extremely explicit with how/when we delete things, and this allows -// us to use destructors for cleanup without much worry about weird copies -// floating around. Most contexts will probably live inside std::unique_ptr's as -// a result so they can be used in standard containers. namespace low_latency { // All these templates do is make it so we can go from some DispatchableType -// to their respective context's with nice syntax. +// to their respective context's with nice syntax. This lets us write something +// like this for all DispatchableTypes: +// +// const auto device_context = get_context(some_vk_device); +// ^ It was automatically deduced as DeviceContext, wow! template concept DispatchableType = @@ -49,10 +47,18 @@ template using dispatch_context_t = typename context_for_t::context; struct LayerContext final : public Context { + private: + // If this is not null and set to exactly "1", then we should sleep after + // present. + static constexpr auto SLEEP_AFTER_PRESENT_ENV = + "LOW_LATENCY_LAYER_SLEEP_AFTER_PRESENT"; + public: std::mutex mutex; std::unordered_map> contexts; + bool is_antilag_1_enabled = false; + public: LayerContext(); virtual ~LayerContext(); -- cgit v1.2.3