GPU: replay originally bound RTV and DSV views #48

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

@⁠Cuebert on GitHub · 2026-11-25 20:40 UTC · original
Cuebert:gpu/retain-output-views → main · +296 −23 · 3 files · 1 commits · open

I found that State::set_targets kept guest CPU descriptor handles and rebuilt RTV/DSV bindings when replaying state onto a later host command list. D3D12 consumes non-shader-visible RTV/DSV descriptors while recording the bind call, after which the CPU descriptor storage may be reused (Microsoft documentation). If the title rewrites one of those slots before a runtime list cut, rebuilding from the handle can bind the later view instead of the view originally recorded.

This change keeps each bound view description together with a retained title resource and its native host texture, then reuses that snapshot when binding outputs on the next host list. The new WARP regression draws to two 4×4 targets and rewrites the RTV slot, DSV slot, both, or neither between the initial bind and replay. The original implementation failed three rewrite cases; the corrected implementation returned all 16 red pixels on the original target in all four cases. The targeted test passed, the resource test group reported 15 passed, and the diagnostics-free GPU crate check passed.

I have not established that the title rewrites a CPU descriptor in the captured list-cut sequence or verified an in-game visual change. The trace shows list cuts, but it does not retain descriptor rewrite history.

**@⁠Cuebert** on GitHub · 2026-11-25 20:40 UTC · [original](https://github.com/DexNom/VIctory/pull/48) `Cuebert:gpu/retain-output-views` → `main` · +296 −23 · 3 files · 1 commits · open I found that `State::set_targets` kept guest CPU descriptor handles and rebuilt RTV/DSV bindings when replaying state onto a later host command list. D3D12 consumes non-shader-visible RTV/DSV descriptors while recording the bind call, after which the CPU descriptor storage may be reused ([Microsoft documentation](https://learn.microsoft.com/en-us/windows/win32/direct3d12/non-shader-visible-descriptor-heaps)). If the title rewrites one of those slots before a runtime list cut, rebuilding from the handle can bind the later view instead of the view originally recorded. This change keeps each bound view description together with a retained title resource and its native host texture, then reuses that snapshot when binding outputs on the next host list. The new WARP regression draws to two 4×4 targets and rewrites the RTV slot, DSV slot, both, or neither between the initial bind and replay. The original implementation failed three rewrite cases; the corrected implementation returned all 16 red pixels on the original target in all four cases. The targeted test passed, the resource test group reported 15 passed, and the diagnostics-free GPU crate check passed. I have not established that the title rewrites a CPU descriptor in the captured list-cut sequence or verified an in-game visual change. The trace shows list cuts, but it does not retain descriptor rewrite history.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:32:37 +00:00
Author
Owner

@⁠Artking175 on GitHub · 2026-11-25 21:03 UTC · original

Independent check on RTX 2060 (Windows 10, driver 531.41, Agility 1.614.1). I ran replay_uses_render_target_and_depth_views_as_bound on the hardware adapter and separately with WARP. Both used PR head 2ac8e5f7 plus the same #12 SDK loader overlay. For the control I kept the fixture and restored draw.rs from 2e01ab4.

Both adapters gave the same readback. The pairs count red pixels in the original and alternate render targets.

CPU descriptor rewritten Control #48
Neither [16, 0] [16, 0]
RTV [0, 16] [16, 0]
DSV [0, 0] [16, 0]
Both [0, 0] [16, 0]

The control failed the output-binding assertion on both adapters. The PR passed all four cases on both. I did not test the title's descriptor history or rendering with this branch.

**@⁠Artking175** on GitHub · 2026-11-25 21:03 UTC · [original](https://github.com/DexNom/VIctory/pull/48#issuecomment-7174544923) Independent check on RTX 2060 (Windows 10, driver 531.41, Agility 1.614.1). I ran `replay_uses_render_target_and_depth_views_as_bound` on the hardware adapter and separately with WARP. Both used PR head `2ac8e5f7` plus the same #12 SDK loader overlay. For the control I kept the fixture and restored `draw.rs` from `2e01ab4`. Both adapters gave the same readback. The pairs count red pixels in the original and alternate render targets. | CPU descriptor rewritten | Control | #48 | | --- | ---: | ---: | | Neither | [16, 0] | [16, 0] | | RTV | [0, 16] | [16, 0] | | DSV | [0, 0] | [16, 0] | | Both | [0, 0] | [16, 0] | The control failed the output-binding assertion on both adapters. The PR passed all four cases on both. I did not test the title's descriptor history or rendering with this branch.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/48/head:github-bot/gh-48'
git switch 'github-bot/gh-48'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-48'
git switch 'github-bot/gh-48'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-48'
git switch 'github-bot/gh-48'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-48'
git switch 'main'
git merge --squash 'github-bot/gh-48'
git switch 'main'
git merge --ff-only 'github-bot/gh-48'
git switch 'main'
git merge 'github-bot/gh-48'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.