D3D12.X: a title's barrier groups (#146) move its textures between states #3299

Closed
Foniass wants to merge 1 commit from upstream-pr/3299 into main
Foniass commented 2026-11-29 06:51:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T06:51:06Z.


A title that uses enhanced barriers makes all its texture state changes
through command list #146, Barrier(groups). XCL answered #146 with a
global UAV barrier only, so no PC texture left the state it was created
in: render targets were sampled while still compressed, depth buffers
read as textures were never expanded, and a depth buffer the title moved
into unordered access never reached depth_uav. On the retail title this
left the world dark.

New hle/d3d12x/barrier_groups.rs turns each texture barrier of the
groups into a legacy transition between the states its layouts stand
for (state_of), on the subresources its range names (depth and stencil
planes tracked separately), and sends them the way a title's own
ResourceBarrier calls go (list_x::resource_barrier_x), after the UAV
barrier that still stands for buffer and global barriers. legal() drops
what the PC would refuse: an illegal barrier fails Close with
E_INVALIDARG. A barrier from the undefined layout starts at the state
the texture was last moved to; resource_barrier_x notes legacy
transitions for that (note_legacy_state), and a released texture is
forgotten. XCL_BARRIER_GROUPS=0 turns the transitions off.

Ported from amd-dev: barrier_groups.rs as of fdd1ac2d (which added the
per-plane depth / stencil tracking) and the #146 wiring of a68f609f
(raylitebull, written with Claude Code), with depth_uav::kept made available
outside tests as on amd-dev (barrier_groups asks it), without that commit's other
work (depth twins on by default, ambient, kernelx sections, RAM budget,
memory map), its XCL_BARRIER_LOG diagnostics, or the format_alias hooks
main does not have.

What is in it

  • crates/xcl/src/hle/d3d12x/barrier_groups.rs (new, about 630 lines of which about 160 are tests): state_of (layout to PC state), subresources / per-plane tracking, legal, transitions, note_legacy_state, forget; tests for the layout mapping, ranges, planes and illegal states
  • crates/xcl/src/hle/d3d12x/list_x.rs: #146 uav_barrier_x sends the transitions after its UAV barrier; resource_barrier_x notes each legacy transition
  • crates/xcl/src/hle/d3d12x/real.rs: a released resource is forgotten; depth_uav.rs: kept available outside tests
  • new here: transitions refuses a misaligned resource pointer from a title's barrier (windows-core aborts the process on one)

Over the 400-line target because the module comes with its tests; the hooks without the module do nothing, and the module without the hooks is dead code.

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on fb72af55: 2612 passed, 4 failed, 49 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (E_OUTOFMEMORY from CreateComputePipelineState, seeds 70 / 545 / 1019 / 1507), the same as on main on this machine; they pass on another RTX 5070 Ti. SKIPPED GPU tests: 44 notices, almost all no wave64.
  • The first full run of this branch (head 014fba85, without the alignment check) aborted once in the lib tests, in a background pipeline-builder thread (xcl-pso-ahead-2, a misaligned COM pointer in windows-core); two reruns of cargo test -p xcl --lib there and the full run on this head were clean, and no other branch's run hit it.
  • Retail title: 60 s smoke run below (no device removal or crash, frames and peak commit within the limits).

Regression run

main:

xcl-smoke v1
commit: b10cc4c6766adc947c2054ada4a2af98be15108d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1565 (PresentX 1565)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16026 MB

this PR:

xcl-smoke v1
commit: fb72af55960d621dbf6c93e73d18200fb1bbe4cd
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1670 (PresentX 1670)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16814 MB

Not tested

  • whether the retail world is lit now (amd-dev reports it with depth twins on, #3290, on an RX 9070 XT); not checked here
  • XCL_BARRIER_LOG diagnostics of the amd-dev commit, and its format_alias hooks (main has no format_alias), are left out
  • AMD GPUs

AI use

  • Claude Code with Claude Opus 5.5: ported this part of the amd-dev commit named above to main, wrote the commit message and this description, ran the tests and the smoke run.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5548402833 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3299). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T06:51:06Z. --- A title that uses enhanced barriers makes all its texture state changes through command list #146, Barrier(groups). XCL answered #146 with a global UAV barrier only, so no PC texture left the state it was created in: render targets were sampled while still compressed, depth buffers read as textures were never expanded, and a depth buffer the title moved into unordered access never reached depth_uav. On the retail title this left the world dark. New hle/d3d12x/barrier_groups.rs turns each texture barrier of the groups into a legacy transition between the states its layouts stand for (state_of), on the subresources its range names (depth and stencil planes tracked separately), and sends them the way a title's own ResourceBarrier calls go (list_x::resource_barrier_x), after the UAV barrier that still stands for buffer and global barriers. legal() drops what the PC would refuse: an illegal barrier fails Close with E_INVALIDARG. A barrier from the undefined layout starts at the state the texture was last moved to; resource_barrier_x notes legacy transitions for that (note_legacy_state), and a released texture is forgotten. XCL_BARRIER_GROUPS=0 turns the transitions off. Ported from amd-dev: barrier_groups.rs as of fdd1ac2d (which added the per-plane depth / stencil tracking) and the #146 wiring of a68f609f (raylitebull, written with Claude Code), with depth_uav::kept made available outside tests as on amd-dev (barrier_groups asks it), without that commit's other work (depth twins on by default, ambient, kernelx sections, RAM budget, memory map), its XCL_BARRIER_LOG diagnostics, or the format_alias hooks main does not have. **What is in it** - `crates/xcl/src/hle/d3d12x/barrier_groups.rs` (new, about 630 lines of which about 160 are tests): `state_of` (layout to PC state), `subresources` / per-plane tracking, `legal`, `transitions`, `note_legacy_state`, `forget`; tests for the layout mapping, ranges, planes and illegal states - `crates/xcl/src/hle/d3d12x/list_x.rs`: #146 `uav_barrier_x` sends the transitions after its UAV barrier; `resource_barrier_x` notes each legacy transition - `crates/xcl/src/hle/d3d12x/real.rs`: a released resource is forgotten; `depth_uav.rs`: `kept` available outside tests - new here: `transitions` refuses a misaligned resource pointer from a title's barrier (windows-core aborts the process on one) Over the 400-line target because the module comes with its tests; the hooks without the module do nothing, and the module without the hooks is dead code. **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke - `cargo test --workspace --no-fail-fast -- --test-threads=4` on fb72af55: 2612 passed, 4 failed, 49 ignored. The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` (`E_OUTOFMEMORY` from `CreateComputePipelineState`, seeds 70 / 545 / 1019 / 1507), the same as on main on this machine; they pass on another RTX 5070 Ti. SKIPPED GPU tests: 44 notices, almost all `no wave64`. - The first full run of this branch (head 014fba85, without the alignment check) aborted once in the lib tests, in a background pipeline-builder thread (`xcl-pso-ahead-2`, a misaligned COM pointer in windows-core); two reruns of `cargo test -p xcl --lib` there and the full run on this head were clean, and no other branch's run hit it. - Retail title: 60 s smoke run below (no device removal or crash, frames and peak commit within the limits). **Regression run** main: ``` xcl-smoke v1 commit: b10cc4c6766adc947c2054ada4a2af98be15108d gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1565 (PresentX 1565) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16026 MB ``` this PR: ``` xcl-smoke v1 commit: fb72af55960d621dbf6c93e73d18200fb1bbe4cd gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1670 (PresentX 1670) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16814 MB ``` **Not tested** - whether the retail world is lit now (amd-dev reports it with depth twins on, #3290, on an RX 9070 XT); not checked here - `XCL_BARRIER_LOG` diagnostics of the amd-dev commit, and its `format_alias` hooks (main has no format_alias), are left out - AMD GPUs **AI use** - Claude Code with Claude Opus 5.5: ported this part of the amd-dev commit named above to main, wrote the commit message and this description, ran the tests and the smoke run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-11-29 22:29:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T22:29:01Z.


Closing: Kalmarv's #3287, which came first, is merged and does the same. Anything still missing from it can go in a small follow-up PR.

(Claude Code, Claude Opus 5.5, for Foniass)

<!-- greyfinch-sync:ivall/xcl:comment:7263707802 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3299#issuecomment-7263707802). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T22:29:01Z. --- Closing: Kalmarv's #3287, which came first, is merged and does the same. Anything still missing from it can go in a small follow-up PR. (Claude Code, Claude Opus 5.5, for Foniass)

Pull request closed

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
xcl-dev/xcl!3299
No description provided.