aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-04-04 14:20:59 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-04-04 14:20:59 +1100
commitecaf30c5cea321c55f6a5ce827afbfc6afa0e9b1 (patch)
tree1568661c33ea4eb939e39ca3cf42bbdb2be3c2f1 /src
parenteffef8d4c4012f415c8cf869f9999232862009e2 (diff)
Lock in swapchain_monitor::update_params, fix missing CMakeList.txt modification
Diffstat (limited to 'src')
-rw-r--r--src/instance_context.cc2
-rw-r--r--src/instance_context.hh2
-rw-r--r--src/layer.cc2
-rw-r--r--src/swapchain_monitor.cc2
-rw-r--r--src/swapchain_monitor.hh4
5 files changed, 7 insertions, 5 deletions
diff --git a/src/instance_context.cc b/src/instance_context.cc
index 5a4d48a..8aeb46c 100644
--- a/src/instance_context.cc
+++ b/src/instance_context.cc
@@ -13,7 +13,7 @@ InstanceContext::InstanceContext(const LayerContext& parent_context,
InstanceContext::~InstanceContext() {
// Similar to devices, we should own the only shared ptr at this point so
// they destruct now.
- for (const auto& [device, device_context] : this->phys_devices) {
+ for (const auto& [device, device_context] : this->physical_devices) {
assert(device_context.unique());
}
}
diff --git a/src/instance_context.hh b/src/instance_context.hh
index 001cde8..2f448b4 100644
--- a/src/instance_context.hh
+++ b/src/instance_context.hh
@@ -21,7 +21,7 @@ struct InstanceContext final : public Context {
const VkuInstanceDispatchTable vtable;
std::unordered_map<void*, std::shared_ptr<PhysicalDeviceContext>>
- phys_devices;
+ physical_devices;
public:
InstanceContext(const LayerContext& parent_context,
diff --git a/src/layer.cc b/src/layer.cc
index 3811fca..e0f1fa6 100644
--- a/src/layer.cc
+++ b/src/layer.cc
@@ -102,7 +102,7 @@ DestroyInstance(VkInstance instance, const VkAllocationCallbacks* allocator) {
// Erase our physical devices owned by this instance from the global
// context.
- for (const auto& [key, _] : context->phys_devices) {
+ for (const auto& [key, _] : context->physical_devices) {
assert(layer_context.contexts.contains(key));
layer_context.contexts.erase(key);
}
diff --git a/src/swapchain_monitor.cc b/src/swapchain_monitor.cc
index 87f6205..fec0f93 100644
--- a/src/swapchain_monitor.cc
+++ b/src/swapchain_monitor.cc
@@ -19,6 +19,8 @@ void SwapchainMonitor::update_params(
const bool was_low_latency_requested,
const std::chrono::milliseconds present_delay) {
+ const auto lock = std::scoped_lock{this->mutex};
+
this->was_low_latency_requested = was_low_latency_requested;
this->present_delay = present_delay;
}
diff --git a/src/swapchain_monitor.hh b/src/swapchain_monitor.hh
index eaf4933..9192f55 100644
--- a/src/swapchain_monitor.hh
+++ b/src/swapchain_monitor.hh
@@ -12,7 +12,6 @@
#include <mutex>
#include <thread>
-#include "instance_context.hh"
#include "queue_context.hh"
namespace low_latency {
@@ -29,6 +28,8 @@ class SwapchainMonitor {
protected:
const DeviceContext& device;
+ std::mutex mutex;
+
// Configurarable params for this swapchain.
std::chrono::milliseconds present_delay = std::chrono::milliseconds{0};
bool was_low_latency_requested = false;
@@ -79,7 +80,6 @@ class ReflexSwapchainMonitor final : public SwapchainMonitor {
};
std::deque<SemaphoreSubmissions> semaphore_submissions;
- std::mutex mutex;
std::condition_variable_any cv;
std::jthread monitor_worker;