aboutsummaryrefslogtreecommitdiff
path: root/src/layer_context.hh
diff options
context:
space:
mode:
authorNicolas James <nj3ahxac@gmail.com>2026-03-11 10:32:26 +1100
committerNicolas James <nj3ahxac@gmail.com>2026-03-11 10:32:26 +1100
commit733955de0ae90de26fe98854a1debd6b80ccc27a (patch)
tree6424a26bb8f5434d1ad6952f16ba6a79b3b5991f /src/layer_context.hh
parentf10074d9897850b9b746ff8d8e0b2dc4af24f3ff (diff)
Add LOW_LATENCY_LAYER_SLEEP_AFTER_PRESENT env as an explicit AL1 toggle
Diffstat (limited to 'src/layer_context.hh')
-rw-r--r--src/layer_context.hh20
1 files changed, 13 insertions, 7 deletions
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 <typename T>
concept DispatchableType =
@@ -49,10 +47,18 @@ template <DispatchableType D>
using dispatch_context_t = typename context_for_t<D>::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<void*, std::shared_ptr<Context>> contexts;
+ bool is_antilag_1_enabled = false;
+
public:
LayerContext();
virtual ~LayerContext();