Viewer: no crash on a character-to-animal switch or after a GPU device loss #390

Manually merged
github merged 2 commits from gh-pr/390/head into gh-pr/390/base 2026-11-26 20:32:46 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 18:27 UTC · original
holdmysocks:viewer-crash-fixes → master · +91 −3 · 3 files · 2 commits · merged 2026-11-26 18:36 UTC

Fixes two viewer crashes: SIX-235 and SIX-234.

SIX-235: switching from a character to an animal overran the joints buffer (3 of 3 switches)

  • Right after the switch, the animal's fur rig is already set, but the character's hair models are still loaded. Their joints buffers hold one matrix each, and they were sent the deer's 129 skin matrices.
  • The fur loop now passes the skin only to models built for this skeleton.
  • set_joints also skips any model whose joints buffer is too small (joints_fit, unit-tested).
  • In a running viewer: 3 of 3 switches went through without a crash, and the deer showed with its fur.

SIX-234: frame-timer read-back after the buffer was destroyed

  • The viewer never destroys buffers itself. wgpu destroys every buffer when the GPU device is lost (driver reset, or out of memory), so the next unmap failed validation and the default handler panicked.
  • I could not reproduce it in 14 runs with the GPU otherwise idle, which points to memory pressure from other GPU work at the time.
  • The viewer now logs why the device was lost and logs the first error after it instead of panicking.
  • A red line at the top of the window asks the user to restart. Errors while the device still works panic as before.
  • The handler is unit-tested.

cargo test --locked -p sixng-core -p sixng-gui: 322 + 53 passed.

**@⁠holdmysocks** on GitHub · 2026-11-26 18:27 UTC · [original](https://github.com/holdmysocks/SixNG/pull/390) `holdmysocks:viewer-crash-fixes` → `master` · +91 −3 · 3 files · 2 commits · merged 2026-11-26 18:36 UTC Fixes two viewer crashes: SIX-235 and SIX-234. **SIX-235: switching from a character to an animal overran the joints buffer (3 of 3 switches)** - Right after the switch, the animal's fur rig is already set, but the character's hair models are still loaded. Their joints buffers hold one matrix each, and they were sent the deer's 129 skin matrices. - The fur loop now passes the skin only to models built for this skeleton. - `set_joints` also skips any model whose joints buffer is too small (`joints_fit`, unit-tested). - In a running viewer: 3 of 3 switches went through without a crash, and the deer showed with its fur. **SIX-234: frame-timer read-back after the buffer was destroyed** - The viewer never destroys buffers itself. wgpu destroys every buffer when the GPU device is lost (driver reset, or out of memory), so the next unmap failed validation and the default handler panicked. - I could not reproduce it in 14 runs with the GPU otherwise idle, which points to memory pressure from other GPU work at the time. - The viewer now logs why the device was lost and logs the first error after it instead of panicking. - A red line at the top of the window asks the user to restart. Errors while the device still works panic as before. - The handler is unit-tested. `cargo test --locked -p sixng-core -p sixng-gui`: 322 + 53 passed.
- set_joints skips a model whose joints buffer is too small for the
  skin (joints_fit), and the fur loop only passes the skin to models
  built for this skeleton: right after a switch from a character, the
  character's hair is still loaded while the animal's fur rig is set,
  and its one-matrix buffers took the animal's 129 matrices (SIX-235).
- On a device loss wgpu destroys every buffer, so the next frame-timer
  unmap failed validation and the default handler panicked (SIX-234).
  The viewer now logs why the device was lost, logs the first error
  after it instead of panicking, and asks for a restart in a red line
  at the top of the window. Errors while the device works still panic.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:32:45 +00:00
github manually merged commit 2b8f2d71bc into gh-pr/390/base 2026-11-26 20:32:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.