GPU descriptor: write null CBV when create_cbv description is null #1574

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

@⁠geiyiliyabumo on GitHub · 2026-11-24 19:22 UTC · original
geiyiliyabumo:fix/gpu-cbv-null-desc → main · +55 −12 · 2 files · 1 commits · closed without merging

Summary

Fixes create_cbv silently ignoring a null D3D12_CONSTANT_BUFFER_VIEW_DESC pointer instead of overwriting the destination descriptor slot with a null CBV (tracking issue #1242, VIC-BT-016).

Per the D3D12 specification, ID3D12Device::CreateConstantBufferView(NULL, DestDescriptor) creates a null CBV descriptor, replacing any prior view at DestDescriptor. Previously create_cbv skipped record(...) when desc was null, leaving stale CBV/SRV/UAV entries active in CPU view tracking and host descriptor heaps.

Changes

  • crates/victory-gpu/src/descriptor.rs: Add View::NullConstant (non-buffer) and record it in create_cbv when desc is null, overwriting any prior view at handle. Add synthetic unit test null_cbv_overwrites_an_existing_view.
  • crates/victory-gpu/src/descriptor/host.rs: Handle View::NullConstant in make and null_for via null_cbv (CreateConstantBufferView(None, at)), clearing any previously retained host resource in that slot. Add live D3D12/WARP regression test null_cbv_is_mirrored_without_a_buffer.

Verification

  • cargo test -p victory-gpu --lib descriptor: 9/9 passed on AMD Radeon RX 9060 XT (RDNA4) and WARP (--features diagnostics).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default & --all-features): clean.
  • cargo xtask policy: 154 files OK.

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 19:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1574) `geiyiliyabumo:fix/gpu-cbv-null-desc` → `main` · +55 −12 · 2 files · 1 commits · closed without merging ## Summary Fixes `create_cbv` silently ignoring a null `D3D12_CONSTANT_BUFFER_VIEW_DESC` pointer instead of overwriting the destination descriptor slot with a null CBV (tracking issue #1242, `VIC-BT-016`). Per the D3D12 specification, `ID3D12Device::CreateConstantBufferView(NULL, DestDescriptor)` creates a null CBV descriptor, replacing any prior view at `DestDescriptor`. Previously `create_cbv` skipped `record(...)` when `desc` was null, leaving stale CBV/SRV/UAV entries active in CPU view tracking and host descriptor heaps. ### Changes - `crates/victory-gpu/src/descriptor.rs`: Add `View::NullConstant` (non-buffer) and record it in `create_cbv` when `desc` is null, overwriting any prior view at `handle`. Add synthetic unit test `null_cbv_overwrites_an_existing_view`. - `crates/victory-gpu/src/descriptor/host.rs`: Handle `View::NullConstant` in `make` and `null_for` via `null_cbv` (`CreateConstantBufferView(None, at)`), clearing any previously retained host resource in that slot. Add live D3D12/WARP regression test `null_cbv_is_mirrored_without_a_buffer`. ### Verification - `cargo test -p victory-gpu --lib descriptor`: **9/9 passed** on **AMD Radeon RX 9060 XT (RDNA4)** and **WARP** (`--features diagnostics`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`): clean. - `cargo xtask policy`: 154 files OK. *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:36:51 +00:00
github-bot closed this pull request 2026-11-26 04:36:51 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:42 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1298. Same null-CBV-description fix as the smaller #1298, built on a host null CBV (CreateConstantBufferView) that no longer matches main, where constant buffers are raw views.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1574#issuecomment-7148797151) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1298. Same null-CBV-description fix as the smaller #1298, built on a host null CBV (CreateConstantBufferView) that no longer matches main, where constant buffers are raw views. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

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