diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-04 14:20:59 +1100 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-04 14:20:59 +1100 |
| commit | ecaf30c5cea321c55f6a5ce827afbfc6afa0e9b1 (patch) | |
| tree | 1568661c33ea4eb939e39ca3cf42bbdb2be3c2f1 | |
| parent | effef8d4c4012f415c8cf869f9999232862009e2 (diff) | |
Lock in swapchain_monitor::update_params, fix missing CMakeList.txt modification
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/instance_context.cc | 2 | ||||
| -rw-r--r-- | src/instance_context.hh | 2 | ||||
| -rw-r--r-- | src/layer.cc | 2 | ||||
| -rw-r--r-- | src/swapchain_monitor.cc | 2 | ||||
| -rw-r--r-- | src/swapchain_monitor.hh | 4 |
6 files changed, 8 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a789e87..f44ba5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,13 +47,10 @@ target_compile_options(${LIBRARY_NAME} PRIVATE -Wall -Wextra - -Wno-unused-parameter - -Wno-unused-function -Wno-sign-conversion -Wno-missing-field-initializers - $<$<NOT:$<CONFIG:Debug>>:-Wno-unused-variable -Wno-unused-but-set-variable> -Wundef -Wconversion -Wdouble-promotion -)
\ No newline at end of file +) 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; |
