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

Closed
github-bot wants to merge 1 commit from gh-pr/1021/head into gh-pr/1021/base
Owner

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

Part of #970: diagnostics only, the first of the four steps planned there.

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 with XCL_SAMPLE_RPF, _DLLS, _TTPF, _BVH4 set, at 65eb999 (the same tree as the head ba8d356, whose only change is the commit message): 718 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. An earlier run of the same tree had the #718 flake (placed_title_textures_share_vram_and_preserve_pixels, cubemap extra_pages must be reused at same va, and the two PoisonError failures after it): 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), 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: 09940bb87fa11bc394fd9e5de570c2b7cfd16323
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1271 (PresentX 1271)
presents per 2 s (last 3): 11 10 14
device removals: 0
crashes: 0
peak commit: 27340 MB

this PR:

xcl-smoke v1
commit: ba8d356037b926c6768dd6f956895657d4a101a3
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1296 (PresentX 1297)
presents per 2 s (last 3): 10 25 25
device removals: 0
crashes: 0
peak commit: 27852 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:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1021) `depth-uav-diagnostics` → `main` · +131 −4 · 3 files · 1 commits · closed without merging Part of #970: diagnostics only, the first of the four steps planned there. 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` with `XCL_SAMPLE_RPF`, `_DLLS`, `_TTPF`, `_BVH4` set, at `65eb999` (the same tree as the head `ba8d356`, whose only change is the commit message): **718 passed, 0 failed, 41 ignored**; `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. An earlier run of the same tree had the #718 flake (`placed_title_textures_share_vram_and_preserve_pixels`, `cubemap extra_pages must be reused at same va`, and the two `PoisonError` failures after it): 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), 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: 09940bb87fa11bc394fd9e5de570c2b7cfd16323 gpu: NVIDIA GeForce RTX 5080 title: game seconds: 60 exit: 0x0 frames shown: 1271 (PresentX 1271) presents per 2 s (last 3): 11 10 14 device removals: 0 crashes: 0 peak commit: 27340 MB ``` this PR: ``` xcl-smoke v1 commit: ba8d356037b926c6768dd6f956895657d4a101a3 gpu: NVIDIA GeForce RTX 5080 title: game seconds: 60 exit: 0x0 frames shown: 1296 (PresentX 1297) presents per 2 s (last 3): 10 25 25 device removals: 0 crashes: 0 peak commit: 27852 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:40:50 +00:00
github-bot closed this pull request 2026-11-26 04:40:50 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.