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

Open
gomeaw wants to merge 3 commits from upstream-pr/42 into main
gomeaw commented 2026-11-26 00:04:08 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by gomeaw on 2026-11-26T00:04:08Z.


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.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6616358238 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/42). Originally posted by [gomeaw](https://github.com/gomeaw) on 2026-11-26T00:04:08Z. --- ## 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://github.com/avatarmanz/VIctory-7900XTX/issues/3#issuecomment-7178243800) AI-assisted with Codex. The fixture uses synthetic textures.
MoonYueya commented 2026-11-26 05:28:28 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by MoonYueya on 2026-11-26T05:28:28Z.


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.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7183517161 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/42#issuecomment-7183517161). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-26T05:28:28Z. --- 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.*
avatarmanz commented 2026-11-26 07:36:05 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by avatarmanz on 2026-11-26T07:36:05Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7185631971 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/42#issuecomment-7185631971). Originally posted by [avatarmanz](https://github.com/avatarmanz) on 2026-11-26T07:36:05Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/42:upstream-pr/42'
git switch 'upstream-pr/42'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'main'
git merge --squash 'upstream-pr/42'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'main'
git merge 'upstream-pr/42'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!42
No description provided.