GPU: fall back to memory view heap for VIEW_STRIDES when no title heap is bound #3186

Open
github-bot wants to merge 1 commit from github-bot/gh-3186 into main AGit
Owner

@⁠reeledMarek on GitHub · 2026-11-26 11:28 UTC · original
reeledMarek:fix/gpu-view-strides-memory-heap → main · +49 −11 · 1 files · 1 commits · open

Summary

  • In crates/victory-gpu/src/draw.rs, State::bind already falls back to crate::memory::heap() when self.heaps[0] == 0 for p.marks and State::root_view, and binds it via bind_heaps when memory_heap is true.
  • However, binding VIEW_STRIDES only checked (self.heaps[0] != 0).then(...), dropping draws/dispatches with "view strides without a view heap" even when crate::memory::heap() (which allocates its own strides table) is bound as the active view heap.
  • Added State::active_view_heap() (matching p.marks and root_view), used it for both p.marks and VIEW_STRIDES, and included VIEW_STRIDES stages in memory_heap so the fallback view heap is bound before setting the root signature.

Testing

  • Added view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound in crates/victory-gpu/src/draw.rs.
  • Verified cargo test -p xtask --locked passes.
**@⁠reeledMarek** on GitHub · 2026-11-26 11:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3186) `reeledMarek:fix/gpu-view-strides-memory-heap` → `main` · +49 −11 · 1 files · 1 commits · open ## Summary - In `crates/victory-gpu/src/draw.rs`, `State::bind` already falls back to `crate::memory::heap()` when `self.heaps[0] == 0` for `p.marks` and `State::root_view`, and binds it via `bind_heaps` when `memory_heap` is true. - However, binding `VIEW_STRIDES` only checked `(self.heaps[0] != 0).then(...)`, dropping draws/dispatches with `"view strides without a view heap"` even when `crate::memory::heap()` (which allocates its own `strides` table) is bound as the active view heap. - Added `State::active_view_heap()` (matching `p.marks` and `root_view`), used it for both `p.marks` and `VIEW_STRIDES`, and included `VIEW_STRIDES` stages in `memory_heap` so the fallback view heap is bound before setting the root signature. ## Testing - Added `view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound` in `crates/victory-gpu/src/draw.rs`. - Verified `cargo test -p xtask --locked` passes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:33:16 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 11:42 UTC · original

WARP verification of #3186 at 1aff290e6442899538cc522a317c96195712ad8d (software adapter only, no physical GPU; claimed in #1633).

Environment: Windows 11 Pro 10.0.26200; WARP D3D10Warp.dll 10.0.26100.9818; Windows SDK 10.0.26100.0 dxil.dll 1.8.2502.11 / dxc.exe 1.8.2502.11 (VICTORY_DXIL set to it); rustc via rust-toolchain.toml (1.98.1); VICTORY_D3D12_WARP=1; CARGO_TARGET_DIR outside the repo.

Commands (head and merge-base 63bcca43, which is current main):

  • cargo test -p victory-gpu --lib --locked -j 4 -- --test-threads=1
  • cargo test -p victory-gpu --lib --locked -j 4 view_strides_falls_back -- --test-threads=1
victory-gpu lib
main (63bcca43) 231 passed, 0 failed, 1 ignored
head (1aff290e) 232 passed, 0 failed, 1 ignored

draw::tests::view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound passes on head. The test returns early when memory::heap() is None, so I checked that on WARP it does not: with that early return temporarily turned into a panic, the test still passed. The active_view_heap() and strides().is_some() assertions therefore run on the software adapter.

Revert check (limited): I reverted only the two call-site changes (the VIEW_STRIDES lookup in the dispatch path and the has_view_strides term in the memory_heap condition) and kept the test. The test still passes. It exercises has_view_strides, State::wanted and active_view_heap, not the two call sites, so it would not catch a regression of either one. A test through the dispatch path would be needed for that. This is a coverage note, not a failure of the PR.

Defects: none found. When heaps[0] == 0 the new active_view_heap() returns the same heap as the previous p.marks match (memory::heap()); with a bound title heap it returns that heap's host side as before. The memory_heap condition now also binds the fallback heap for stages that only use VIEW_STRIDES, so the lookup can no longer hit an unbound heap in that case.

AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). No game files, dumps, shader names or hashes were used.

**@⁠oni-swr** on GitHub · 2026-11-26 11:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3186#issuecomment-7191060350) **WARP verification of #3186 at `1aff290e6442899538cc522a317c96195712ad8d`** (software adapter only, no physical GPU; claimed in #1633). **Environment:** Windows 11 Pro 10.0.26200; WARP `D3D10Warp.dll` 10.0.26100.9818; Windows SDK 10.0.26100.0 `dxil.dll` 1.8.2502.11 / `dxc.exe` 1.8.2502.11 (`VICTORY_DXIL` set to it); rustc via `rust-toolchain.toml` (1.98.1); `VICTORY_D3D12_WARP=1`; `CARGO_TARGET_DIR` outside the repo. **Commands** (head and merge-base `63bcca43`, which is current `main`): - `cargo test -p victory-gpu --lib --locked -j 4 -- --test-threads=1` - `cargo test -p victory-gpu --lib --locked -j 4 view_strides_falls_back -- --test-threads=1` | | victory-gpu lib | |---|---| | main (`63bcca43`) | 231 passed, 0 failed, 1 ignored | | head (`1aff290e`) | 232 passed, 0 failed, 1 ignored | `draw::tests::view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound` passes on head. The test returns early when `memory::heap()` is `None`, so I checked that on WARP it does not: with that early return temporarily turned into a panic, the test still passed. The `active_view_heap()` and `strides().is_some()` assertions therefore run on the software adapter. **Revert check (limited):** I reverted only the two call-site changes (the `VIEW_STRIDES` lookup in the dispatch path and the `has_view_strides` term in the `memory_heap` condition) and kept the test. The test still passes. It exercises `has_view_strides`, `State::wanted` and `active_view_heap`, not the two call sites, so it would not catch a regression of either one. A test through the dispatch path would be needed for that. This is a coverage note, not a failure of the PR. **Defects:** none found. When `heaps[0] == 0` the new `active_view_heap()` returns the same heap as the previous `p.marks` match (`memory::heap()`); with a bound title heap it returns that heap's host side as before. The `memory_heap` condition now also binds the fallback heap for stages that only use `VIEW_STRIDES`, so the lookup can no longer hit an unbound heap in that case. AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). No game files, dumps, shader names or hashes were used.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 12:08 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 21/21 passed on RTX 5090 and WARP (including view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly falls back to the memory view heap for VIEW_STRIDES when no title heap is bound.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 12:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/3186#pullrequestreview-6073872679) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 21/21 passed on RTX 5090 and WARP (including `view_strides_falls_back_to_memory_heap_when_no_title_heap_is_bound`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly falls back to the memory view heap for `VIEW_STRIDES` when no title heap is bound. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 12:08 UTC · original

I checked the dispatch-path coverage gap on native Windows at 1aff290e. A synthetic GFX10 compute shader reads a raw buffer by element index, which makes the translator emit VIEW_STRIDES. One command list uses the same descriptor indices in two heaps with different input data. Each dispatch goes through State::bind.

32-lane readback, in recording order RTX 5080 Windows inbox WARP
Explicit title heap 32/32 32/32
No title heap, runtime fallback 32/32 32/32
Explicit title heap restored 32/32 32/32

Both adapters reproduced this twice in fresh processes. The title outputs were 0x1101…0x1120, the fallback output was 0x2201…0x2220, and all 24 guard words survived each run.

The regression catches both call-site changes independently on both adapters. Reverting just the stride-table lookup left the fallback output at 0xcafebeef in all 32 lanes, while both title dispatches still matched 32/32. Reverting just the heap-selection predicate, or using parent 63bcca43, made the D3D12 debug layer flag the missing CBV/SRV/UAV heap when setting the directly indexed root signature. The test stops before submitting that list.

The test-only commit is based directly on this PR head. Commit · applyable patch

git fetch https://github.com/steven-seagull27/VIctory.git codex/view-strides-dispatch-3186
git cherry-pick 1258d349409f9ceb55be95c388cbd7cf85af5b69
$env:VICTORY_D3D12_DEBUG = '1'
foreach ($warp in '0','1') {
    $env:VICTORY_D3D12_WARP = $warp
    cargo test -p victory-gpu --locked --lib --all-features view_strides_dispatch_switches -- --ignored --nocapture --test-threads=1
}
**@⁠steven-seagull27** on GitHub · 2026-11-26 12:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/3186#issuecomment-7191620464) I checked the dispatch-path coverage gap on native Windows at `1aff290e`. A synthetic GFX10 compute shader reads a raw buffer by element index, which makes the translator emit `VIEW_STRIDES`. One command list uses the same descriptor indices in two heaps with different input data. Each dispatch goes through `State::bind`. | 32-lane readback, in recording order | RTX 5080 | Windows inbox WARP | |---|---:|---:| | Explicit title heap | 32/32 | 32/32 | | No title heap, runtime fallback | 32/32 | 32/32 | | Explicit title heap restored | 32/32 | 32/32 | Both adapters reproduced this twice in fresh processes. The title outputs were `0x1101…0x1120`, the fallback output was `0x2201…0x2220`, and all 24 guard words survived each run. The regression catches both call-site changes independently on both adapters. Reverting just the stride-table lookup left the fallback output at `0xcafebeef` in all 32 lanes, while both title dispatches still matched 32/32. Reverting just the heap-selection predicate, or using parent `63bcca43`, made the D3D12 debug layer flag the missing CBV/SRV/UAV heap when setting the directly indexed root signature. The test stops before submitting that list. The test-only commit is based directly on this PR head. [Commit](https://github.com/steven-seagull27/VIctory/commit/1258d349409f9ceb55be95c388cbd7cf85af5b69) · [applyable patch](https://github.com/steven-seagull27/VIctory/commit/1258d349409f9ceb55be95c388cbd7cf85af5b69.patch) ```powershell git fetch https://github.com/steven-seagull27/VIctory.git codex/view-strides-dispatch-3186 git cherry-pick 1258d349409f9ceb55be95c388cbd7cf85af5b69 $env:VICTORY_D3D12_DEBUG = '1' foreach ($warp in '0','1') { $env:VICTORY_D3D12_WARP = $warp cargo test -p victory-gpu --locked --lib --all-features view_strides_dispatch_switches -- --ignored --nocapture --test-threads=1 } ```
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3186/head:github-bot/gh-3186'
git switch 'github-bot/gh-3186'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3186'
git switch 'github-bot/gh-3186'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3186'
git switch 'github-bot/gh-3186'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3186'
git switch 'main'
git merge --squash 'github-bot/gh-3186'
git switch 'main'
git merge --ff-only 'github-bot/gh-3186'
git switch 'main'
git merge 'github-bot/gh-3186'
git push origin 'main'
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!3186
No description provided.