GPU: buffer views of no elements are left null #987

Closed
github-bot wants to merge 1 commit from gh-pr/987/head into gh-pr/987/base
Owner

@⁠ghost on GitHub · 2026-11-24 14:41 UTC · original
fix/zero-element-buffer-views → main · +49 −0 · 1 files · 1 commits · closed without merging

What

buffer_srv and buffer_uav return no view when the title asks for a buffer view with NumElements == 0, so the caller makes the null view it already makes for views that cannot be made.

Why

The title makes zero-element buffer views for buffers it has not sized yet. CreateShaderResourceView and CreateUnorderedAccessView with no elements are invalid calls on the host, and the device is removed for them. I hit this as a device removal in the world on an NVIDIA GPU.

Test

buffer_views_of_no_elements_are_left_null registers a title buffer, asks for a zero-element SRV and UAV of it, and checks that both are refused and the device is still alive.

  • On unmodified main (with the two is_none assertions relaxed) the final GetDeviceRemovedReason assertion fails: the device is removed.
  • With the guards: cargo test -p victory-gpu --lib gives 51 passed, 0 failed, 1 ignored.

No game-derived content is included.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TydV9AGmPCiUTkG8rHubBQ

**@⁠ghost** on GitHub · 2026-11-24 14:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/987) `fix/zero-element-buffer-views` → `main` · +49 −0 · 1 files · 1 commits · closed without merging ## What `buffer_srv` and `buffer_uav` return no view when the title asks for a buffer view with `NumElements == 0`, so the caller makes the null view it already makes for views that cannot be made. ## Why The title makes zero-element buffer views for buffers it has not sized yet. `CreateShaderResourceView` and `CreateUnorderedAccessView` with no elements are invalid calls on the host, and the device is removed for them. I hit this as a device removal in the world on an NVIDIA GPU. ## Test `buffer_views_of_no_elements_are_left_null` registers a title buffer, asks for a zero-element SRV and UAV of it, and checks that both are refused and the device is still alive. - On unmodified `main` (with the two `is_none` assertions relaxed) the final `GetDeviceRemovedReason` assertion fails: the device is removed. - With the guards: `cargo test -p victory-gpu --lib` gives 51 passed, 0 failed, 1 ignored. No game-derived content is included. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01TydV9AGmPCiUTkG8rHubBQ
The title makes buffer views with NumElements 0 for buffers it has not
sized yet. CreateShaderResourceView and CreateUnorderedAccessView with no
elements are invalid calls on the host, and the device is removed for
them (seen on an NVIDIA GPU in the world, and in the new test
on the real device before this change).

buffer_srv and buffer_uav now return None for such views, so the caller
makes the null view it already makes for views that cannot be made.

Test: buffer_views_of_no_elements_are_left_null registers a title buffer,
asks for a zero-element SRV and UAV of it, and checks both are refused
and the device is still alive. Without the guards the device is removed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TydV9AGmPCiUTkG8rHubBQ
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:16:00 +00:00
github-bot closed this pull request 2026-11-26 04:16:00 +00:00
Author
Owner

@⁠claude-GTA6 on GitHub · 2026-11-24 14:46 UTC · original

From a tester working with Claude (AI-assisted); measured on my own machine.

For the maintainers: this is the same check as #635 (66e9038). #635 also carries a hardware test from @⁠Vaximous (cfe7610b), which fails without the check and passes with it on an RTX 5090. On my machine the check turned a device removal on continuing from a save into the saved world loading. Either PR is fine by me; this note is only so the two aren't reviewed separately.

**@⁠claude-GTA6** on GitHub · 2026-11-24 14:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/987#issuecomment-7134915414) *From a tester working with Claude (AI-assisted); measured on my own machine.* For the maintainers: this is the same check as #635 (`66e9038`). #635 also carries a hardware test from @⁠Vaximous (`cfe7610b`), which fails without the check and passes with it on an RTX 5090. On my machine the check turned a device removal on continuing from a save into the saved world loading. Either PR is fine by me; this note is only so the two aren't reviewed separately.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 14:54 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 4407092: cargo test -p victory-gpu passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) was green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 14:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/987#issuecomment-7135155728) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 4407092: `cargo test -p victory-gpu` passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) was green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠ghost on GitHub · 2026-11-24 15:01 UTC · original

Closing in favour of #635, which has the same zero-element checks plus the past-the-end cases, and a hardware test. Thanks for pointing it out.

**@⁠ghost** on GitHub · 2026-11-24 15:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/987#issuecomment-7135346417) Closing in favour of #635, which has the same zero-element checks plus the past-the-end cases, and a hardware test. Thanks for pointing it out.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!987
No description provided.