aboutsummaryrefslogtreecommitdiff
path: root/src/queue_context.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/queue_context.cc')
-rw-r--r--src/queue_context.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/queue_context.cc b/src/queue_context.cc
index 635b593..fce501b 100644
--- a/src/queue_context.cc
+++ b/src/queue_context.cc
@@ -1,6 +1,9 @@
#include "queue_context.hh"
#include "device_context.hh"
#include "helper.hh"
+#include "layer_context.hh"
+#include "strategies/anti_lag/queue_strategy.hh"
+#include "strategies/low_latency2/queue_strategy.hh"
#include "timestamp_pool.hh"
#include <span>
@@ -36,16 +39,22 @@ QueueContext::QueueContext(DeviceContext& device, const VkQueue& queue,
: device(device), queue(queue), queue_family_index(queue_family_index),
command_pool(std::make_unique<CommandPoolOwner>(*this)) {
- // Only construct a timestamp pool if we support it!
- if (device.physical_device.supports_required_extensions) {
- this->timestamp_pool = std::make_unique<TimestampPool>(*this);
+ // Only construct things if we actually support our operations.
+ if (!device.physical_device.supports_required_extensions) {
+ return;
}
-}
-QueueContext::~QueueContext() {
- this->timestamp_pool.reset();
+ this->timestamp_pool = std::make_unique<TimestampPool>(*this);
+ this->strategy = [&]() -> std::unique_ptr<QueueStrategy> {
+ if (device.instance.layer.should_expose_reflex) {
+ return std::make_unique<LowLatency2QueueStrategy>(*this);
+ }
+ return std::make_unique<AntiLagQueueStrategy>(*this);
+ }();
}
+QueueContext::~QueueContext() { this->timestamp_pool.reset(); }
+
bool QueueContext::should_inject_timestamps() const {
const auto& physical_device = this->device.physical_device;