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

Merged
kibagami-nc merged 1 commit from upstream-pr/646 into main 2026-11-29 08:16:59 +00:00
kibagami-nc commented 2026-11-28 02:39:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T02:39:26Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5535885298 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/646). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T02:39:26Z. --- ## 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.
Machad3x commented 2026-11-28 03:20:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Machad3x on 2026-11-28T03:20:23Z.


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.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7232993136 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/646#issuecomment-7232993136). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-28T03:20:23Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!646
No description provided.