D3D12.X: count the barriers that use a depth buffer as a UAV (#970) #1027

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

@⁠IvyNotFound on GitHub · 2026-11-24 10:30 UTC · original
IvyNotFound:depth-uav-diagnostics → main · +131 −4 · 3 files · 1 commits · open

Part of #970: diagnostics only, the first of the four steps planned there. Replaces #1021, closed when its fork was deleted (same commit).

A console depth buffer that shaders write too has no ALLOW_UNORDERED_ACCESS on the PC (device_x::pc_resource_desc drops it) and its UAVs are null views (real::dev_create_uav_x), so what shaders write through them is lost. This counts and logs the title's barriers that use such a resource as a UAV, so the effect can be measured before anything changes. No behaviour change: every barrier still goes to the PC as before.

On the retail title of #505 no legacy barrier touches these resources: its texture transitions come through #146 (enhanced barriers, D3D12_BARRIER_GROUP), whose description XCL does not read (it emits one global UAV barrier – HANDOFF lists the #146 description as "not yet"). There, D16 shadow maps (768x768x6, 1024x1024, 512x512) go into or out of the UNORDERED_ACCESS layout once the world starts loading (62–64 s; 12 barriers in a run with every one logged).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: depth_without_uav (ALLOW_DEPTH_STENCIL without ALLOW_UNORDERED_ACCESS) and note_depth_uav_barrier (counted; the first 8 and every power of two logged), called for transitions from / to UNORDERED_ACCESS and UAV barriers naming the resource in resource_barrier_x; note_depth_uav_barrier_groups reads the texture barriers of #146 (uav_barrier_x) and counts those with the UNORDERED_ACCESS layout or access (barrier_uses_uav). Tests: a_depth_buffer_without_unordered_access_is_one_with_null_uavs, an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use.
  • crates/xcl/src/hle/d3d12x/console_list.rs: the same for console-recorded lists (their replayed transitions and their #146 calls).
  • crates/xcl/src/hle/d3d12x/real.rs: the null-view warning gives its total instead of stopping at 4.

Tested

  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124); AMD Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17; tests in debug, runs in release
  • cargo test --workspace --no-fail-fast -- --test-threads=4 at d9d11f5 (rebased onto main b7aa9f3) with XCL_SAMPLE_RPF, _DLLS, _TTPF, _BVH4, _BK2, _AWC set: 772 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. Before the rebases, one run of the same change had the #718 flake (715 passed, 3 failed).
  • The retail title of #505, scripts/smoke.ps1, XCL_PRESS_A_AT=15: the regression runs below (60 s, menus and the start of world loading; main b7aa9f3 and this head d9d11f5, after the rebase), and a 300 s run of this branch for the numbers above (it ends in the title's "GPU Loc Sig" abort at ~92 s, as main does).

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1375 (PresentX 1375)
presents per 2 s (last 3): 36 53 51
device removals: 0
crashes: 0
peak commit: 26063 MB

this PR:

xcl-smoke v1
commit: d9d11f5b93003ea6a0c7f2b67c81ab3c83024ec4
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1357 (PresentX 1357)
presents per 2 s (last 3): 18 45 52
device removals: 0
crashes: 0
peak commit: 26140 MB

Not tested

  • AMD and other NVIDIA GPUs; Series S mode
  • what the lost writes change on screen: on this machine the title does not get past world loading (#505)
  • console code that records barriers in ways other than #26 / #146

AI use

  • Claude Code, Claude Opus 5.5: found the null views in the smoke runs, wrote the code, the tests and this description, and ran the tests and the runs above.

🤖 Generated with Claude Code

**@⁠IvyNotFound** on GitHub · 2026-11-24 10:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1027) `IvyNotFound:depth-uav-diagnostics` → `main` · +131 −4 · 3 files · 1 commits · open Part of #970: diagnostics only, the first of the four steps planned there. Replaces #1021, closed when its fork was deleted (same commit). A console depth buffer that shaders write too has no `ALLOW_UNORDERED_ACCESS` on the PC (`device_x::pc_resource_desc` drops it) and its UAVs are null views (`real::dev_create_uav_x`), so what shaders write through them is lost. This counts and logs the title's barriers that use such a resource as a UAV, so the effect can be measured before anything changes. No behaviour change: every barrier still goes to the PC as before. On the retail title of #505 no legacy barrier touches these resources: its texture transitions come through #146 (enhanced barriers, `D3D12_BARRIER_GROUP`), whose description XCL does not read (it emits one global UAV barrier – HANDOFF lists the #146 description as "not yet"). There, D16 shadow maps (768x768x6, 1024x1024, 512x512) go into or out of the `UNORDERED_ACCESS` layout once the world starts loading (62–64 s; 12 barriers in a run with every one logged). **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `depth_without_uav` (ALLOW_DEPTH_STENCIL without ALLOW_UNORDERED_ACCESS) and `note_depth_uav_barrier` (counted; the first 8 and every power of two logged), called for transitions from / to `UNORDERED_ACCESS` and UAV barriers naming the resource in `resource_barrier_x`; `note_depth_uav_barrier_groups` reads the texture barriers of #146 (`uav_barrier_x`) and counts those with the `UNORDERED_ACCESS` layout or access (`barrier_uses_uav`). Tests: `a_depth_buffer_without_unordered_access_is_one_with_null_uavs`, `an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use`. - `crates/xcl/src/hle/d3d12x/console_list.rs`: the same for console-recorded lists (their replayed transitions and their #146 calls). - `crates/xcl/src/hle/d3d12x/real.rs`: the null-view warning gives its total instead of stopping at 4. **Tested** - NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124); AMD Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17; tests in debug, runs in release - `cargo test --workspace --no-fail-fast -- --test-threads=4` at `d9d11f5` (rebased onto `main` `b7aa9f3`) with `XCL_SAMPLE_RPF`, `_DLLS`, `_TTPF`, `_BVH4`, `_BK2`, `_AWC` set: **772 passed, 0 failed, 41 ignored**; `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. Before the rebases, one run of the same change had the #718 flake (715 passed, 3 failed). - The retail title of #505, `scripts/smoke.ps1`, `XCL_PRESS_A_AT=15`: the regression runs below (60 s, menus and the start of world loading; `main` `b7aa9f3` and this head `d9d11f5`, after the rebase), and a 300 s run of this branch for the numbers above (it ends in the title's "GPU Loc Sig" abort at ~92 s, as `main` does). **Regression run** main: ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 5080 title: game seconds: 60 exit: 0x0 frames shown: 1375 (PresentX 1375) presents per 2 s (last 3): 36 53 51 device removals: 0 crashes: 0 peak commit: 26063 MB ``` this PR: ``` xcl-smoke v1 commit: d9d11f5b93003ea6a0c7f2b67c81ab3c83024ec4 gpu: NVIDIA GeForce RTX 5080 title: game seconds: 60 exit: 0x0 frames shown: 1357 (PresentX 1357) presents per 2 s (last 3): 18 45 52 device removals: 0 crashes: 0 peak commit: 26140 MB ``` **Not tested** - AMD and other NVIDIA GPUs; Series S mode - what the lost writes change on screen: on this machine the title does not get past world loading (#505) - console code that records barriers in ways other than #26 / #146 **AI use** - Claude Code, Claude Opus 5.5: found the null views in the smoke runs, wrote the code, the tests and this description, and ran the tests and the runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A console depth buffer that shaders write too has no ALLOW_UNORDERED_ACCESS
on the PC (pc_resource_desc drops it) and its UAVs are null views, so the
writes are lost. The title's barriers that use such a resource as a UAV are
now counted and logged (the first 8, then every power of two):
- transitions from or to UNORDERED_ACCESS and UAV barriers naming it, both
  for PC-format lists (resource_barrier_x) and console-recorded ones
  (console_list replay);
- enhanced texture barriers (#146, D3D12_BARRIER_GROUP) with the
  UNORDERED_ACCESS layout or access. XCL still turns #146 into one global
  UAV barrier; only the description is read here.
The null-view warning gives its total instead of stopping at 4.

Measured on the retail title of #505 (RTX 5080, 300 s runs, A at 15 s):
no legacy barrier touches these resources; enhanced barriers move D16
shadow maps (768x768x6, 1024x1024, 512x512) into or out of the
UNORDERED_ACCESS layout once the world starts loading (62-64 s; 12 in a
run with every one logged).

No behaviour change: every barrier goes to the PC as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:03 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 11:19 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 -- barrier uav depth: 15 passed, 0 failed — includes the new an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use and a_depth_buffer_without_unordered_access_is_one_with_null_uavs.

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

**@⁠DavidM1911** on GitHub · 2026-11-24 11:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1027#issuecomment-7129957942) 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 -- barrier uav depth`: **15 passed, 0 failed** — includes the new `an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use` and `a_depth_buffer_without_unordered_access_is_one_with_null_uavs`. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 05:31 UTC · original

Empirical test report (d9d11f5b)

Hardware / environment

  • Windows x64, build 26200. CPU identifier: AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD. The two fixtures ran without a GPU or D3D12 device, with XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1.
  • Rust 1.100.0 (0ef1bc386 2026-11-09) and DXC 1.9.2609.5 (01b62ad47). Cargo test profile with debug info and incremental compilation disabled.

Commands and results

  • Head d9d11f5b93003ea6a0c7f2b67c81ab3c83024ec4 for PR #1027.
  • cargo test --workspace --no-run exited 0 and compiled the workspace test targets.
  • cargo test -p xcl --lib -- --exact hle::d3d12x::list_x::tests::a_depth_buffer_without_unordered_access_is_one_with_null_uavs hle::d3d12x::list_x::tests::an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use
  • Focused run: 2 passed, 0 failed, 0 ignored, 0 SKIPPED lines. The counts come from the case-sensitive Rust test summaries and SKIPPED line markers in the captured output.

Observed behavior

  • The resource flag fixture identified depth resources without unordered access and rejected the flag combinations for plain UAVs, render targets with UAVs, and depth resources with unordered access. It also checked the flags produced by pc_resource_desc for a console depth texture with unordered access.
  • The enhanced-barrier fixture recognized transitions into and out of unordered access and an access-bit-only case. Its negative cases included depth-write and shader-resource transitions, no-access transitions, and render-target access.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The fixtures cover CPU-side flag and barrier classification. Live barrier counting, warning cadence, and dispatch to a D3D12 device were outside the focused run.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1027-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1027#issuecomment-7153859779) ### Empirical test report (d9d11f5b) **Hardware / environment** - Windows x64, build 26200. CPU identifier: AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD. The two fixtures ran without a GPU or D3D12 device, with `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`. - Rust `1.100.0 (0ef1bc386 2026-11-09)` and DXC `1.9.2609.5 (01b62ad47)`. Cargo test profile with debug info and incremental compilation disabled. **Commands and results** - Head `d9d11f5b93003ea6a0c7f2b67c81ab3c83024ec4` for PR #1027. - `cargo test --workspace --no-run` exited 0 and compiled the workspace test targets. - `cargo test -p xcl --lib -- --exact hle::d3d12x::list_x::tests::a_depth_buffer_without_unordered_access_is_one_with_null_uavs hle::d3d12x::list_x::tests::an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use` - Focused run: 2 passed, 0 failed, 0 ignored, 0 `SKIPPED` lines. The counts come from the case-sensitive Rust test summaries and `SKIPPED ` line markers in the captured output. **Observed behavior** - The resource flag fixture identified depth resources without unordered access and rejected the flag combinations for plain UAVs, render targets with UAVs, and depth resources with unordered access. It also checked the flags produced by `pc_resource_desc` for a console depth texture with unordered access. - The enhanced-barrier fixture recognized transitions into and out of unordered access and an access-bit-only case. Its negative cases included depth-write and shader-resource transitions, no-access transitions, and render-target access. **Not tested** The full GPU workspace suite and game smoke runs were omitted. The fixtures cover CPU-side flag and barrier classification. Live barrier counting, warning cadence, and dispatch to a D3D12 device were outside the focused run. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1027-focused.log` and published.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 19:22 UTC · original

NVIDIA test report for d9d11f5 (head as is, base b7aa9f3), for #1607's "one more test report" list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after cargo build --workspace:

  • cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 763 passed, 0 failed, 41 ignored. The end-to-end title tests pass.
  • main at 0829441 (not current main) on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).
  • Skipped hle::xaudio2, because its tests fail or hang on this machine on main too. The PR doesn't touch it.
  • SKIPPED lines: 2, both no wave64 on this card.

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.

**@⁠upipibi** on GitHub · 2026-11-25 19:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1027#issuecomment-7172202906) NVIDIA test report for `d9d11f5` (head as is, base `b7aa9f3`), for #1607's "one more test report" list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after `cargo build --workspace`: - `cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2`: **763 passed, 0 failed, 41 ignored**. The end-to-end title tests pass. - `main` at `0829441` (not current `main`) on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests). - Skipped `hle::xaudio2`, because its tests fail or hang on this machine on `main` too. The PR doesn't touch it. - SKIPPED lines: 2, both `no wave64` on this card. AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
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/1027/head:github-bot/gh-1027'
git switch 'github-bot/gh-1027'

Merge

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