GPU/list: retain host ID3D12Resources in Aliasing and UAV barriers an… #540

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

@⁠pug205gti6 on GitHub · 2026-11-25 02:02 UTC · original
pug205gti6:pr/479-gpu-list-barriers → main · +255 −37 · 1 files · 1 commits · open

…d include depth-plane twin

D3D12 command lists do not AddRef resources passed to ID3D12GraphicsCommandList::ResourceBarrier. Transition barriers (kind == 0) kept host textures alive via HostList::transition, but Aliasing (kind == 1) and UAV (kind == 2) barriers extracted raw ID3D12Resource* pointers via host_resource/twin_resource without calling list.keep(...). Releasing a title texture (or idle eviction) before ExecuteCommandLists therefore caused a host ID3D12Resource use-after-free.

Additionally, UAV barriers on depth-stencil+UAV textures only emitted a barrier for twin.colour, omitting twin.plane (the depth-plane twin).

Hold owned Arc<HostTexture> / Arc<Twin> via resource::host_copy / resource::twin, retain every referenced ID3D12Resource on the command list with list.keep(...), and emit UAV barriers for both twin.colour and twin.plane. Add a synthetic D3D12 unit test verifying COM refcount retention, depth-plane twin emission, and safe execution after releasing title textures.

**@⁠pug205gti6** on GitHub · 2026-11-25 02:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/540) `pug205gti6:pr/479-gpu-list-barriers` → `main` · +255 −37 · 1 files · 1 commits · open …d include depth-plane twin D3D12 command lists do not AddRef resources passed to `ID3D12GraphicsCommandList::ResourceBarrier`. Transition barriers (`kind == 0`) kept host textures alive via `HostList::transition`, but Aliasing (`kind == 1`) and UAV (`kind == 2`) barriers extracted raw `ID3D12Resource*` pointers via `host_resource`/`twin_resource` without calling `list.keep(...)`. Releasing a title texture (or idle eviction) before `ExecuteCommandLists` therefore caused a host `ID3D12Resource` use-after-free. Additionally, UAV barriers on depth-stencil+UAV textures only emitted a barrier for `twin.colour`, omitting `twin.plane` (the depth-plane twin). Hold owned `Arc<HostTexture>` / `Arc<Twin>` via `resource::host_copy` / `resource::twin`, retain every referenced `ID3D12Resource` on the command list with `list.keep(...)`, and emit UAV barriers for both `twin.colour` and `twin.plane`. Add a synthetic D3D12 unit test verifying COM refcount retention, depth-plane twin emission, and safe execution after releasing title textures.
D3D12 command lists do not AddRef resources passed to `ID3D12GraphicsCommandList::ResourceBarrier`. Transition barriers (`kind == 0`) kept host textures alive via `HostList::transition`, but Aliasing (`kind == 1`) and UAV (`kind == 2`) barriers extracted raw `ID3D12Resource*` pointers via `host_resource`/`twin_resource` without calling `list.keep(...)`. Releasing a title texture (or idle eviction) before `ExecuteCommandLists` therefore caused a host `ID3D12Resource` use-after-free.

Additionally, UAV barriers on depth-stencil+UAV textures only emitted a barrier for `twin.colour`, omitting `twin.plane` (the depth-plane twin).

Hold owned `Arc<HostTexture>` / `Arc<Twin>` via `resource::host_copy` / `resource::twin`, retain every referenced `ID3D12Resource` on the command list with `list.keep(...)`, and emit UAV barriers for both `twin.colour` and `twin.plane`. Add a synthetic D3D12 unit test verifying COM refcount retention, depth-plane twin emission, and safe execution after releasing title textures.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:45:51 +00:00
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 07:37 UTC · original

Duplicate of #479: @⁠AscilCH opened this patch 39 minutes earlier, and gh pr diff returns the same bytes for both (+255/-37 on 1 file(s), same title).

Please continue in #479 so the review history and any test data stay in one place.
Thanks.

**@⁠Revens2** on GitHub · 2026-11-25 07:37 UTC · [original](https://github.com/fxceless/victory-fork/pull/540#issuecomment-7156073841) Duplicate of #479: @⁠AscilCH opened this patch 39 minutes earlier, and `gh pr diff` returns the same bytes for both (+255/-37 on 1 file(s), same title). Please continue in #479 so the review history and any test data stay in one place. Thanks.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/list.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/540/head:github-bot/gh-540'
git switch 'github-bot/gh-540'

Merge

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