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

Open
github-bot wants to merge 2 commits from github-bot/gh-3050 into main AGit
Owner

@⁠kotekompotek on GitHub · 2026-11-26 05:23 UTC · original
kotekompotek:gpu/view-heap-ours → main · +45 −8 · 1 files · 2 commits · open

Summary

  • State::wanted returned [0, SAMPLERS_OURS] for a list that binds no view heap and does not read title memory, so bind_heaps bound only our sampler heap — while every generated root signature indexes both descriptor heaps directly. D3D12 requires a heap of each kind bound before such a signature is set (debug layer id 1419); NVIDIA removes the device over it.
  • wanted now asks for MEMORY_HEAP whenever the title binds no view heap (title[0] == 0), not only when memory_heap is set, and bind_heaps inserts our heap on want[0] == MEMORY_HEAP instead of on the flag alone — the same stand-in the sampler half already does. root_view and the write-mark table already live in that heap.
  • Fixes #2894. Stacked on #3039: applied standalone this change makes wanted return [usize::MAX; 2] (colliding with the host_state_lost marker) for every no-view-heap list — it needs #3039's Option sentinel first. Once #3039 merges this PR shows only its own commit.
  • Related: #2896 covers both issues in one PR with a different sentinel choice (SAMPLERS_OURS = usize::MAX - 1); either route works, maintainers' pick.

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

**@⁠kotekompotek** on GitHub · 2026-11-26 05:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050) `kotekompotek:gpu/view-heap-ours` → `main` · +45 −8 · 1 files · 2 commits · open ## Summary - `State::wanted` returned `[0, SAMPLERS_OURS]` for a list that binds no view heap and does not read title memory, so `bind_heaps` bound only our sampler heap — while every generated root signature indexes both descriptor heaps directly. D3D12 requires a heap of each kind bound before such a signature is set (debug layer id 1419); NVIDIA removes the device over it. - `wanted` now asks for `MEMORY_HEAP` whenever the title binds no view heap (`title[0] == 0`), not only when `memory_heap` is set, and `bind_heaps` inserts our heap on `want[0] == MEMORY_HEAP` instead of on the flag alone — the same stand-in the sampler half already does. `root_view` and the write-mark table already live in that heap. - Fixes #2894. **Stacked on #3039**: applied standalone this change makes `wanted` return `[usize::MAX; 2]` (colliding with the `host_state_lost` marker) for every no-view-heap list — it needs #3039's `Option` sentinel first. Once #3039 merges this PR shows only its own commit. - Related: #2896 covers both issues in one PR with a different sentinel choice (`SAMPLERS_OURS = usize::MAX - 1`); either route works, maintainers' pick. ## Test plan - [x] `a_list_without_a_sampler_heap_gets_ours` extended: `wanted([0,0], false)` and `wanted([0,0x20], false)` now assert `MEMORY_HEAP` - [x] `cargo test -p victory-gpu --lib` (msvc), `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` clean - [x] CI green Generated with [Devin](https://devin.ai)
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 #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 #2894.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:27:33 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 05:51 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-26 05:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#issuecomment-7183875315) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:17 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-26 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#issuecomment-7184287644) <!-- victory-triage v1 head=8404edeee35528cf33c1b05b6cde9db3abef5c17 verdict=proposed-close at=2026-11-26T06:18:50Z --> 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](https://claude.ai/code)_
Author
Owner

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

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).

**@⁠Dukestar69** on GitHub · 2026-11-26 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#pullrequestreview-6068978734) · **approved these changes** 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).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 05:27 UTC · original · requested changes

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.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#pullrequestreview-6068979523) · **requested changes** 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 06:15 UTC · original · approved these changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 06:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#pullrequestreview-6069375409) · **approved these changes** 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.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 17:17 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-26 17:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#issuecomment-7198776099) 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.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:53 UTC · original

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 17:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3050#issuecomment-7199812344) 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](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/a7867ade65704cd9c203e2f92583af86d7db6d81) | 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.
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/3050/head:github-bot/gh-3050'
git switch 'github-bot/gh-3050'

Merge

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