Descriptors: a null constant buffer view description writes a null view (port of Marvisak#2449) #646

Manually merged
github merged 1 commit from github-bot/gh-646 into main 2026-11-29 08:22:28 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 02:39 UTC · original
kibagami-nc:fix/null-cbv-clears-the-slot → main · +27 −4 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

The problem

When the title passes a null description, create_cbv (crates/victory-gpu/src/descriptor.rs) leaves the slot as it was. The view written there before stays live, and its host slot keeps showing it.

D3D12's CreateConstantBufferView with a null pDesc writes a null view. A title that clears a slot this way and later reads it through an index gets the old buffer.

The change

A null description records View::Constant(0, 0). The host already makes such a view as a null view:

  • shadow::find(0, 0) finds no host copy, so make_twinned gives None;
  • make_at and the mirror then write null_for (a null buffer view).

This is a port of makmatvey's fix (Marvisak/VIctory#2449, VIC-BT-016 in Marvisak/VIctory#1242), adapted to this tree.

Tests

  • New descriptor::tests::a_null_cbv_clears_the_view_there_before. It covers a null CBV after a CBV and after an SRV in the same slot. Before the change it fails, because the old Constant(0x1_0000_1000, 256) is still read.
  • descriptor::tests: 13 passed.
  • cargo test -p victory-gpu --locked --lib: 442 passed. The 2 failures were the indirect tests that then failed on main; main has fixed them since (9b712a6).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: nothing in descriptor.rs. It still stops on the dead-code lints main has.

Checked by others

Machad3x (Windows 11, RTX 3080 Ti 12 GB, Ryzen 7 5700X) ran this with three other changes on their NVIDIA base: Series X, the title's ray tracing on, 240 s.

  • Frame time: 66.8 ms on average over the last 120 s (max 85), against 75.2 (max 100) before. Most of that gain comes from another change in the batch.
  • Errors: no draw dropped, no shader or pipeline refused, still running at 240 s.
  • Picture: the same as before.

No game files, dumps or extracted data are included.

**@⁠kibagami-nc** on GitHub · 2026-11-28 02:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/646) `kibagami-nc:fix/null-cbv-clears-the-slot` → `main` · +27 −4 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC ## The problem When the title passes a null description, `create_cbv` (`crates/victory-gpu/src/descriptor.rs`) leaves the slot as it was. The view written there before stays live, and its host slot keeps showing it. D3D12's `CreateConstantBufferView` with a null `pDesc` writes a null view. A title that clears a slot this way and later reads it through an index gets the old buffer. ## The change A null description records `View::Constant(0, 0)`. The host already makes such a view as a null view: - `shadow::find(0, 0)` finds no host copy, so `make_twinned` gives `None`; - `make_at` and the mirror then write `null_for` (a null buffer view). This is a port of makmatvey's fix ([Marvisak/VIctory#2449](https://github.com/Marvisak/VIctory/pull/2449), VIC-BT-016 in Marvisak/VIctory#1242), adapted to this tree. ## Tests - New `descriptor::tests::a_null_cbv_clears_the_view_there_before`. It covers a null CBV after a CBV and after an SRV in the same slot. Before the change it fails, because the old `Constant(0x1_0000_1000, 256)` is still read. - `descriptor::tests`: 13 passed. - `cargo test -p victory-gpu --locked --lib`: 442 passed. The 2 failures were the indirect tests that then failed on `main`; `main` has fixed them since (9b712a6). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: nothing in `descriptor.rs`. It still stops on the dead-code lints `main` has. ## Checked by others **Machad3x** (Windows 11, RTX 3080 Ti 12 GB, Ryzen 7 5700X) ran this with three other changes on their NVIDIA base: Series X, the title's ray tracing on, 240 s. - **Frame time:** 66.8 ms on average over the last 120 s (max 85), against 75.2 (max 100) before. Most of that gain comes from another change in the batch. - **Errors:** no draw dropped, no shader or pipeline refused, still running at 240 s. - **Picture:** the same as before. No game files, dumps or extracted data are included.
create_cbv left the slot as it was when the title passed a null
description, so the view written there before stayed live and its host
slot went on showing it. D3D12's CreateConstantBufferView with a null
pDesc writes a null view. The slot now records View::Constant(0, 0),
which the host makes as a null view (the shadow lookup of address 0 finds
nothing, and make_at and the mirror then write null_for).

Port of makmatvey's fix (Marvisak/VIctory#2449, VIC-BT-016 in
Marvisak/VIctory#1242). Test: a_null_cbv_clears_the_view_there_before
(after a CBV and after an SRV). It fails before the change: the old
Constant(0x1_0000_1000, 256) is still read.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:42:16 +00:00
Author
Owner

@⁠Machad3x on GitHub · 2026-11-28 03:20 UTC · original

Tested on Windows 11, RTX 3080 Ti 12 GB, Ryzen 7 5700X, Series X profile, title ray tracing on, 240 s run (cherry-picked onto our NVIDIA base with three other changes).

  • Average of the last 120 s: 66.8 ms/frame (max 85), against 75.2 (max 100) on the previous base. Most of that gain comes from another change in the batch.
  • 0 draws dropped, no shader or pipeline refused, alive at 240 s.
  • The picture matches the previous base.
  • Code review found no bugs.
    Kept.
**@⁠Machad3x** on GitHub · 2026-11-28 03:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/646#issuecomment-7232993136) Tested on Windows 11, RTX 3080 Ti 12 GB, Ryzen 7 5700X, Series X profile, title ray tracing on, 240 s run (cherry-picked onto our NVIDIA base with three other changes). - Average of the last 120 s: 66.8 ms/frame (max 85), against 75.2 (max 100) on the previous base. Most of that gain comes from another change in the batch. - 0 draws dropped, no shader or pipeline refused, alive at 240 s. - The picture matches the previous base. - Code review found no bugs. Kept.
github manually merged commit 8d2d77c445 into main 2026-11-29 08:22:28 +00:00
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/trustno1-coder--VIctory-NVIDIA!646
No description provided.