D3D12.X: translate list #146 enhanced barrier groups into legacy texture transitions #3287
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3287"
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 Kalmarv on 2026-11-29T05:08:25Z.
What is in it
Ports
crates/xcl/src/hle/d3d12x/barrier_groups.rsfromamd-dev(a68f609f+fdd1ac2d,raylitebull) ontomain, translating command list slot#146(Barrier(groups)) texture enhanced barriers into legacyD3D12_RESOURCE_BARRIERtransitions routed throughlist_x::resource_barrier_x:D3D12_BARRIER_LAYOUT_*+D3D12_BARRIER_ACCESS_*to PCD3D12_RESOURCE_STATES(includingDEPTH_READ0x20on depth-read layouts and independent depth/stencil plane state tracking).Close()(E_INVALIDARG), handles splitBEGIN_ONLY/END_ONLYbarriers, keeps partial subresource ranges exact instead of widening large ranges toALL_SUBRESOURCES, and tracksUNDEFINEDlayout transitions from the last known state.list_x::resource_barrier_xto keep legacy barrier state in sync viabarrier_groups::note_legacy_state, clears per-resource state on release inreal.rs, and exposesdepth_uav::keptfor depth-twinPARKcoordination.XCL_BARRIER_GROUPS=0(keeps the global UAV barrier).Tested
cargo test -p xcl --lib barrier_groupspassed (8 passed; 0 failed).xcl-smokeregression run below on NVIDIA GeForce RTX 5070 Ti (XCL_PREPARE=0,0device removals,0crashes,0E_INVALIDARG/Closefailures; live log confirmed8192+title texture barriers translated into7250+legacy transitions).Regression run
Baseline (
mainancestorf0e8fdd5c3942ddd399d5ee11384c8595c5aacff):PR branch (
bd5ee498d4805c3263b264d497ddfc482f704bfe):Not tested
amd-devcommits were tested on RX 9070 XT).ea3b5e4d.AI use
Ported from
amd-dev(a68f609f+fdd1ac2d), wired ontomain, and verified with an AI coding agent; reviewed by hand against unit tests, 150 s smoke logs, andlist_x::resource_barrier_x/depth_uavintegration.Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T05:35:45Z.
Two exact CPU translation controls on
2b75212dshow distinct ways a legal partial range can affect an independent mip. I compiled the production transitions_of, state_of, range and plane functions with a fixed shape callback and the same per-plane state representation. The resource was a two-mip, 66-slice, single-plane texture (132 subresources).These checks inspected the emitted barrier words without submitting inconsistent transitions to a driver. No device fault, title test or frame-performance claim. OpenAI Codex wrote and ran the bounded harness and drafted this comment.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T05:50:54Z.
The small range-only patch below passed six production transitions_of CPU controls on
2b75212d: 64 and 65 even indices, 66 odd indices, 128 consecutive interior indices, one final index, and a genuine full range. Each assertion compared the entire index sequence in order. Expanding a partial range costs one 32-byte legacy record per selected subresource plus the temporary 4-byte index; the complete range stays one record. For bounded peak memory across very large groups, stream exact batches to the caller instead of broadening the barrier.There is a separate integration constraint on the proposed per-subresource state fix: transitions_of currently calls moved before transitions filters/refines states in out.retain_mut. Moving to sparse state storage alone would still cache an after-state for a transition later refused or rewritten. A small isolated default-state-plus-overrides model passed mixed siblings, adjacent ranges, unknown prior state, return-to-default, and full-reset controls. I'd wire updates to accepted effective transitions, preserve unknown when no transition can be established, and account for split barriers and reset/discarded recordings before treating that model as authoritative. The diff here fixes range widening only.
OpenAI Codex prepared and tested the range change and state model. CPU translation controls only.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T06:35:32Z.
Good catch, thank you! Applied the exact-index range fix in d5ee498 (removed RANGE_MOST = 64 so partial ranges never widen to ALL_SUBRESOURCES, and added unit assertions for 65- and 100-slice partial ranges alongside the full-range case; cargo test -p xcl --lib barrier_groups 8/8 passing).
Agreed on keeping per-subresource post-filter state tracking (wired after out.retain_mut with split-barrier and command-list reset semantics) as a separate follow-up.
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:59:08Z.
Note: my #3299 is a port of the same amd-dev commit (#146 barrier groups), opened about 2 hours after this one; I missed this PR when I checked for duplicates. The two are nearly identical. Differences (from
git diffbetween them):transitions(), because windows-core aborts the process on one.Only one of the two should be merged; the maintainer can pick. If this one goes in, the alignment check from #3299 would be worth adding here, and I'll close #3299.
(Written with Claude Code, Claude Opus 5.5.)