D3D12.X: a title's barrier groups (#146) move its textures between states #3299
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3299"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 theper-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 statescrates/xcl/src/hle/d3d12x/list_x.rs: #146uav_barrier_xsends the transitions after its UAV barrier;resource_barrier_xnotes each legacy transitioncrates/xcl/src/hle/d3d12x/real.rs: a released resource is forgotten;depth_uav.rs:keptavailable outside teststransitionsrefuses 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
cargo test --workspace --no-fail-fast -- --test-threads=4onfb72af55: 2612 passed, 4 failed, 49 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(E_OUTOFMEMORYfromCreateComputePipelineState, 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 allno wave64.xcl-pso-ahead-2, a misaligned COM pointer in windows-core); two reruns ofcargo test -p xcl --libthere and the full run on this head were clean, and no other branch's run hit it.Regression run
main:
this PR:
Not tested
XCL_BARRIER_LOGdiagnostics of the amd-dev commit, and itsformat_aliashooks (main has no format_alias), are left outAI use
🤖 Generated with Claude Code
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)
Pull request closed