fix(victory-gpu): bind zero fallback for missing root CBVs/SRVs and drop draws missing stride tables #458

Closed
Lewandox wants to merge 2 commits from upstream-pr/458 into main
Lewandox commented 2026-11-26 23:45:02 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-26T23:45:02Z.


Summary

Fixes three cases in draw::State::bind where a root descriptor declared in the compiled D3D12 root signature could be left unbound (uninitialized after Set*RootSignature, or retaining a previous draw's stale GPU virtual address), causing undefined behavior / GPU page faults (DXGI_ERROR_DEVICE_REMOVED) on NVIDIA:

  1. SLOT_STRIDES & SLOT_TABLE_STRIDES without a bound view heap (draw.rs): previously logged once and continued, letting the draw/dispatch record with the stride table root SRV unbound. Now returns false to drop the draw, matching SLOT_MEMORY.
  2. Unset root CBVs / direct root SRVs (draw.rs): when tabled == false (always true for root CBVs, and for root SRVs under VICTORY_ROOT_SRV_DIRECT=1), an unset root slot previously continued without binding anything. Now binds a persistent 64 KiB zero-filled fallback buffer (Host::zero_root_gpu()), matching console null-CBV zero reads without leaving a D3D12 root descriptor uninitialized.
  3. Null / unmapped root CBVs & direct root SRVs (draw.rs): when root_view(...) returns None (e.g. address == 0 or unmapped memory), binds Host::zero_root_gpu() (skipping USER_VIEW_BIAS subtraction on the fallback address) instead of continueing with an unbound slot, or drops the draw if the fallback buffer is unavailable.

Verification

  • Added draw::missing_root_views_tests::bind_drops_missing_stride_tables_and_binds_zero_fallback_for_root_cbv (emits a minimal SM 6.6 compute DXIL via victory_shader, no external dxc.exe required):
    • cargo +stable-x86_64-pc-windows-gnu test --lib -p victory-gpu missing_root_views_tests -- --nocapture --test-threads=1 -> 1 passed, 0 failed.
<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5518706971 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458). Originally posted by [Lewandox](https://github.com/Lewandox) on 2026-11-26T23:45:02Z. --- ## Summary Fixes three cases in `draw::State::bind` where a root descriptor declared in the compiled D3D12 root signature could be left unbound (uninitialized after `Set*RootSignature`, or retaining a previous draw's stale GPU virtual address), causing undefined behavior / GPU page faults (`DXGI_ERROR_DEVICE_REMOVED`) on NVIDIA: 1. **`SLOT_STRIDES` & `SLOT_TABLE_STRIDES` without a bound view heap** (`draw.rs`): previously logged once and `continue`d, letting the draw/dispatch record with the stride table root SRV unbound. Now returns `false` to drop the draw, matching `SLOT_MEMORY`. 2. **Unset root CBVs / direct root SRVs** (`draw.rs`): when `tabled == false` (always true for root CBVs, and for root SRVs under `VICTORY_ROOT_SRV_DIRECT=1`), an unset root slot previously `continue`d without binding anything. Now binds a persistent 64 KiB zero-filled fallback buffer (`Host::zero_root_gpu()`), matching console null-CBV zero reads without leaving a D3D12 root descriptor uninitialized. 3. **Null / unmapped root CBVs & direct root SRVs** (`draw.rs`): when `root_view(...)` returns `None` (e.g. `address == 0` or unmapped memory), binds `Host::zero_root_gpu()` (skipping `USER_VIEW_BIAS` subtraction on the fallback address) instead of `continue`ing with an unbound slot, or drops the draw if the fallback buffer is unavailable. ## Verification - Added `draw::missing_root_views_tests::bind_drops_missing_stride_tables_and_binds_zero_fallback_for_root_cbv` (emits a minimal SM 6.6 compute DXIL via `victory_shader`, no external `dxc.exe` required): - `cargo +stable-x86_64-pc-windows-gnu test --lib -p victory-gpu missing_root_views_tests -- --nocapture --test-threads=1` -> **1 passed, 0 failed**.
LooperSalty commented 2026-11-27 12:24:08 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T12:24:08Z.


Review: draw.rs around lines 1863 and 1892 bind a zero buffer for a missing root CBV/SRV with no log, which breaks the no-silent-fallback rule. Please add a once! warning on that path.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7218199600 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7218199600). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T12:24:08Z. --- Review: draw.rs around lines 1863 and 1892 bind a zero buffer for a missing root CBV/SRV with no log, which breaks the no-silent-fallback rule. Please add a once! warning on that path.
Lewandox commented 2026-11-27 12:40:56 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-27T12:40:56Z.


Added once! warnings on both zero-fallback root CBV/SRV bind paths (unset slot and missing host buffer, plus when the fallback buffer itself is unavailable). Re-verified draw::missing_root_views_tests locally (1 passed, 0 failed).

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7218546162 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7218546162). Originally posted by [Lewandox](https://github.com/Lewandox) on 2026-11-27T12:40:56Z. --- Added `once!` warnings on both zero-fallback root CBV/SRV bind paths (unset slot and missing host buffer, plus when the fallback buffer itself is unavailable). Re-verified `draw::missing_root_views_tests` locally (`1 passed, 0 failed`).
LooperSalty commented 2026-11-27 19:43:40 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T19:43:40Z.


Main just took 23 PRs at once (#545), and this now conflicts in third_party/victory/crates/victory-gpu/src/draw.rs. Could you rebase on current main, keep both sides, rerun draw::missing_root_views_tests and force-push? The once! warnings you added settle the earlier point.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7226811866 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7226811866). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T19:43:40Z. --- Main just took 23 PRs at once (#545), and this now conflicts in `third_party/victory/crates/victory-gpu/src/draw.rs`. Could you rebase on current main, keep both sides, rerun `draw::missing_root_views_tests` and force-push? The `once!` warnings you added settle the earlier point.
Lewandox commented 2026-11-27 21:06:03 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-27T21:06:03Z.


Rebased on current main keeping both descriptor_cache_identity_tests and missing_root_views_tests in draw.rs, re-verified draw::missing_root_views_tests + draw::descriptor_cache_identity_tests + xtask policy, and force-pushed — ready to merge!

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7228133240 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7228133240). Originally posted by [Lewandox](https://github.com/Lewandox) on 2026-11-27T21:06:03Z. --- Rebased on current `main` keeping both `descriptor_cache_identity_tests` and `missing_root_views_tests` in `draw.rs`, re-verified `draw::missing_root_views_tests` + `draw::descriptor_cache_identity_tests` + `xtask policy`, and force-pushed — ready to merge!
LooperSalty commented 2026-11-28 00:15:18 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-28T00:15:18Z.


Main just took #563 (the VIctory copy moved to Vice-Tay 4f15f09e) and #564 (memory stack), and this PR now conflicts in third_party/victory/crates/victory-gpu/src/host.rs. Please rebase on current main, rerun the tests for the files you touch, and force-push.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7230768532 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7230768532). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-28T00:15:18Z. --- Main just took #563 (the VIctory copy moved to Vice-Tay `4f15f09e`) and #564 (memory stack), and this PR now conflicts in `third_party/victory/crates/victory-gpu/src/host.rs`. Please rebase on current main, rerun the tests for the files you touch, and force-push.
Lewandox commented 2026-11-28 08:15:39 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-28T08:15:39Z.


Rebased onto main (132da61), resolving the struct-field conflict in third_party/victory/crates/victory-gpu/src/host.rs while keeping texture_readbacks and zero_root together.

Verified locally:

  • cargo test -p victory-gpu draw::missing_root_views_tests: 1 passed, 0 failed
  • cargo run -p xtask -- policy: asset policy: 377 files ok
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7236467576 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7236467576). Originally posted by [Lewandox](https://github.com/Lewandox) on 2026-11-28T08:15:39Z. --- Rebased onto `main` (`132da61`), resolving the struct-field conflict in `third_party/victory/crates/victory-gpu/src/host.rs` while keeping `texture_readbacks` and `zero_root` together. Verified locally: - `cargo test -p victory-gpu draw::missing_root_views_tests`: 1 passed, 0 failed - `cargo run -p xtask -- policy`: `asset policy: 377 files ok`
Lewandox commented 2026-11-30 00:56:59 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-30T00:56:59Z.


Closing since the upstream project has been discontinued. Thanks for everything!

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7265714172 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/458#issuecomment-7265714172). Originally posted by [Lewandox](https://github.com/Lewandox) on 2026-11-30T00:56:59Z. --- Closing since the upstream project has been discontinued. Thanks for everything!

Pull request closed

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
LooperSalty/AnyXboxX!458
No description provided.