From 7810f837b3cfa7dc45f360282cd1cafb2c3e6ca6 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Tue, 24 Mar 2026 15:33:51 +1100 Subject: Resolve hang via hack, WIP --- src/layer.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/layer.cc') diff --git a/src/layer.cc b/src/layer.cc index 9344114..77ce296 100644 --- a/src/layer.cc +++ b/src/layer.cc @@ -294,6 +294,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice( DEVICE_VTABLE_LOAD(QueueSubmit2KHR); DEVICE_VTABLE_LOAD(GetCalibratedTimestampsKHR); DEVICE_VTABLE_LOAD(ResetQueryPoolEXT); + DEVICE_VTABLE_LOAD(SignalSemaphore); #undef DEVICE_VTABLE_LOAD const auto key = layer_context.get_key(*pDevice); @@ -749,6 +750,30 @@ void GetLatencyTimingsNV(VkDevice device, VkSwapchainKHR swapchain, VkResult LatencySleepNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepInfoNV* pSleepInfo) { + + const auto context = layer_context.get_context(device); + assert(pSleepInfo); + + // Keep going. + if (pSleepInfo->signalSemaphore) { + + // This is a hack obviously. I will have to associate queue submits with + // a semaphore and signal it correctly later. I'm not sure about the + // implications regarding multithreading, will have to think a bit about how to do this cleanly + // with our current anti lag. + static std::uint32_t counter = 1024; + + const auto ssi = VkSemaphoreSignalInfo{ + .sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, + .semaphore = pSleepInfo->signalSemaphore, + .value = counter, + }; + + // So we don't wait and this becomes a no-op instead of a freeze! + context->vtable.SignalSemaphore(device, &ssi); + + ++counter; + } // STUB return VK_SUCCESS; } @@ -766,6 +791,9 @@ void SetLatencyMarkerNV(VkDevice device, VkSwapchainKHR swapchain, VkResult SetLatencySleepModeNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepModeInfoNV* pSleepModeInfo) { + const auto context = layer_context.get_context(device); + assert(pSleepModeInfo); + // STUB return VK_SUCCESS; } -- cgit v1.2.3