mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 20:15:56 +00:00
Call vkLatencySleepNV under the present lock
The swapchain must be externally synchronised, and the acquire and the present use it under g_pl on the present
thread while the game thread calls vk_reflex_sleep. With reflex = boost and TOTK_VK_VALIDATION=1 the validation layer
reported 20 threading errors in 30 s (vkLatencySleepNV against vkAcquireNextImageKHR and vkQueuePresentKHR). The
earlier head of #638 (318acd8) took the lock here; the rebase onto dev lost it. The semaphore wait stays outside.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c811d0e06d
commit
41623cec85
1 file changed
+7
-1
@@ -347,7 +347,13 @@ void vk_reflex_sleep(void) {
|
||||
.signalSemaphore = g_reflex_sem,
|
||||
.value = val
|
||||
};
|
||||
if (g_reflex_sleep(c->device, g_sc, &si) == VK_SUCCESS) {
|
||||
// vkLatencySleepNV uses the swapchain, which Vulkan wants externally synchronised with the acquire and the present
|
||||
// (they run under g_pl on the present thread). The wait for the semaphore stays outside the lock.
|
||||
VkResult r = VK_ERROR_INITIALIZATION_FAILED;
|
||||
plat_rmutex_lock(&g_pl);
|
||||
if (g_sc) r = g_reflex_sleep(c->device, g_sc, &si);
|
||||
plat_rmutex_unlock(&g_pl);
|
||||
if (r == VK_SUCCESS) {
|
||||
VkSemaphoreWaitInfo wi = {
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
|
||||
.semaphoreCount = 1,
|
||||
|
||||
Reference in new issue
Block a user