fix(victory-gpu): clear stale constant buffer views on null descriptions #305
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/305"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T01:55:15Z.
Change
Passing a null description to
CreateConstantBufferViewleft the previous descriptor in its slot in the Neptune runtime. A shader could still read the old constants, and copying the descriptor copied the stale binding.Record a null CBV in
create_cbvso regular descriptor copies and heap mirroring see the replacement. Make zero-sized CBVs use the existing typed null descriptor in both the mirrored heap and the dynamic draw table, avoiding a shadow allocation and a constant upload. This is thevictory-gpupath used bytools/lancer_victory.ps1.Ported from Marvisak/VIctory
78ed12ebby Matsvey Makushenka, credited inTHIRD_PARTY.mdand in the commit. The DirectX resource binding specification defines the behavior of a null CBV description.Verification
Base
c4c93bdc413191a9dc909998d2d53080a3f0c880. Fix3445b080a9260af590e045c0e63bb8d7cfac3097. Windows x64, Rust 1.98.1 MSVC, RTX 5070 Ti (driver 621.40) and WARP (Microsoft Basic Render Driver).With the new descriptor regression test applied to base,
a_null_cbv_overwrites_a_bound_slot_and_can_be_copiedfailed because the oldConstant(0x1_0000_1000, 256)remained in the source slot. Both new tests pass with the fix on NVIDIA and withVICTORY_D3D12_WARP=1. The same tests pass on NVIDIA withVICTORY_VIEW_INLINE=0.third_party/victorycargo test --locked --offline -p victory-gpu --lib --features diagnostics a_null_cbv -- --test-threads=1cargo test --locked --offline -p victory-gpu --lib --features diagnostics -- --test-threads=1cargo test --locked --offline -p victory-loader --test load_probecargo build --locked --offline --release -p victorycargo xtask policyThe three existing GPU suite failures are
spans_say_the_next_start_and_the_lowest_level_viewed,warp_card_fetch_copies_flagged_pieces_to_their_slots, andwarp_card_patch_writes_the_masked_bytes_and_no_others.From the repository root,
python -m pytest -rsreturned 1,342 passed and 323 skipped. The local checkout lacks the built C++ runtime, GPU runner and TomBox/Rust artifacts used by those tests.python -m ruff check --select W605,F,E9 PrototypeScarlett tests toolspassed.Oracle and test data
The failure case writes a known CBV, replaces it with a null description and copies the slot. A separate synthetic D3D12 probe ran a compute shader that read the mirrored descriptor and stored one word in a readback buffer. The native control overwrote the same D3D12 descriptor with
CreateConstantBufferView(None, slot).0x13579bdf0x13579bdf0x13579bdf0x000000000x000000000x00000000Both readback cases executed on both adapters. All data and shaders were generated in the tests. No game, console or SDK files were used.
Prepared with AI assistance (OpenAI Codex).
Rebase verification
Rebased on
c41c224and merged the source credit into the currentTHIRD_PARTY.mdtable.cargo test --locked --offline -j 4 -p victory-gpu null_cbv -- --test-threads=1passed both CBV tests.Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-26T14:01:33Z.
This PR now conflicts with main in
THIRD_PARTY.md(the sources table moved after the recent merges, including #351). Please rebase on main (git fetch origin && git rebase origin/main), keep both sides of the table rows, and force-push your branch; CI must then pass again before review.🤖 Generated with Claude Code
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T18:25:10Z.
Rebased and pushed. I added the null-CBV attribution to the current
THIRD_PARTY.mdtable alongside the credits on main.Both focused tests passed. A null CBV clears an already-bound slot and can be copied, and the host descriptor can be created without a backing buffer.
The latest CI run passed.
Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-27T17:01:55Z.
Updated this PR to
a4453083and kept the source credits added on both sides of the conflict. Both null-CBV regressions passed locally.