GPU: track D3D12 shadow-buffer states (#1670) #1691

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

@⁠Elensito on GitHub · 2026-11-24 20:47 UTC · original
Elensito:fix/shadow-buffer-state-1670 → main · +164 −27 · 4 files · 1 commits · open

What changed

  • Track shadow-buffer resource states across host command-list submissions.
  • Emit transitions for shader views, vertex/index buffers, and indirect arguments, combining compatible read-only states.
  • Add synthetic regression coverage for UAV-to-read transitions across submissions without game data.

Fixes #1670

Validation

  • cargo test -p victory-gpu
  • cargo xtask policy
  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics shadow::tests::buffer_states_follow_submission_order_and_combine_reads -- --nocapture

The reported RTX 5080 case could not be reproduced on that hardware locally.

**@⁠Elensito** on GitHub · 2026-11-24 20:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1691) `Elensito:fix/shadow-buffer-state-1670` → `main` · +164 −27 · 4 files · 1 commits · open ## What changed - Track shadow-buffer resource states across host command-list submissions. - Emit transitions for shader views, vertex/index buffers, and indirect arguments, combining compatible read-only states. - Add synthetic regression coverage for UAV-to-read transitions across submissions without game data. Fixes #1670 ## Validation - `cargo test -p victory-gpu` - `cargo xtask policy` - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics shadow::tests::buffer_states_follow_submission_order_and_combine_reads -- --nocapture` The reported RTX 5080 case could not be reproduced on that hardware locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:44 +00:00
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 01:09 UTC · original

Independent second-read at head 667e7dc9a4.

This is a massive architectural simplification despite the modest title: 132 files changed, +2,270 / -37,366 lines. Several internal crates and features are removed (memory.rs page-table approach, bindless.rs, pipelines.rs, shaderpack.rs, publish.rs, many diagnostic features, HostList::id breadcrumb matching, range.rs).

What the PR adds: buffer state tracking on shadow buffers via HostList::buffer_state() and Shadow::state (AtomicU32), combining consecutive read states (VERTEX | SRV) and resetting on writes (UAV), mirroring the existing texture state model. New test validates the tracking.

Correctness concerns: three shadow.gpu_writes(list, address, len) calls are removed, so root UAV write-backs are no longer copied back to title memory — shader writes through root UAVs will be lost. The update_busy path that copied title writes under GPU write ranges is gone, which could cause stale constants to reach the GPU. Off-element buffer views (for_view) and keep_writes are removed.

Recommendation: The new buffer state tracking itself is clean and well-tested, consistent with the existing texture state model. But the scope is dramatically larger than the title suggests, and several correctness paths are gone. These removals should be documented as intentional simplifications with a note on what breaks. The removed test coverage should be restored or replaced. A commit message explaining why these features are being removed would help reviewers understand the rationale.

Arch Linux, kernel 7.3.5-arch1-1, zero-CPU read, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 01:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1691#issuecomment-7149255918) Independent second-read at head 667e7dc9a4fd47f372b4ada77bda450c8d73587f. This is a massive architectural simplification despite the modest title: 132 files changed, +2,270 / -37,366 lines. Several internal crates and features are removed (memory.rs page-table approach, bindless.rs, pipelines.rs, shaderpack.rs, publish.rs, many diagnostic features, HostList::id breadcrumb matching, range.rs). **What the PR adds:** buffer state tracking on shadow buffers via `HostList::buffer_state()` and `Shadow::state` (AtomicU32), combining consecutive read states (VERTEX | SRV) and resetting on writes (UAV), mirroring the existing texture state model. New test validates the tracking. **Correctness concerns:** three `shadow.gpu_writes(list, address, len)` calls are removed, so root UAV write-backs are no longer copied back to title memory — shader writes through root UAVs will be lost. The `update_busy` path that copied title writes under GPU write ranges is gone, which could cause stale constants to reach the GPU. Off-element buffer views (`for_view`) and `keep_writes` are removed. **Recommendation:** The new buffer state tracking itself is clean and well-tested, consistent with the existing texture state model. But the scope is dramatically larger than the title suggests, and several correctness paths are gone. These removals should be documented as intentional simplifications with a note on what breaks. The removed test coverage should be restored or replaced. A commit message explaining why these features are being removed would help reviewers understand the rationale. Arch Linux, kernel 7.3.5-arch1-1, zero-CPU read, AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:34 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/draw.rs, crates/victory-gpu/src/host.rs, crates/victory-gpu/src/indirect.rs, crates/victory-gpu/src/shadow.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1691#issuecomment-7149704556) <!-- victory-triage v1 head=667e7dc9a4fd47f372b4ada77bda450c8d73587f verdict=needs-rebase at=2026-11-25T01:34:30Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-gpu/src/draw.rs`, `crates/victory-gpu/src/host.rs`, `crates/victory-gpu/src/indirect.rs`, `crates/victory-gpu/src/shadow.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/indirect.rs
  • crates/victory-gpu/src/shadow.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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