Give render and depth descriptors private slots during threaded recording #42

Open
github-bot wants to merge 3 commits from github-bot/gh-42 into main AGit
Owner

@⁠gomeaw on GitHub · 2026-11-26 00:04 UTC · original
gomeaw:fix/thread-local-output-views → main · +242 −94 · 5 files · 3 commits · open

Fix

The host uses shared rings for RTVs and DSVs. D3D12 consumes these CPU descriptors when the list records the clear or binds the outputs. A recording worker can be paused between descriptor creation and that call while another worker wraps the ring. The first worker then records another texture's descriptor.

Give each recording thread its own CPU-only scratch heaps and scope their handles to the calls that consume them. There are eight render-target slots and one depth slot per thread. The binding cache and resource state tracking are kept on their existing paths. D3D12 descriptor lifetime

Verification

On native Windows WARP, keep a color and depth clear pending on one worker while a second worker creates 1,024 descriptors of each kind. The old ring sent both clears to the wrong textures. The new code passed all four pixel and depth readbacks, the threaded list and texture tests, and the asset policy. Both resource pairs stayed alive throughout the test. Windows comparison

The synthetic test establishes this recording race. The missing draws and descriptor pressure reported on RTX 5080 have separate evidence in #35, and I have not measured the effect of this patch in-game. RTX rendering report

AI-assisted with Codex. The fixture uses synthetic textures.

**@⁠gomeaw** on GitHub · 2026-11-26 00:04 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/42) `gomeaw:fix/thread-local-output-views` → `main` · +242 −94 · 5 files · 3 commits · open ## Fix The host uses shared rings for RTVs and DSVs. D3D12 consumes these CPU descriptors when the list records the clear or binds the outputs. A recording worker can be paused between descriptor creation and that call while another worker wraps the ring. The first worker then records another texture's descriptor. Give each recording thread its own CPU-only scratch heaps and scope their handles to the calls that consume them. There are eight render-target slots and one depth slot per thread. The binding cache and resource state tracking are kept on their existing paths. [D3D12 descriptor lifetime](https://learn.microsoft.com/en-us/windows/win32/direct3d12/non-shader-visible-descriptor-heaps) ## Verification On native Windows WARP, keep a color and depth clear pending on one worker while a second worker creates 1,024 descriptors of each kind. The old ring sent both clears to the wrong textures. The new code passed all four pixel and depth readbacks, the threaded list and texture tests, and the asset policy. Both resource pairs stayed alive throughout the test. [Windows comparison](https://github.com/gomeaw/VIctory-7900XTX/actions/runs/45725349948) The synthetic test establishes this recording race. The missing draws and descriptor pressure reported on RTX 5080 have separate evidence in #35, and I have not measured the effect of this patch in-game. [RTX rendering report](https://git.gtahub.st/github/avatarmanz--VIctory-7900XTX/issues/3) AI-assisted with Codex. The fixture uses synthetic textures.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:31 +00:00
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-26 05:28 UTC · original

Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into MoonYueya/VIctory-Kira a3de053 on top of e2a28ec together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17).

  • cargo test --workspace --locked --no-fail-fast -- --test-threads=1: 924 passed, 0 failed, 45 ignored after this PR was merged (never below the count before it; the branch started at 923).
  • Its own regression test (another_worker_cannot_retarget_a_pending_clear) passes on this adapter.
  • With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader.

What this does not show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality.

AI-assisted.

**@⁠MoonYueya** on GitHub · 2026-11-26 05:28 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/42#issuecomment-7183517161) Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into [MoonYueya/VIctory-Kira](https://github.com/MoonYueya/VIctory-Kira) `a3de053` on top of `e2a28ec` together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17). - `cargo test --workspace --locked --no-fail-fast -- --test-threads=1`: **924 passed, 0 failed, 45 ignored** after this PR was merged (never below the count before it; the branch started at 923). - Its own regression test (`another_worker_cannot_retarget_a_pending_clear`) passes on this adapter. - With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader. What this does **not** show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality. *AI-assisted.*
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:36 UTC · original

Left open: changes how render and depth descriptors are recorded on every card; needs an in-game check on the 7900 XTX first.

**@⁠avatarmanz** on GitHub · 2026-11-26 07:36 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/42#issuecomment-7185631971) Left open: changes how render and depth descriptors are recorded on every card; needs an in-game check on the 7900 XTX first.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.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/42/head:github-bot/gh-42'
git switch 'github-bot/gh-42'

Merge

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