Repository navigation
Description
Depth buffers the console creates with ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS lose ALLOW_UNORDERED_ACCESS on the PC (device_x::pc_resource_desc, the PC refuses the pair), and every UAV of them is a null view (real::dev_create_uav_x, "a UAV of a resource that cannot have one on the PC (a depth buffer) – a null view"). That came in with the #163 chain, to stop a device removal: per its comments the removal happened "once a dispatch used it", so the title does write these resources from shaders. Translated shaders reach an image's UAV through ResourceDescriptorHeap[… + 1] (gpu/recomp/emit.rs), so with a null view those writes are dropped and reads return 0.
What the retail title of #505 creates (main 09940bb, temporary logging in both places, not committed; 80 s run, XCL_NETWORK=0, XCL_PRESS_A_AT=15; RTX 5080, driver 621.24, Windows 11 25H2, release)
- 315 depth + UAV resource descriptions converted by
pc_resource_descand 316 null UAVs, all between 8.9 and 11.3 s (menus). The UAVs by resource and view:
| PC resource (w × h × array, format) | UAV view (format, dimension) | count |
|---|---|---|
| 128 × 128 × 6, R16_TYPELESS | R16_UNORM, Texture2DArray | 76 |
| 256 × 256 × 3, R16_TYPELESS | R16_UNORM, Texture2DArray | 76 |
| 512 × 512 × 1, R16_TYPELESS | R16_UNORM, Texture2D | 76 |
| 1024 × 1024 × 1 / 256 × 256 × 6 / 512 × 512 × 3, R16_TYPELESS | R16_UNORM | 24 each |
| 1024 × 1024 × 3 / 2048 × 2048 × 1 / 768 × 768 × 6, R16_TYPELESS | R16_UNORM | 4 each |
| 2560 × 1440, R32G8X24_TYPELESS | R32_FLOAT_X8X24_TYPELESS, Texture2D | 2 |
| 2560 × 1440, R24G8_TYPELESS | R24_UNORM_X8_TYPELESS / X24_TYPELESS_G8_UINT | 1 + 1 |
- So 312 of them look like shadow maps (D16 cubes of 6, cascades of 3, single maps), plus the full-screen depth buffers and their stencil plane. These UAVs are made in console heap slots, so their PC views go to the shared heap the translated shaders read. (Corrected: an earlier version said they were outside the console heaps – my logging looked up the slot by the PC handle, not the console one.)
- Not known yet: which dispatches write them, and what a player would see. On this machine the title does not get past world loading (Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505), so I have not seen it in game.
Plan (to avoid duplicate work; I'd do it in this order, each its own PR)
- Diagnostics only: count the dispatches and the barriers to / from
UNORDERED_ACCESSthat reach a resource whose UAV was made null, so the effect can be measured before anything changes. - Behind a switch, not on by default: give such a resource a twin of the same typeless format without
ALLOW_DEPTH_STENCILand withALLOW_UNORDERED_ACCESS; its UAVs point at the twin; the title's barriers intoUNORDERED_ACCESScopy depth → twin and its barriers out of it copy twin → depth. GPU tests: a compute write through the UAV is seen by a later depth test and by an SRV read. - Turn it on (memory: the twins double these resources' size; I would measure the peak commit on the smoke run).
- README, if it changes what works.
Questions before I start: is the twin-and-copy approach acceptable, or is there a reason #163 stopped at a null view other than avoiding the removal? And is anyone already on this?
AI use: Claude Code, Claude Opus 5.5: found the warning in the smoke runs, added the temporary logging, ran it and wrote this issue. The numbers come from that run.
Activity
D3D12.X: depth buffers that shaders write get a twin for their UAVs (x…
D3D12.X: count the barriers that use a depth buffer as a UAV (ivall#970)
D3D12.X: count the barriers that use a depth buffer as a UAV (xcl-dev…
D3D12.X: depth buffers that shaders write get a twin for their UAVs (x…
D3D12.X: count the barriers that use a depth buffer as a UAV (xcl-dev…
D3D12.X: depth buffers that shaders write get a twin for their UAVs (x…