GPU: clear descriptors for null constant buffers #1522

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

@⁠Calvix2k on GitHub · 2026-11-24 18:44 UTC · original
Calvix2k:codex/gpu-null-cbv-descriptor-016 → main · +34 −3 · 2 files · 1 commits · closed without merging

Summary

Fixes VIC-BT-016 from audit issue #1242.

When CreateConstantBufferView receives a null description, VIctory previously left its descriptor metadata untouched. Reusing a slot could therefore preserve the old CBV. The view model now records an explicit null CBV and mirrors it as an unbound descriptor in the host heap.

The regression coverage verifies that a previously valid CBV is replaced by the null view, and exercises the null CBV creation call on the host D3D12 device.

Verification

  • cargo test -p victory-gpu --lib --locked — 51 passed, 1 ignored
  • cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings — clean
  • cargo xtask policy --staged — passed
  • git diff --check — passed

The DirectX specification states that passing a null view description for a descriptor heap CBV results in unbound behavior: https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html

**@⁠Calvix2k** on GitHub · 2026-11-24 18:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/1522) `Calvix2k:codex/gpu-null-cbv-descriptor-016` → `main` · +34 −3 · 2 files · 1 commits · closed without merging ## Summary Fixes `VIC-BT-016` from audit issue #1242. When `CreateConstantBufferView` receives a null description, VIctory previously left its descriptor metadata untouched. Reusing a slot could therefore preserve the old CBV. The view model now records an explicit null CBV and mirrors it as an unbound descriptor in the host heap. The regression coverage verifies that a previously valid CBV is replaced by the null view, and exercises the null CBV creation call on the host D3D12 device. ## Verification - `cargo test -p victory-gpu --lib --locked` — 51 passed, 1 ignored - `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings` — clean - `cargo xtask policy --staged` — passed - `git diff --check` — passed The DirectX specification states that passing a null view description for a descriptor heap CBV results in unbound behavior: https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:35:01 +00:00
github-bot closed this pull request 2026-11-26 04:35:01 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 00:52 UTC · original

Still needed on main (4118f33): descriptor::create_cbv only records a view when the description is non-null, so reusing a descriptor slot after a null CreateConstantBufferView keeps the previous CBV instead of the unbound one the D3D spec asks for. This PR adds View::NullConstant and mirrors it as an unbound host descriptor.

Rebased on current main; the only conflict was an old impl View { is_buffer } that main has since moved into descriptor/host.rs (dropped here, the host logic is unchanged).

Verified on Windows 10, Ryzen 7 5800X / RX 7800 XT:

  • iews_survive_copies (CPU) passes;

ull_constant_buffer_view_is_accepted_by_the_device passes on the host device (the slot is cleared, device not removed);

  • cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings clean;
  • cargo xtask policy 182 files ok.
**@⁠Calvix2k** on GitHub · 2026-11-25 00:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1522#issuecomment-7148975271) Still needed on main (4118f33): descriptor::create_cbv only records a view when the description is non-null, so reusing a descriptor slot after a null CreateConstantBufferView keeps the previous CBV instead of the unbound one the D3D spec asks for. This PR adds View::NullConstant and mirrors it as an unbound host descriptor. Rebased on current main; the only conflict was an old impl View { is_buffer } that main has since moved into descriptor/host.rs (dropped here, the host logic is unchanged). Verified on Windows 10, Ryzen 7 5800X / RX 7800 XT: - iews_survive_copies (CPU) passes; - ull_constant_buffer_view_is_accepted_by_the_device passes on the host device (the slot is cleared, device not removed); - cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings clean; - cargo xtask policy 182 files ok.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 00:52 UTC · original

Re-landed as #1916 (this PR cannot be reopened after the rebase force-pushed the branch). Same commit, rebased on 4118f33.

**@⁠Calvix2k** on GitHub · 2026-11-25 00:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1522#issuecomment-7148981059) Re-landed as #1916 (this PR cannot be reopened after the rebase force-pushed the branch). Same commit, rebased on 4118f33.

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!1522
No description provided.