D3D12.X: translate list #146 Enhanced Barriers to legacy ResourceBarrier #1025

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

@⁠raylitebull on GitHub · 2026-11-24 10:27 UTC · original
raylitebull:pr/enhanced-barriers-146 → main · +946 −34 · 5 files · 1 commits · draft

Translate console command list slot #146 (ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups)) into legacy ResourceBarrier calls instead of emitting only a wildcard UAV barrier. Modern Scarlett titles that create resources with barrier layouts (device #127 / #133) rely on #146 for all render-target, depth, shader-resource, and copy layout transitions; dropping those transitions left targets stuck in their initial states.

(The diff is ~950 lines as one self-contained module: ~520 lines for parsing, layout mapping, state tracking, and legacy barrier translation, plus ~395 lines of unit and GPU tests.)

What is in it

  • crates/xcl/src/hle/d3d12x/enhanced_barrier.rs: parses D3D12_BARRIER_GROUP (GLOBAL, TEXTURE, BUFFER) with readable() guards (falling back to the legacy global UAV barrier on unparseable calls), maps D3D12_BARRIER_LAYOUT 0..=31 (including 0x1F) plus access-bit fallback for console-only layouts > 0x1F, tracks whole-resource states for UNDEFINED before layouts, emits aliasing barriers for UNDEFINED placed textures, skips UNORDERED_ACCESS on non-UAV textures and states disallowed on compute/copy lists, forwards emitted transitions to title_textures::note_transitions, and includes 13 unit + GPU tests.
  • crates/xcl/src/hle/d3d12x/device_x.rs, real.rs, list_x.rs, mod.rs: wire slot #146 to enhanced_barrier::barrier_x, align #127/#133 initial layout states with texture-vs-buffer awareness, record initial/legacy barrier states, and clear tracked state on res_release.

Tested

  • AMD Radeon RX 9070 XT (driver 32.0.32015.2008), Intel Core i5-13600KF, Windows 11 Pro 22631, rustc 1.99.1 (58cf8f9c3 2026-10-13), release + test profiles
  • cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignored (0 SKIPPED GPU tests)

Regression run

main:

xcl-smoke v1
commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294
gpu: AMD Radeon RX 9070 XT
title: Game Assets
seconds: 60
exit: 0x0
frames shown: 1512 (PresentX 1512)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14852 MB

PR:

xcl-smoke v1
commit: 1ecefdda3b4627ab8160845942f27ab4e75ce0c5
gpu: AMD Radeon RX 9070 XT
title: Game Assets
seconds: 60
exit: 0x0
frames shown: 1609 (PresentX 1609)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14876 MB

Not tested

  • NVIDIA GPUs, Intel Arc GPUs, Linux / Wine, other retail titles beyond the 60 s smoke run and unit/GPU test suite.

AI use

  • Antigravity (Gemini 4 Neon): rebased the local Enhanced Barriers implementation onto origin/main, cleaned up unused helper/constant warnings, ran the full GPU test suite and 60 s smoke regression check, and drafted this description.
**@⁠raylitebull** on GitHub · 2026-11-24 10:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1025) `raylitebull:pr/enhanced-barriers-146` → `main` · +946 −34 · 5 files · 1 commits · draft Translate console command list slot `#146` (`ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups)`) into legacy `ResourceBarrier` calls instead of emitting only a wildcard UAV barrier. Modern Scarlett titles that create resources with barrier layouts (device `#127` / `#133`) rely on `#146` for all render-target, depth, shader-resource, and copy layout transitions; dropping those transitions left targets stuck in their initial states. (The diff is ~950 lines as one self-contained module: ~520 lines for parsing, layout mapping, state tracking, and legacy barrier translation, plus ~395 lines of unit and GPU tests.) **What is in it** - `crates/xcl/src/hle/d3d12x/enhanced_barrier.rs`: parses `D3D12_BARRIER_GROUP` (`GLOBAL`, `TEXTURE`, `BUFFER`) with `readable()` guards (falling back to the legacy global UAV barrier on unparseable calls), maps `D3D12_BARRIER_LAYOUT` `0..=31` (including `0x1F`) plus access-bit fallback for console-only layouts `> 0x1F`, tracks whole-resource states for `UNDEFINED` before layouts, emits aliasing barriers for `UNDEFINED` placed textures, skips `UNORDERED_ACCESS` on non-UAV textures and states disallowed on compute/copy lists, forwards emitted transitions to `title_textures::note_transitions`, and includes 13 unit + GPU tests. - `crates/xcl/src/hle/d3d12x/device_x.rs`, `real.rs`, `list_x.rs`, `mod.rs`: wire slot `#146` to `enhanced_barrier::barrier_x`, align `#127`/`#133` initial layout states with texture-vs-buffer awareness, record initial/legacy barrier states, and clear tracked state on `res_release`. **Tested** - AMD Radeon RX 9070 XT (driver 32.0.32015.2008), Intel Core i5-13600KF, Windows 11 Pro 22631, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, release + test profiles - `cargo test --workspace -- --test-threads=4`: 741 passed, 0 failed, 41 ignored (0 SKIPPED GPU tests) **Regression run** main: ``` xcl-smoke v1 commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294 gpu: AMD Radeon RX 9070 XT title: Game Assets seconds: 60 exit: 0x0 frames shown: 1512 (PresentX 1512) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14852 MB ``` PR: ``` xcl-smoke v1 commit: 1ecefdda3b4627ab8160845942f27ab4e75ce0c5 gpu: AMD Radeon RX 9070 XT title: Game Assets seconds: 60 exit: 0x0 frames shown: 1609 (PresentX 1609) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14876 MB ``` **Not tested** - NVIDIA GPUs, Intel Arc GPUs, Linux / Wine, other retail titles beyond the 60 s smoke run and unit/GPU test suite. **AI use** - Antigravity (Gemini 4 Neon): rebased the local Enhanced Barriers implementation onto `origin/main`, cleaned up unused helper/constant warnings, ran the full GPU test suite and 60 s smoke regression check, and drafted this description.
Console command list slot #146 is ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups) on both older and newer layouts; previously it emitted only a wildcard UAV barrier, dropping every texture layout transition.

- Parse D3D12_BARRIER_GROUP (GLOBAL, TEXTURE, BUFFER) safely with readable() checks; unparseable calls fall back to the legacy global UAV barrier.
- Map D3D12_BARRIER_LAYOUT 0..=31 including 0x1F (DIRECT_QUEUE_GENERIC_READ_COMPUTE_QUEUE_ACCESSIBLE) and fall back to access bits for console-only layouts > 0x1F; align device #127/#133 initial layout states with texture-vs-buffer awareness.
- Track whole-resource states across #127/#133 creation, legacy #26, and enhanced #146 (cleared on res_release) for UNDEFINED Before layouts, forward emitted transitions to title_textures::note_transitions, emit wildcard aliasing barriers for UNDEFINED placed textures, keep non-UAV textures out of UNORDERED_ACCESS, and skip states disallowed on compute/copy lists.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:00 +00:00
Author
Owner

@⁠poucosaudavel on GitHub · 2026-11-24 11:01 UTC · original

Test report for the exact head 1ecefdda3b4627ab8160845942f27ab4e75ce0c5, since Not tested lists NVIDIA GPUs.

Tested

  • NVIDIA GeForce RTX 5060 Ti (8 GB, 32-lane waves), driver 610.88; Intel Core Ultra 7 265KF; Windows 11 (build 26200)
  • Rust 1.100.0 (stable-x86_64-pc-windows-msvc), MSVC 14.44, Windows SDK 10.0.26100, debug build
  • Clean worktrees, no local changes: the PR head, and its merge base on main (6efdabcdaac93ce5cc123a85e85deba5d49cb294) as the baseline
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4:
    • PR head: 741 passed, 0 failed, 41 ignored
    • merge base: 727 passed, 0 failed, 41 ignored
  • The 14 extra passes are the new hle::d3d12x::enhanced_barrier::tests::*; no test present on the base is missing or failing on the PR.
  • enhanced_barriers_move_a_render_target_on_the_gpu ran on the NVIDIA adapter (the log shows backend real on the RTX 5060 Ti) and passed.
  • SKIPPED on both, same reason: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask and gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested

  • No scripts/smoke.ps1 regression run on a retail title: this covers the test suite only.
  • Release build of the PR head; AMD, Intel; Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.
**@⁠poucosaudavel** on GitHub · 2026-11-24 11:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1025#issuecomment-7129555142) Test report for the exact head `1ecefdda3b4627ab8160845942f27ab4e75ce0c5`, since **Not tested** lists NVIDIA GPUs. **Tested** - NVIDIA GeForce RTX 5060 Ti (8 GB, 32-lane waves), driver 610.88; Intel Core Ultra 7 265KF; Windows 11 (build 26200) - Rust 1.100.0 (stable-x86_64-pc-windows-msvc), MSVC 14.44, Windows SDK 10.0.26100, debug build - Clean worktrees, no local changes: the PR head, and its merge base on `main` (`6efdabcdaac93ce5cc123a85e85deba5d49cb294`) as the baseline - `cargo build --workspace`, then `cargo test --workspace -- --test-threads=4`: - PR head: 741 passed, 0 failed, 41 ignored - merge base: 727 passed, 0 failed, 41 ignored - The 14 extra passes are the new `hle::d3d12x::enhanced_barrier::tests::*`; no test present on the base is missing or failing on the PR. - `enhanced_barriers_move_a_render_target_on_the_gpu` ran on the NVIDIA adapter (the log shows backend `real` on the RTX 5060 Ti) and passed. - SKIPPED on both, same reason: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (no wave64) **Not tested** - No `scripts/smoke.ps1` regression run on a retail title: this covers the test suite only. - Release build of the PR head; AMD, Intel; Linux / Wine. **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 11:21 UTC · original

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti + Radeon iGPU; Rust stable MSVC, debug.

  • cargo test -p xcl --lib enhanced: 14 passed, 0 failed — all enhanced_barrier::tests, including the GPU test enhanced_barriers_move_a_render_target_on_the_gpu (ran on the default adapter, RTX 3060 Ti).

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 11:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1025#issuecomment-7130000957) Independent verification, merged onto current `main` `384f7f7` locally (clean merge). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti + Radeon iGPU; Rust stable MSVC, debug. - `cargo test -p xcl --lib enhanced`: **14 passed, 0 failed** — all `enhanced_barrier::tests`, including the GPU test `enhanced_barriers_move_a_render_target_on_the_gpu` (ran on the default adapter, RTX 3060 Ti). AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠IvyNotFound on GitHub · 2026-11-24 14:30 UTC · original

Retail run into world loading on an RTX 5080: 1ecefdd merged onto main 930e8b4 – no crash or device removal, the barriers are translated, the frames after loading stay black as on main, and the #505 GPU-wait stalls come at least as often

Tested

  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24; Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17.
  • main 930e8b4 + this PR's head 1ecefdd (clean merge, local commit bbace0e).
  • cargo test -p xcl --lib enhanced (debug): 14 passed, 0 failed (the GPU test ran on the RTX 5080).
  • Retail title of #505, release, scripts/smoke.ps1 -Seconds 140, XCL_PRESS_A_AT=15, XCL_PSO_WAIT_MS=50 (so it gets past the first ListX #101 into world loading), XCL_FRAME_DUMP=2. Two runs of the PR, compared with one of main with the same settings.
main 930e8b4 PR, run 1 PR, run 2
exit / device removals / crashes 0x0 / 0 / 0 0x0 / 0 / 0 0x0 / 0 / 0
frames shown 1434 1392 1395
peak commit 33 004 MB 37 236 MB 41 830 MB
GPU queue.Wait … did not complete within 5000 ms 19, first at 118.6 s 27, first at 109.8 s 55, first at 120.6 s
Write64 cycle breaks 13 17 32
  • The translation is active from the title's first barriers: Barrier: 1 groups, 2 barriers (2 texture) → 2 legacy barriers at 3.1 s.
  • From ~68–92 s, on compute lists: Barrier: N transitions a list of type 2 cannot make – left out (N = 1, 4, 7).
  • The frames the title presents after loading are the loading screen fading, then all black (mean 0.0 / 255), as on main (#505).
  • More stalls and a higher peak commit in both runs than in the main run. My earlier main runs of the same title reached up to 43 GB peak commit and 13–34 timeouts (https://github.com/ivall/xcl/issues/505#issuecomment-7130913073), so two runs do not show that this PR causes it. Run 2's peak is 127 % of this main run's.

Not tested

  • the whole suite at this merge
  • whether the left-out compute-list transitions matter (they are skipped by design here)

Note for whoever merges: #1063 (mine, stacked on #1027) also acts on this slot's calls, in list_x::uav_barrier_x. It adds depth ↔ twin copies after the global UAV barrier. With this PR the slot goes to enhanced_barrier::barrier_x instead, so whichever lands second needs the other's hook.

AI use

  • Claude Code, Claude Opus 5.5: merged and built the PR, ran the tests and the runs, read the logs and frame dumps, and wrote this report.
**@⁠IvyNotFound** on GitHub · 2026-11-24 14:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1025#issuecomment-7134498498) **Retail run into world loading on an RTX 5080: `1ecefdd` merged onto `main` `930e8b4` – no crash or device removal, the barriers are translated, the frames after loading stay black as on `main`, and the #505 GPU-wait stalls come at least as often** **Tested** - NVIDIA GeForce RTX 5080 16 GB, driver 621.24; Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17. - `main` `930e8b4` + this PR's head `1ecefdd` (clean merge, local commit `bbace0e`). - `cargo test -p xcl --lib enhanced` (debug): 14 passed, 0 failed (the GPU test ran on the RTX 5080). - Retail title of #505, release, `scripts/smoke.ps1 -Seconds 140`, `XCL_PRESS_A_AT=15`, `XCL_PSO_WAIT_MS=50` (so it gets past the first `ListX #101` into world loading), `XCL_FRAME_DUMP=2`. Two runs of the PR, compared with one of `main` with the same settings. | | `main` `930e8b4` | PR, run 1 | PR, run 2 | |---|---|---|---| | exit / device removals / crashes | 0x0 / 0 / 0 | 0x0 / 0 / 0 | 0x0 / 0 / 0 | | frames shown | 1434 | 1392 | 1395 | | peak commit | 33 004 MB | 37 236 MB | 41 830 MB | | `GPU queue.Wait … did not complete within 5000 ms` | 19, first at 118.6 s | 27, first at 109.8 s | 55, first at 120.6 s | | Write64 cycle breaks | 13 | 17 | 32 | - The translation is active from the title's first barriers: `Barrier: 1 groups, 2 barriers (2 texture) → 2 legacy barriers` at 3.1 s. - From ~68–92 s, on compute lists: `Barrier: N transitions a list of type 2 cannot make – left out` (N = 1, 4, 7). - The frames the title presents after loading are the loading screen fading, then all black (mean 0.0 / 255), as on `main` (#505). - More stalls and a higher peak commit in both runs than in the `main` run. My earlier `main` runs of the same title reached up to 43 GB peak commit and 13–34 timeouts (https://github.com/ivall/xcl/issues/505#issuecomment-7130913073), so two runs do not show that this PR causes it. Run 2's peak is 127 % of this `main` run's. **Not tested** - the whole suite at this merge - whether the left-out compute-list transitions matter (they are skipped by design here) Note for whoever merges: #1063 (mine, stacked on #1027) also acts on this slot's calls, in `list_x::uav_barrier_x`. It adds depth ↔ twin copies after the global UAV barrier. With this PR the slot goes to `enhanced_barrier::barrier_x` instead, so whichever lands second needs the other's hook. **AI use** - Claude Code, Claude Opus 5.5: merged and built the PR, ran the tests and the runs, read the logs and frame dumps, and wrote this report.
Author
Owner

@⁠deepdev237 on GitHub · 2026-11-24 14:46 UTC · original

Parser observation from a retail run on AMD RDNA4

Tested

  • AMD Radeon RX 9060 XT (RDNA4, driver 32.0.32015.7029), Ryzen 9 5950X, Windows 11 build 26300, Rust 1.100.0 MSVC, release.
  • A local diagnostic based on 930e8b49c1c2ec683d22c724a398b39111cd0e56 (Git tree 391b7fe28b4f99bce3d9183b99f794f50e592f1c) reused the slot #146 parser from 1ecefdda3b4627ab8160845942f27ab4e75ce0c5. It retained the existing PC global UAV barrier forwarding.
  • xcl.exe run "<retail-title>" with XCL_NETWORK=0, XCL_DRED=1, XCL_PSO_WAIT_MS=50 and XCL_TRACE_INDIRECT_BARRIERS=1: all 80 traced indirect calls matched slot #146 BUFFER records on the same resource, with whole-buffer access 0x10 → 0x290 before and 0x200 → 0x10 afterward.
  • At 248.285 s DRED reported DXGI_ERROR_DEVICE_HUNG. The only started, unfinished list was 11 of 17 operations complete, with EXECUTEINDIRECT next and no usable page-fault address.

Not tested — The full #1025 head or its native barrier translation. These are the title's declared access masks. The diagnostic did not read back the dispatch arguments from the GPU.

AI use — OpenAI Codex (gpt-6.2-sol) ran the tests, checked the local receipts and wrote this report.

**@⁠deepdev237** on GitHub · 2026-11-24 14:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/1025#issuecomment-7134912952) **Parser observation from a retail run on AMD RDNA4** **Tested** - AMD Radeon RX 9060 XT (RDNA4, driver `32.0.32015.7029`), Ryzen 9 5950X, Windows 11 build 26300, Rust 1.100.0 MSVC, release. - A local diagnostic based on `930e8b49c1c2ec683d22c724a398b39111cd0e56` (Git tree `391b7fe28b4f99bce3d9183b99f794f50e592f1c`) reused the slot #146 parser from `1ecefdda3b4627ab8160845942f27ab4e75ce0c5`. It retained the existing PC global UAV barrier forwarding. - `xcl.exe run "<retail-title>"` with `XCL_NETWORK=0`, `XCL_DRED=1`, `XCL_PSO_WAIT_MS=50` and `XCL_TRACE_INDIRECT_BARRIERS=1`: all **80** traced indirect calls matched slot #146 BUFFER records on the same resource, with whole-buffer access `0x10 → 0x290` before and `0x200 → 0x10` afterward. - At 248.285 s DRED reported `DXGI_ERROR_DEVICE_HUNG`. The only started, unfinished list was 11 of 17 operations complete, with `EXECUTEINDIRECT` next and no usable page-fault address. **Not tested** — The full #1025 head or its native barrier translation. These are the title's declared access masks. The diagnostic did not read back the dispatch arguments from the GPU. **AI use** — OpenAI Codex (`gpt-6.2-sol`) ran the tests, checked the local receipts and wrote this report.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1025/head:github-bot/gh-1025'
git switch 'github-bot/gh-1025'

Merge

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