diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-04-06 17:03:35 +1000 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-04-06 17:03:35 +1000 |
| commit | 312d8736ae0df55c9f33e4eb5c00e4cd77e1c33f (patch) | |
| tree | 170816e372c43ddc6522e059f7d6fdc8757330f2 /src/layer.cc | |
| parent | a9a083ea5c649498d2f12e611dbc7c767d152130 (diff) | |
Add refactored VK_NV_low_latency2 impl, (fixes many threading issues)
Diffstat (limited to 'src/layer.cc')
| -rw-r--r-- | src/layer.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/layer.cc b/src/layer.cc index 335ebf3..471d2fb 100644 --- a/src/layer.cc +++ b/src/layer.cc @@ -21,6 +21,8 @@ #include "layer_context.hh" #include "queue_context.hh" #include "strategies/anti_lag/device_strategy.hh" +#include "strategies/low_latency2/device_strategy.hh" +#include "strategies/low_latency2/queue_strategy.hh" #include "timestamp_pool.hh" namespace low_latency { @@ -775,8 +777,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR( return result; } - assert(pCreateInfo); - context->strategy->notify_create_swapchain(*pSwapchain, *pCreateInfo); + if (context->was_capability_requested) { + assert(pCreateInfo); + context->strategy->notify_create_swapchain(*pSwapchain, *pCreateInfo); + } return VK_SUCCESS; } @@ -788,7 +792,9 @@ DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, context->vtable.DestroySwapchainKHR(device, swapchain, pAllocator); - context->strategy->notify_destroy_swapchain(swapchain); + if (context->was_capability_requested) { + context->strategy->notify_destroy_swapchain(swapchain); + } } static VKAPI_ATTR void VKAPI_CALL @@ -809,6 +815,12 @@ VkResult LatencySleepNV(VkDevice device, const auto context = layer_context.get_context(device); assert(pSleepInfo); + // call device strategy notify semaphore, no problem :) + const auto strategy = + dynamic_cast<LowLatency2DeviceStrategy*>(context->strategy.get()); + assert(strategy); + strategy->notify_latency_sleep_nv(swapchain, *pSleepInfo); + return VK_SUCCESS; } @@ -817,9 +829,12 @@ void QueueNotifyOutOfBandNV( [[maybe_unused]] const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo) { // Kind of interesting how you can't turn it back on once it's turned off. - // Also I really have no idea why pQueueTypeInfo's VkOutOfBandQueueTypeNV - // enum even exists (I guess we will find out later when nothing works). const auto context = layer_context.get_context(queue); + + const auto strategy = + dynamic_cast<LowLatency2QueueStrategy*>(context->strategy.get()); + assert(strategy); + strategy->notify_out_of_band(); } VkResult SetLatencySleepModeNV( @@ -827,6 +842,12 @@ VkResult SetLatencySleepModeNV( [[maybe_unused]] const VkLatencySleepModeInfoNV* pSleepModeInfo) { const auto context = layer_context.get_context(device); + const auto strategy = + dynamic_cast<LowLatency2DeviceStrategy*>(context->strategy.get()); + assert(strategy); + + strategy->notify_latency_sleep_mode(swapchain, pSleepModeInfo); + return VK_SUCCESS; } |
