vulkan vkQueue dispute fix

This commit is contained in:
xbzk 2026-02-07 21:20:08 -03:00
parent a72f444753
commit 1ffa381d74
2 changed files with 7 additions and 0 deletions

View file

@ -177,6 +177,10 @@ try
RendererVulkan::~RendererVulkan() {
scheduler.RegisterOnSubmit([] {});
scheduler.WaitWorker();
// vkDeviceWaitIdle MUST be called only after all queue submissions are complete
// to avoid threading errors on VkQueue simultaneous access
std::scoped_lock lock{scheduler.submit_mutex};
void(device.GetLogical().WaitIdle());
}

View file

@ -30,6 +30,9 @@ BlitScreen::~BlitScreen() = default;
void BlitScreen::WaitIdle() {
present_manager.WaitPresent();
scheduler.Finish();
std::scoped_lock lock{scheduler.submit_mutex};
// vkDeviceWaitIdle MUST be protected by submit_mutex to prevent racing with queue submissions
// from the worker thread. This ensures no simultaneous access to VkQueue.
device.GetLogical().WaitIdle();
}