Skip to content

GPU: our view heap is bound for a list that binds none (stacked on #3039) - #3050

Open
kotekompotek wants to merge 2 commits into
Marvisak:mainfrom
kotekompotek:gpu/view-heap-ours
Open

kotekompotek wants to merge 2 commits into
Marvisak:mainfrom
kotekompotek:gpu/view-heap-ours

Conversation

@kotekompotek

@kotekompotek kotekompotek commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

Test plan

  • a_list_without_a_sampler_heap_gets_ours extended: wanted([0,0], false) and wanted([0,0x20], false) now assert MEMORY_HEAP
  • cargo test -p victory-gpu --lib (msvc), cargo clippy -p victory-gpu --all-targets --locked -- -D warnings clean
  • CI green

Generated with Devin

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):

  • Diff review: State::wanted now selects MEMORY_HEAP when title[0] == 0 (mirroring SAMPLERS_OURS when title[1] == 0) and bind_heaps checks want[0] == MEMORY_HEAP, ensuring a list that binds no title view heap still has a valid view heap bound before setting a root signature indexing the resource heap directly (#2894).
  • cargo test -p victory-gpu draw::tests -- --test-threads=1 (RTX 5090): 20 passed, 0 failed (including a_list_without_a_sampler_heap_gets_ours).
  • VICTORY_WARP=1 cargo test -p victory-gpu draw::tests -- --test-threads=1 (WARP): 20 passed, 0 failed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of 3d3a7af1 (crates/victory-gpu/src/draw.rs).

One blocking dependency issue against current main:

  • On main, host_state_lost() still sets self.host_heaps = [usize::MAX; 2], while MEMORY_HEAP == usize::MAX and SAMPLERS_OURS == usize::MAX. With #3050 applied standalone (not stacked on #3039), State::wanted([0, 0], false) now returns [usize::MAX, usize::MAX], which widens the #2881 collision: after cut() or external::record, bind_heaps will now skip SetDescriptorHeaps for [0, 0] lists even when memory_heap == false. Please either stack this on #3039 or include the Option<[usize; 2]> sentinel fix directly here (so the PR is safe to merge in either order).

Minor notes:

  • Since the only caller (draw.rs:629-631) only sets memory_heap = true when self.heaps[0] == 0, the memory_heap parameter on wanted and bind_heaps becomes redundant once title[0] == 0 always selects MEMORY_HEAP.
  • Note for maintainers: #2896 already addresses #2894 together with the #2881 sentinel collision in one PR.

devin-ai-integration Bot and others added 2 commits November 26, 2026 10:34
host_state_lost marked host_heaps [usize::MAX; 2], but a list that binds
no heaps and reads title memory wants [MEMORY_HEAP, SAMPLERS_OURS] —
the same pair. After a cut or an external record, bind_heaps found them
equal and bound nothing; the next directly-indexing root signature ran
with no heaps, the device removal Marvisak#1778 was written to prevent.

None now marks the lost state: it equals no pair wanted can make, so
the next bind_heaps binds again.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The sibling of the missing sampler heap: a list binding no view heap
still gets a root signature that indexes the view heap directly, which
D3D12 requires a bound heap for (debug layer id 1419); NVIDIA removes
the device. wanted() now asks for ours whenever the title binds none,
not only when title memory's views are read, and bind_heaps inserts it
on that want rather than on the memory-heap flag alone.

Fixes Marvisak#2894.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@kotekompotek kotekompotek changed the title GPU: our view heap is bound for a list that binds none GPU: our view heap is bound for a list that binds none (stacked on #3039) Nov 26, 2026
@kotekompotek

Copy link
Copy Markdown
Author

Rebased onto gpu/lost-heaps-marker (#3039) at 8404ede — the Option sentinel now makes the widened wanted([0,0], …) unforgeable, so this is safe in either merge order relative to main (it will conflict textually with #2896 on the same lines if that lands first; both approaches fix the same two issues, maintainers' pick).

On the minor note: you're right that memory_heap is redundant once title[0] == 0 selects MEMORY_HEAP — kept the parameter so this stays a minimal delta over #3039; happy to drop it in a follow-up.

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 8404edee after rebasing onto the Option<[usize; 2]> sentinel from #3039: host_state_lost() now clears host_heaps to None, which can no longer collide with Some([MEMORY_HEAP, SAMPLERS_OURS]), and both State::wanted (title[0] == 0) and bind_heaps (want[0] == MEMORY_HEAP) are consistent with the new unit tests. Looks good.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Verdict: proposed close, as a duplicate of #2896. The fix here is correct. In crates/victory-gpu/src/draw.rs, State::wanted now gives MEMORY_HEAP when title[0] == 0, and bind_heaps inserts our heap when want[0] == MEMORY_HEAP. However, #2896 makes the same change to the same lines, with the same tests on wanted([0,0], false) and wanted([0,0x20], false). It was opened earlier and includes debug-layer evidence from Windows hardware (id 1419 gone). It is stacked on #2882, which fixes the lost-state marker by moving SAMPLERS_OURS to usize::MAX - 1. That is the role #3039 plays for this PR. The two routes conflict textually, and only one is needed.

This PR will be closed in 48 hours unless the author pushes a change that sets it apart from #2896, or a maintainer removes the label (for example, if they prefer #3039's Option sentinel over #2882's).

CI: check passing.


Generated by Claude Code

@kotekompotek

Copy link
Copy Markdown
Author

The two routes are coupled through the sentinel decision: #2896 is stacked on #2882, which fixes the same lost-state collision as #3039 by moving SAMPLERS_OURS to usize::MAX - 1. If the maintainers prefer #3039's Option sentinel (the triage on #3039 leans that way), #2882 does not land, #2896 loses its base and conflicts, while this PR already sits on the Option design.

So I would ask to keep this open until the #3039-vs-#2882 choice is made: this is the wanted fix written for the world where the sentinel is removed rather than renumbered. If #2882 lands instead, this one can close.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I ran the same synthetic compute readback on both routes. The guest binds neither heap, and the root signature declares both directly indexed heaps. Each case reads the word 1234abcd from a fallback view; cafe0000 is the initial output. This is app-local WARP 1.0.22 with Agility 1.620.2. Earlier test fixture

Build Requests memory heap, fresh / after cut No memory request, fresh / after cut
main 63bcca4 1234abcd / cafe0000 cafe0000 / cafe0000
#3039 only, c141c1f 1234abcd / 1234abcd cafe0000 / cafe0000
#3039 + #3050, 8404ede 1234abcd / 1234abcd 1234abcd / 1234abcd
#2882 + #2896, 26b7532 merged onto 63bcca4 1234abcd / 1234abcd 1234abcd / 1234abcd

I ran the memory-request cases first on the controls, since asking for neither heap first can make the later readbacks in the same process inconclusive on this WARP. The #3050 build passed all 22 draw tests and the full GPU suite (248 passed, 1 ignored). These readbacks confirm both stacks cover the two cases under discussion. AI-assisted with Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: a list that binds no view heap sets a root signature indexing the view heap directly with none bound (the other half of #1778)

5 participants