Skip to content

fix(vulkan): stop window rebuilds waiting on background swapchain destroys - #151

Merged
CoderDayton merged 1 commit into
mainfrom
fix/swapchain-window-rebuild
Nov 29, 2026
Merged

CoderDayton merged 1 commit into
mainfrom
fix/swapchain-window-rebuild

Conversation

@CoderDayton

Copy link
Copy Markdown
Owner

Follow-up to #148. Once a slow driver turns on background destroys, two cases still froze:

  • Destroys ran one at a time on the teardown worker, so a new swapchain on the same window waited for every queued destroy in turn. They now run concurrently (up to 8; queued work like device destroys still waits for them).
  • When Roblox rebuilds its surface on the kept device, the new swapchain had to wait for the old one's destroy to free the window. The held swapchain and its surface now stay alive and retire into the new swapchain (oldSwapchain only has to share the native window, not the surface), then get destroyed in the background, swapchain first.

Tested through a layer that makes vkDestroySwapchainKHR take 3 s, with quick resizes and F11: the current build showed a 30.5 s present gap at a surface rebuild, this branch had none over 1.1 s across 3 rebuilds. A run with Khronos validation added no swapchain or surface errors. Drivers that destroy promptly keep the old path, apart from each destroy running on its own short-lived thread. Not tested on a real slow NVIDIA driver or in game.

…troys

Slow swapchain destroys ran one at a time on the teardown worker, so a new
swapchain on the same window waited for every queued destroy (30 s with a 3 s
test driver). Destroys now run concurrently, and when Roblox rebuilds its
surface on the kept device the held swapchain and its surface stay alive and
retire into the new swapchain, so the create never waits.
@CoderDayton
CoderDayton merged commit 258cc44 into main Nov 29, 2026
6 checks passed
@CoderDayton
CoderDayton deleted the fix/swapchain-window-rebuild branch November 29, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant