D3D12.X: a console depth buffer that is also a UAV gets a null UAV – shader writes to the retail title's shadow maps are dropped #970
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#970
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@IvyNotFound on GitHub · 2026-11-24 09:43 UTC · original
Depth buffers the console creates with
ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESSloseALLOW_UNORDERED_ACCESSon 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 throughResourceDescriptorHeap[… + 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)pc_resource_descand 316 null UAVs, all between 8.9 and 11.3 s (menus). The UAVs by resource and view:Plan (to avoid duplicate work; I'd do it in this order, each its own PR)
UNORDERED_ACCESSthat reach a resource whose UAV was made null, so the effect can be measured before anything changes.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.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.
@CharlyRien on GitHub · 2026-11-25 09:45 UTC · original
The two things this issue lists as not known, measured in the retail title's world on an RTX 3090: which shader writes one of these depth + UAV targets, and what the player sees. The scene's whole lighting pass is rejected, which is the flat grey frame behind the HUD once geometry is there. A test of #1989 on it is below.
Setup
main689f2dbmerged locally with #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640 (ported), #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits fromwondercrash/xcl, then #541, #2092's3442b58state, #1887 and #1803; local changes: heap addresses to the two-pass compute pass, readable copies of the buffers the title places in the GPU view of its 24 GB reservation (see #697: without them nothing is rasterised at all), a per-queue readback insparse.rs, and logging. For part 3, #1989 (197b104) merged into that tree three-way: 9 conflicts, all resolved by keeping both sides.XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250, a reducedXCL_PAGE_BUDGET_MB(2048 – 4096) to fit in memory, warm caches; the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver. Dumps taken on frames after the title's intro text card has gone (about 20 s into the world).1. What uses the 2560 × 1440 R24G8 target (the "1 + 1" row of the table above)
z = permutation / 65535, and the pipeline tests depth with EQUAL, depth write off, against a second depth target: this 2560 × 1440 D24S8 one.R24_UNORM_X8_TYPELESS) and the stencil plane (X24_TYPELESS_G8_UINT). Both are the null views ofdev_create_uav_x.2. It is not the only thing missing: with the depth test of these draws forced off locally the HDR target is still 55 – 87 % zero with tiny values. Other inputs of the lighting pixel shader are empty too (two 2560 × 1440
R9G9B9E5textures, a full-screen R8 mask, several small maps). Not traced yet.3. #1989 on this case (as it is, plus one local switch for the second half)
on_uav_barrier/filter_transition), and this title uses enhanced barriers (list #146), for which a global UAV barrier is emitted. Nothing is ever dirty, sobefore_bind_dsvnever copies twin → depth.R24_UNORMplane, is not what the title wrote, or something overwrites it later in the frame. Not settled.Not tested: #1989 on its own base; the stencil plane; AMD; current
main.AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the probes, the merge and the runs) did this and drafted the comment.