Skip to content

fix(vulkan): keep one host surface per window across game joins - #159

Merged
CoderDayton merged 2 commits into
mainfrom
fix/one-window-surface
Dec 2, 2026
Merged

CoderDayton merged 2 commits into
mainfrom
fix/one-window-surface

Conversation

@CoderDayton

Copy link
Copy Markdown
Owner

Two join fixes.

Crash on join (0.5.6 regression). Roblox makes a new VkSurfaceKHR for the window on every join. Since the swapchain reuse in #156 kept the old one alive, a join where the window changed size retired the swapchain into the second surface, and NVIDIA's Wayland driver crashed on the next present (libnvidia-glcore+0xcff99c, reported on Discord on an RTX 4060 with mango). Nightcap now keeps one host surface per window: later creates get it back, the game's destroys keep it, and it goes with its instance. Approach suggested by the reporter.

Resize during a join bounced to the home screen. While StartGame runs, Roblox is already in the game stage, but Nightcap still sent surface changes to the LuaApp, which restarted it and abandoned the join. The surface is now held until the launch finishes and then given to the game. This one predates the fork.

Tested on an RTX 4090 (620.73.04):

  • Reproduced the crash on 0.5.6 by resizing during a join; it doesn't crash with this branch.
  • 8 joins with constant resizing on Wayland and on X11: one host surface the whole session (about 300 surface recreates on X11), memory flat.
  • 4 rounds of join, play, leave to the home screen on each of Wayland and X11, all joining a real server.
  • New unit tests for the shared surface and the resize during launch; full suite passes.

Not tested on the reporter's setup.

Roblox makes a new VkSurfaceKHR for the window on every join. Since the swapchain reuse in 0.5.6 kept the old one alive, NVIDIA's Wayland driver crashed on present once a swapchain moved to the second surface.
…creen

While StartGame runs, Roblox is already in the game stage, so a LuaApp surface update restarted the home screen and abandoned the join. The surface is now held until the launch finishes and then given to the game.
@CoderDayton
CoderDayton merged commit d831bcd into main Dec 2, 2026
6 checks passed
@CoderDayton
CoderDayton deleted the fix/one-window-surface branch December 2, 2026 13:05
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