D3D12.X: the depth plane of an R24G8 buffer has a twin, drawn into the plane before its DSV is bound #3089
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3089"
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?
Imported from ivall/xcl. Originally posted by imnicho on 2026-11-28T03:26:07Z.
With
XCL_DEPTH_UAV_TWIN_R24=1, the depth twins reach the depth target a retail title's lighting draws test (#970): the depth plane of an R24G8 buffer gets a twin the title's compute program can write, and the twin is drawn into the plane before the buffer's DSV is bound. The default is unchanged (off).Rebased onto
mainand merged with #3290 there, with what the reviews asked for. Three commits onmain493dbd3dd: the merge, and what two reviews of it (as8de5808d8ande228ed5da) asked for; the head isa9aa32db5. The old head3b12e0b25(onnvidia-dev) is what the reports below from before 1 December tested.This is not a second twin implementation.
mainhas depth UAV twins (hle/d3d12x/depth_uav.rs, on by default since #3290). This PR adds, inside that module, the one case it still turns away: the depth plane of an R24G8 buffer, which is the buffer the title's lighting uses. Nothing of the existing twins is replaced, and this one has a switch of its own because the others are on by default now.Plan comment: https://github.com/xcl-dev/xcl/issues/970#issuecomment-7230710025
What is in it
On
maina UAV of the depth plane of an R24G8 buffer is still a null view ("its depth plane has no twin yet"), and the twins the module makes are copied around the title's transitions into and out of UNORDERED_ACCESS. The title's target is a consoleD16_UNORM_S8_UINT(console format 118), R24G8 on the PC, and the title keeps it in a depth state while its compute program writes it (@CharlyRien measured that onmainwith #3287's transitions: the planes are in DEPTH_WRITE or in read states at the bind, never in UNORDERED_ACCESS). So there is no transition to hang a copy on, and a D3D12 copy cannot put a colour texture into a 24-bit plane anyway.In that module, behind
XCL_DEPTH_UAV_TWIN_R24=1:resolve_uavmakes the UAV a view of it.before_dsv_bind, called fromcl_om_set_render_targets, records a pass of XCL's own that writesSV_Depthfrom the twin into every level and slice of the plane, before the title's bind of a DSV of the buffer. It is left out when this recording of the list already drew the twin into the plane of the same object and no dispatch was recorded and no clear of the twin made since (bind::activity): then nothing wrote the twin.count * (1.0f / 65535), the float0x37800080. That is the product the title's vertex shader makes for the draw that tests the plane with EQUAL. Read as R16_UNORM the same texel can come out one unit in the last place off, which in 24 bits is another value for some counts.list_x::depth_only_pass); view heaps, topology, viewports, scissors, blend factor, stencil reference, vertex buffers, render targets and the pipeline the title had set are set again after it.plan_with, with #3290'sPARKwhere the title has the buffer in UNORDERED_ACCESS. The pass moves the depth plane to DEPTH_WRITE and back where the title has it elsewhere, and is left out (a line says so) after a transition of part of that plane. It does not move the stencil plane: its DSV names that plane read only where the title has it in DEPTH_READ.After the reviews:
A clear of the twin makes the next bind draw it again:
ClearUnorderedAccessView*writes the twin andbind::activitydoes not count it (@thehollowedone's first point, with the candidate from that comment).The pass's views live as long as a recorded list can name them. They are kept one set an object of the buffer, not one a buffer, and the object itself keeps their two descriptor heaps (private data of the PC's object, past XCL's hook) until the PC destroys it. XCL puts that off until the queues are past the work in flight, so a bind of another object of the buffer, or the title's release, no longer frees a heap a recorded pass names (@thehollowedone's second point; the candidate from that comment without the twin, whose own release is put off the same way).
The pass's pipelines are made on a thread of their own, where the twin is made (a title makes that UAV at load), not on the recording thread at the first bind. A bind that comes before they are ready is left out with a line, before the buffer is marked drawn, so the next one draws (@CharlyRien, who saw that first bind wait over 30 s in the driver on a PC short of memory, until the title's watchdog ended it).
What spares a pass is the recording's own. The note that a twin was drawn was the buffer's, set while recording, so a recording that was reset and never submitted spared the next one its pass, and a pass for one object of a buffer spared another's. It is now kept with the list's live recording and the object (
list_x::plane_drawn), next todepth_in_stepand cleared where that is: at a Reset and at a KickoffX (@thehollowedone, on8de5808d8).The pass runs with the title's predicate off. Its draws were recorded while a predicate the title set with SetPredicationBufferX was on, so a failing predicate left the pass undrawn while the recording noted the plane as drawn.
depth_only_passtakes the predicate off for its draws and sets it again after them from the list's own copy of the value the title's call latched (pred_buf), not from the title's memory (@thehollowedone, one228ed5da).The
SV_Depthpass and the 16-bit steps are @raylitebull's, from #1989 and its follow-up onamd-dev(3cda5bea).Size: 3 files, 575 lines of code and 463 of tests. That is more than a PR should be; about 140 lines of it are points 6 to 10.
Not in it (the module's header says so too):
SetPredication(console slot 31), which XCL passes on without following it, still decides the pass's draws.Tested
On this head (debug, RTX 5080 16 GB, driver 610.47, Windows 10 22H2):
cargo test -p xcl --lib -- --test-threads=1 depth_uav r24g8 twin: 22 passed, 0 failed, noSKIPPEDline (17 of the module, 5 on WARP in child processes; the crate's outputs cleaned first: see the note under "Not tested").cargo test -p xcl --lib -- --test-threads=1 list_x::tests predication: 105 passed, 0 failed.cargo test -p xcl --lib -- --test-threads=4gives no count on this PC: plainmain(d0832e614) ends the test process partway here. After 1,376 testsalloc_pool::tests::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_readsfails and the process stops withsparse upload preparation still failed after bounded retries – the title is stopped before its GPU submission(exit 0x80004005); one test at a time (--test-threads=1 hle::d3d12x) plainmainstops the same way insparse::tests::a_buffer_over_a_remapped_tile_reads_the_new_pageafter 739 tests. This PR's firstmain-based head stopped the same way at four threads. CI has the whole suite. (Correction: this line said before that the head was run one test at a time too. Those two runs were of plainmain's binary, not the head's: see the note under "Not tested".)New and changed tests (WARP, synthetic shaders):
gpu_a_depth_twin_is_drawn_into_the_r24g8_plane_before_its_dsv_is_bound: an R32 twin with 256 different values; after the bind hook the plane, read back, holds each within one 24-bit step. A second bind with no dispatch between records no second pass; after a clear of the twin the next bind records one again, and the one after that none; the buffer holds the pass's two heaps, and still holds them after XCL has forgotten it. Then the list is reset: the new recording's first bind draws again, with no dispatch and no clear in between.gpu_an_equal_test_at_a_counts_depth_passes_where_the_16_bit_twin_holds_the_count: a console format 118 buffer, an R16 twin holding a count for each texel, then 18 draws with the depth test EQUAL atcount * (1.0 / 65535.0)that count the stencil up. The stencil plane, read back, is 1 on exactly the texels that hold a drawn count and 0 on the others. Twelve of the counts are ones where the product and the correctly roundedcount / 65535are different floats. With the pass changed to read the twin as R16_UNORM (not in the PR) this test fails on WARP at four of them: 385, 898, 1412 and 1924.the_states_of_an_r24g8_buffers_planes_follow_the_titles_transitions, and the format cases ina_depth_view_is_a_view_of_a_twin_of_the_planes_size.In the title, on this head: not run by me (see "Not tested"). What there is:
main7a649b0ewith #3290's stencil half and other changes, the first version ported, Series X size): the class buffer's depth plane (2560x1440) goes from one value to 38 distinct ones, among them exactly the 24-bit values of the title's permutations; the bright 128-px cells of the tiled lighting go from 3 to 0 at two times in two runs; at least 512 passes on that one buffer, 0 binds left without one, no device loss in 320 s of world. (The clean window of that report was withdrawn by its author: it came from that run's set-up.)nvidia-dev), mine (RTX 5080, Series S profile, the tree of my #1989 report): without it the room after the opening cutscene stays unlit in 3 of 3 runs; with it the room is lit in 3 of 3, one of them 600 s with 679 frames after the world's set-up and 1,024 passes logged, about two a frame. A version of the pass that moved both planes to DEPTH_WRITE lost the device in 4 of 4 runs, which is why the stencil plane is not moved.Regression run
scripts/smoke.ps1, 60 s,XCL_PREPARE=0, each built in release from a clean worktree. The switch is off in these runs, as it is by default.main(d0832e614):This PR (
a9aa32db5):Three kept runs of this binary gave 1,110, 1,551 and 1,533 frames; the block is the second. The first came straight after an hour of long title runs on this PC, the other two a few minutes later. (A new binary's very first run fills its caches and is not kept, as for
main.)Not tested
nvidia-devtree, andmainbuilds every pipeline anew; the 60 s runs above do not reach the buffer. A run of mine onmainwith this head will follow as a comment.mainpass with it. A bind left out while the pipelines are being made has no test (the test waits for them).crates/xcl/tests(eachd3d12_*one takes about 9 minutes here).8de5808d8that stood here was from a build I cannot vouch for either. Every count on this page now is from a build whose log names this worktree as compiled, with the crate's outputs cleaned first.AI use
Claude Code with Claude Fable 5.2 wrote the code and the tests, ran the suite and the regression runs, and wrote this description.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T03:43:25Z.
I checked two previously untested boundaries at head
aca8939c6bafe53492a8dd4ee21e6d3c8789b795with test-only fixtures.Native precision, RTX 5070 / NVIDIA 616.92. The same instrumented binary ran the 18-draw EQUAL/stencil oracle on a 16×16 console D16S8 target in four fresh processes: the PR's R16_UINT conversion and a test-only R16_UNORM/float alternative, each on the RTX and on WARP. All 256 stencil bytes matched for both conversions on the RTX. On WARP, the PR conversion matched all 256, while the alternative had four mismatches (counts 385, 898, 1412, 1924). This independently reproduces the WARP distinction; on this RTX and sampled count set, both conversions matched. It does not establish equivalence for all counts.
Two mips, WARP + D3D12 debug layer. Distinct patterns in two mips of an R32 twin produced the expected D24 depth values, within one quantization step, for all 256 base-mip and 64 second-mip texels under each initial state: both planes
DEPTH_WRITE, the whole resourceDEPTH_READ, and only stencil mip 0DEPTH_READ. All three fresh-process runs had zero debug errors.The two-mip check covers one array slice and depth-plane readback; it does not verify stencil contents or physical GPU behavior for that case. Neither fixture is a retail title or performance test.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the fixtures; Codex reviewed and prepared this report.
Imported from ivall/xcl. Originally posted by imnicho on 2026-11-28T03:49:56Z.
CI: the "Build and test" job's 2 failures are the base's, not this PR's. The run shows 1771 passed, 2 failed, 28 ignored. The two are
texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_staysandpieces_hold_the_texels_of_their_levels("attempt to multiply with overflow" in the tests' generator), which fail the same way onnvidia-devba9d1f947without this change (run locally, in the description) and which #2771 fixes. This PR's 11 tests pass in that run.AI use: Claude Code with Claude Fable 5.2 read the CI log and wrote this.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-28T04:28:31Z.
Real-GPU counts for this PR from both Linux/Wine lanes. Heads-up first: we ran head
aca8939c(sha checked inside the run); the head has since moved to3b12e0b2, which we have not run.Hardware
Filters
depth_uav,depth_twin,r24g8, each twice per lane: default (switch off) and withXCL_DEPTH_UAV_TWIN=1:depth_uavdepth_twinr24g8That set includes the five
real::depth_uav_twin_tests::gpu_*tests, which ran against real GPUs on both lanes (GTX 1070 and Navi 31), not a software rasterizer. Zero failures anywhere, with the twin switch on or off. Nothing overlaps the three failures the author logged on lavapipe (the twotexture_uploadoverflows from #2771 and the Kickoff flake).Tested: the 24 matching tests per lane per switch setting at
aca8939c.Not tested: the new
3b12e0b2head, full suite on this head, native Windows, retail titles.AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T04:35:11Z.
Independent Windows check of #3089 head
3b12e0b: I ran the two new depth-plane GPU readback cases on both WARP and an RTX 3080 Ti (driver 621.35). Each case passed on each adapter: 4/4 focused runs, zero skips. The 16-bit case exercised the depthEQUAL/stencil readback; the other checked all 256 depth texels.For this check I made a local test-only fixture change: enable the D3D12 debug layer before creating the device, require an
ID3D12InfoQueue, select the high-performance NVIDIA adapter for the native runs, and inspect the queue after each GPU fence/readback. All four runs had zero ERROR or CORRUPTION messages, and the device stayed healthy. The published PR fixture otherwise selects WARP, so an environment switch alone would not establish native-GPU coverage. I removed the local fixture change after testing.Command for each case:
cargo test --offline --locked -j 4 -p xcl --lib <test name> -- --nocapture --test-threads=1, repeated withXCL_TEST_NATIVE_GPU=1in the temporary fixture for the RTX runs. Windows build 26300, rustc 1.99.1. I did not run the full workspace suite or a title with this switch enabled; this is focused synthetic coverage.AI use: Codex (GPT-6.2 Sol) prepared the fixture and ran these tests.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-28T06:41:01Z.
Follow-up to my earlier row on this PR: we re-ran at the new head
3b12e0b2(sha checked inside the run) on both Linux/Wine lanes with real GPUs - rig1 (RX 7900 XT, Mesa 26.2.5 RADV, wine 11.0) and rig2 (GTX 1070, nvidia 550.163.01, wine 10.0/xvfb).Same as
aca8939c: filtersdepth_uav(21 tests),depth_twin(1),r24g8(2), each withXCL_DEPTH_UAV_TWINunset and set to 1 - 24/24 green on both lanes, both switch positions, zero failures. The fivereal::depth_uav_twin_tests::gpu_*ran against actual NVIDIA and AMD hardware again.Tested: the 24 matching tests per lane per switch setting at
3b12e0b2.Not tested: full suite at this head, native Windows, retail titles.
AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T07:31:58Z.
merge-check
base:
54225f5(nvidia-dev)head:
3b12e0b259(3b12e0b)merge: clean, three files, +858/-33
Windows results.
cargo build --offline --locked -j 4 --workspacepassed on the merged tree. WithXCL_DEPTH_UAV_TWIN=1,cargo test --offline --locked -j 4 -p xcl --lib depth_uav -- --test-threads=1passed 21/21, zero skips. The unmodified merged tree'scargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4finished 1,909 passed / 4 failed / 48 ignored, with 26 explicitSKIPPEDnotices included in Cargo's passing counts. Failures wereconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk,a_held_submit_goes_on_when_the_hold_ends_and_at_once_inside_a_timed_call,a_thread_in_the_driver_is_seen_until_it_returns(all also failed in my earlier full run on this exact base), andan_address_keeps_the_page_the_title_mapped_there_last(passed a subsequent isolated 1/1 rerun). CI is green at this head; my local full suite is not.verdict: not yet
Review verdict: not yet. I found two boundaries outside the existing GPU fixtures:
ClearUnorderedAccessViewFloatof the R24 depth twin changes its contents without advancingbind::activity().1. On the same direct list, the second DSV bind therefore skips the draw. I extended the existing WARP readback fixture locally: first bind, clear the twin to 0.25, second bind, fence, read back the depth plane. The unchanged head failed 0/1 in the child process (0x0at texel 0, expected0x400000); the candidate below passed 1/1 in the child and 1/1 in the parent, with no skips. This local test-only overlay should become a separate regression so the original 256-distinct-texel fixture remains intact.before_dsv_bindreplaces the onePassViewswhen a DSV of another resource at the same cell is bound. I added a synthetic WARP ownership diagnostic: record A's pass, advance dispatch activity, record B's pass before submission, then inspect A's descriptor-heap COM reference count. On the unchanged merged head it failed 0/1 in both child and parent: 2 → 1 while A's pass was still recorded. The test holds the final reference so the measurement itself remains safe. This establishes a lifetime violation; it is not a GPU readback or a title result. D3D12 command lists do not retain referenced objects.Locally tested candidate for point 2. Keep immutable views per native destination in the cell, and attach the SRV heap, DSV heap and twin to that destination under distinct private GUIDs with
SetPrivateDataInterface. Check each result, reuse an existing destination's views, and clone the pass owner across recording.res_releasecallsforgetbefore delayed native release, so the destination attachment must outlive removal from XCL's cell map. On this candidate the same diagnostic passed 1/1 in child and parent; a further assertion after explicitforget(A)also passed while the native destination remained alive. WithXCL_DEPTH_UAV_TWIN=1,cargo test --offline --locked -j 4 -p xcl --lib depth_uav -- --test-threads=4passed 22/22, zero failures, zero ignored, zero skips. The added diagnostic uses a synthetic activity increment, not an actual dispatch. A fenced two-alias GPU readback and debug-layer check, the full suite, and paired title smoke remain to test on a production change.Local candidate diff for the alias lifetime (including test hook)
Locally verified candidate for the clear path
No paired title smoke or performance run in this check. Host: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), rustc 1.99.1; the focused depth fixture used WARP. AI use: Codex (GPT-6.2 Sol) inspected the paths, wrote and ran the local regression and candidate; Codex (GPT-6.2 Astra) independently reviewed the lifetime and state boundaries.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-28T09:09:59Z.
Test report for #3089 on NVIDIA: the whole workspace suite on this PR merged onto today's
nvidia-devand onnvidia-devalone, and the PR's own tests 3 times by name.Tested
Base:
nvidia-dev54225f5884a94cd23b7aab3f703a7c975070aa77. Head:3b12e0b2593c0a22ac1d787987686f68e54a2863.git merge --no-ffof the head onto the base: clean, no conflicts (list_x.rsauto-merged); the merge (7112ec86, local) differs from the base by 3 files, +858/-33.RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11 Pro 10.0.26100, Rust 1.100.0 MSVC, debug. Each tree in its own worktree and target dir;
XCL_DEPTH_UAV_TWINnot set.cargo build --workspaceandcargo build --workspace --tests: both exit 0 on both trees, 9 and 10 warnings, the same count as the base.cargo test --workspace --no-fail-fast -- --test-threads=4, once on each tree. On both trees thexcllibrary binary stopped partway through, before printing its result. It exited with code 130088963 (0x7C10003) afterD3D12.X: coherent window could not be restored at ... (268435456 bytes, got 0x0, Windows error 487) after CreateCommandQueue: ... (0x8007000E); stopping before guest memory is used, which auma_drivermixed-window test prints. The other 39 result lines:SKIPPEDlines;SKIPPEDlines; the same per-binary results as the merge.FAILEDlines on the merge and 5 on the base: the 4title_texturestests below on both, plushle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spareson the base only. That test passed in the base's 3 library re-runs and 3 of 3 times alone, and it passed in the merge's run.Because of that stop, the library binary was run again on each tree with the two mixed-window tests skipped:
cargo test -p xcl --lib -- --test-threads=4 --skip hle::d3d12x::uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom --skip hle::d3d12x::uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment:SKIPPEDlines;SKIPPEDlines, the same in 3 runs.hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels,…stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads,…stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload,…stream_recheck_schedule_catches_late_writes_and_resets_milestones,hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryand…gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark. Three panic on0x8007000E(E_OUTOFMEMORY) from a D3D12 call, and the other threestream_recheck_*ones on aPoisonErrorafter those panics. All 6 pass alone, one at a time, 3 of 3 times on the base.--exact --test-threads=1).The 26
SKIPPEDlines are the same on both trees: 21 "no wave64", 3 f16/f32 per-lane forms refused after #1426, 1 "no heap windows", 1 "cannot disable the driver cache".None of the 9 tests in #3093 fail here. The 5 split-wave64 tests present on
nvidia-devand the 3e2etitle tests pass on both trees;gpu_heap_flat_reads_match_guarded_and_root_outputis not innvidia-dev's test list.The PR's own tests, by exact name, 3 runs:
cargo test -p xcl --lib -- <the 7 names> --exact --test-threads=1 --nocapture. 7 passed, 0 failed, 0 ignored in each of the 3 runs, 0SKIPPEDlines:hle::d3d12x::depth_uav::tests::a_depth_uav_of_a_kept_buffer_asks_for_a_twinhle::d3d12x::depth_uav::tests::the_states_of_an_r24g8_buffers_planes_follow_the_titles_transitionshle::d3d12x::depth_uav::tests::a_depth_view_is_a_view_of_a_twin_of_the_planes_sizehle::d3d12x::real::depth_uav_twin_tests::gpu_a_depth_twin_is_drawn_into_the_r24g8_plane_before_its_dsv_is_boundhle::d3d12x::real::depth_uav_twin_tests::gpu_an_equal_test_at_a_counts_depth_passes_where_the_16_bit_twin_holds_the_counthle::d3d12x::real::depth_uav_twin_tests::gpu_a_stencil_uav_of_a_console_depth_buffer_is_a_view_of_its_twinhle::d3d12x::real::depth_uav_twin_tests::gpu_clear_uav_of_a_stencil_uav_clears_the_twinThe four
real::depth_uav_twin_tests::gpu_*tests each ran in their own child process, which printed its own 1 passed, and their fixture makes its device on WARP. So these runs do not test the twins on the RTX 3070 itself.Not tested
xcl-smokeblock: no title was run.XCL_DEPTH_UAV_TWIN=1: every run here had the switch unset.AI use: Claude Code (Claude Opus 5.5) ran the tests above on the hardware named and wrote this report.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T16:32:13Z.
Tested on the retail title, RTX 3090, Windows 11, with
XCL_DEPTH_UAV_TWIN=1. Result: it fixes the 128-px light squares inthat title's tiled lighting, and a half-black window view that came from the same lighting pass.
Stack (exact)
mainat7a649b0e(the merge of #936), plus 28 local commits.3b12e0b2of this PR, cherry-picked, with two adaptations for that base:Twinkeepsthroughnext todev/r24. An R24G8buffer is planned for its stencil plane, so
note_plane_staterecords the states the PC gets, PARK included;LISTSis used forrecording(key), because the list state is not sharded on that base.XCL_ALIAS_COPY=1 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_PLACE_RETIRE=0 XCL_VIEW_REACH_MB=36 XCL_PREPARE=0XCL_TWO_PASS_MB=2048 XCL_HUGE_PSO_CONCURRENCY=8 XCL_HUGE_PSO_WANTED_CONCURRENCY=8 XCL_PSO_WAIT_MS=5000XCL_DEPTH_UAV_TWIN.Read
The title's tiled lighting draws each material permutation as a separate full-tile pass, with an EQUAL depth test and no
depth write. The test runs against a class buffer: console D16S8, R24G8 on the PC. A compute program writes that buffer's
depth plane as z = permutation / 65535, through a UAV of the depth buffer.
The title keeps the buffer in DEPTH_WRITE while the compute program writes it. There is no transition into or out of
UNORDERED_ACCESS. So the copies at transitions (#1989, and #3290's stencil copies) never move anything for this plane, and
the switch alone changed nothing. Your pass at the DSV bind is what reaches it.
Measured
the depth plane either in read states (0x8e0) or in DEPTH_WRITE (0x10).
themselves, not as permutation 0;
more than 20 % of the window box is black:
XCL_DEPTH_UAV_TWIN=1: 1 of 27 (4 %);XCL_DEPTH_UAV_TWIN=1but without this PR: 72 of 72;So the switch alone does not do it; this PR's pass does. Read: the frame's only R24G8 buffer is this class buffer, and
the window's own draws test against a different depth buffer (D32S8). Deduced: the black triangle is the tiled
lighting's output over that area, not the glass draws.
Deduced
Without the plane, only permutation 0 (z = 0) passed EQUAL. A tile of one other material alone was then never shaded, and
kept whatever its lighting targets held before: the bright or black squares.
Not covered
never does it.
Found and written with Claude Code (Claude Opus 5.5), checked and posted by me.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T16:32:17Z.
Review note: the pass pipelines are made at the first DSV bind, on the recording thread
pass_pipelinescompiles the three programs and makes the root signature and both pipelines at the first bind of an R24G8DSV. That runs on the title's thread that records the list, under the
PASS_PIPELINESmutex.On the retail title (same stack and env, RTX 3090) that call stayed in the driver for more than 30 s:
None of 13 runs of the same stack and env without this PR stopped that way.
When the pipelines were made off that thread, the same build step took 36,958 ms. That was on RTX 3090, with the system at
high memory use; it is not a property of the shaders.
The change we ran (on top of
3b12e0b2):pass_pipelineson athread of its own, once per device;
before_dsv_bindonly doestry_lock. While the pipelines are not made, it leaves that bind with a reason ("itspipelines are still being made") before it sets
drawn_at, so a later bind draws;pass_made).In that run the pipelines were ready about 74 s before the first bind that needed them, and 0 binds were left waiting. I
can share it as a patch here, or open it as a follow-up PR on top of yours, whichever you prefer.
Found and written with Claude Code (Claude Opus 5.5), checked and posted by me.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T19:58:09Z.
Correction to my test report above: the window part was wrong. Same binary and env as that run, minus two diagnostic dump switches (
XCL_RT_DUMP,XCL_RT_DUMP_ONLY, which only record tables before their capture time): the half-black window is back, 65 % of the window box black from 250 s on, the same as without this PR. A run with this PR plus the skinned characters fixed shows it too (64 %). So the clean window came from that one run's setup, not from this PR; I don't know yet what made it clean there.The light squares result stands: 0 bright cells again in this run (3 without the PR).
AI use: found and written with Claude Code (Claude Opus 5.5), checked and posted by me.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-30T05:57:43Z.
This now conflicts with
main(after #3290 was merged). The R24G8 depth-plane pass is still needed for the light squares on the retail title: #3290 alone turns the twins on but does not fill the class plane at the DSV bind. Our stack, rebased ontomaind52ff48c, carries a port of3b12e0b2on top of #3290 (stencil_twinnablereplaced by #3290'sparked), RTX 3090; the first-bind pipeline note from my earlier comment still applies.Would you rebase it onto current
main? I can then post a test report on the new head.AI use: found and written with Claude Code (Claude Opus 5.5), checked and posted by me.
Imported from ivall/xcl. Originally posted by imnicho on 2026-11-30T23:55:04Z.
Rebased onto
mainand merged with #3290: new head8de5808d8(one commit; the old head onnvidia-devwas3b12e0b25). @CharlyRien, thank you for the port notes and the measurements; it builds onmaind0832e614now, and a report on the new head would be very welcome.XCL_DEPTH_UAV_TWIN_R24=1. Without it an R24G8 buffer's depth UAV is the null view it is onmain, and nothing of this PR runs.late_release. The test checks that the buffer holds both heaps, also afterforget.drawn_atis set, so the next one draws. I wrote it from your description, not from your patch, so please check it against what you ran. On WARP here the pipelines take 27 ms.note_plane_staterecords what the PC gets inplan_with,PARKincluded, as in your port.Tested on the new head: 22 depth-twin tests passed (5 of them on WARP in child processes), and the regression runs in the description (1,465 frames against
main's 1,560 in 60 s, switch off). The whole library suite gives no count on this PC: plainmainends the test process partway here (details in the description), so CI is the suite's word on this head.Not run by me: the title's world on this head, for the same reason as on #3094 (my caches are of the
nvidia-devtree). That run is next, and I will post it here.AI use: Claude Code with Claude Fable 5.2 did the merge and the changes and wrote this comment.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T01:16:34Z.
Source follow-up on current head
8de5808d: the earlier clear invalidation and descriptor-heap lifetime points are addressed in the new code. I found one recording-lifetime case that the new tests do not cover.drawn_atbelongs to the shared buffer cell, andbefore_dsv_bindsets it while recording. Once the pass pipelines are ready, record a DSV bind on a direct list, close the list, then reset it without submitting that recording. Bind the same DSV in the new recording without another dispatch or clear. The first recording leftdrawn_at == Some(now), so the new bind skips the pass, although no pass from the discarded recording can execute. Submitting the second recording can leave the depth plane stale. A second destination object sharing the cell has the same problem becausedrawn_atis not keyed by destination.Please elide a pass only when a pass for that destination was recorded earlier in the same live command-list recording, with no intervening twin write. Reset or discard must clear that proof; the existing clear path must still invalidate it. A focused regression can close and reset an unsubmitted list, bind the same DSV, submit, and compare a fenced depth readback with the twin's known values. The current WARP fixture covers sequential binds, clear routing and heap retention, but not a discarded recording.
This is a source trace on the exact head; I did not run a GPU or title test of it. AI use: OpenAI Codex (GPT-6.2 Sol) checked the current source and discussion; OpenAI Codex (GPT-6.2 Astra) independently traced the reset and resource lifetimes.
Imported from ivall/xcl. Originally posted by imnicho on 2026-12-01T07:54:18Z.
New head
e228ed5da(rebased ontomain493dbd3dd; the second commit is this round).@thehollowedone, the recording-lifetime case on
8de5808d8is right, and it is in: what spares a pass is no longer a note on the buffer's Cell. It is kept with the list's live recording and the object whose plane was drawn (list_x::plane_drawn: the object, the count of dispatches recorded, the count of clears of the twin), next todepth_in_stepand cleared where that is cleared, at a Reset and at a KickoffX. So a recording that is reset and never submitted spares nothing, and a pass for one object of a buffer does not spare another's. The clear path now counts clears instead of resetting the note, so it still invalidates.The WARP test follows your regression as far as the bind: after its first recording it resets the list and binds the same DSV with no dispatch and no clear in between, and the new recording draws. It does not submit that second recording and read the plane back; the first recording's readback is what it had.
Tested on the new head: 22 depth-twin tests passed (5 on WARP in child processes), and the regression run in the description (1,321 frames against
main's 1,560 in 60 s, switch off).A correction to the description of
8de5808d8. It said the head was also run one test at a time with the same stop as plainmain. Those two runs were of plainmain's test binary: I build several worktrees into one target folder, and cargo called the other worktree's binary up to date. The regression block that stood there came from a build I cannot vouch for either. Both are replaced; every count on the page now is from a build whose log names the worktree as compiled, with the crate's outputs cleaned first. The four-thread result (the suite ends the test process on this PC, on plainmainand on the head alike) was from the right binaries.Still not run by me: the title's world on
mainwith this head, for the reason on #3094 (two tries today stopped drawing about 30 s after the world's set-up behind first-time driver compiles; I am warming the caches).AI use: Claude Code with Claude Fable 5.2 wrote the changes and this comment.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T08:06:33Z.
Update on current head
a9aa32db: the slot-85-only predication path is now handled, but the mixed slot-85/slot-31 path remains.The console slot-31 remap forwards to PC
SetPredicationthroughmake_split; it does not update the list’s tracked state. After slot 85 records a suppressing predicate, slot 31 can disable it withSetPredication(NULL), whileListStatestill reports the old private predicate as active. The nextdepth_only_passthen restores that stale predicate after its internal draw, potentially suppressing later title draws despite the title having disabled predication.Please route slot 31 through list-state tracking. A NULL call must retire the old private snapshot and transition its buffer out of
PREDICATION; a non-NULL native predicate must be represented separately, with its value preserved as latched when the helper suspends and restores it. Reissuing the source resource later can observe a newer value.Regression: set a suppressing predicate through slot 85, disable it through slot 31, bind the first eligible DSV, then issue a title draw and verify its output by readback. This is a source trace; I did not run this sequence on a GPU.
AI use: OpenAI Codex (GPT-6.2 Sol) traced the dispatch and list-state paths; OpenAI Codex (GPT-6.2 Astra) independently checked predicate state and latching.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:29:00Z.
Triage (#1607) – head
a9aa32dMain's depth_uav module (#3290) still returns a null view for the depth plane of an R24G8 buffer. This PR adds that case behind XCL_DEPTH_UAV_TWIN_R24=1, with a plane-only pass before the DSV bind (
list_x::depth_only_pass) and per-recordingplane_drawnstate. Nothing like it is on main.#1989 also gives the R24G8 depth plane a twin with an SV_Depth pass (this PR takes its pass from there), but #1989 is a separate 4.3k-line twin system written before #3290 and now conflicts. These are different approaches, not duplicates. #3480 and #1063 do not touch the R24G8 plane.
No problems found in the diff. It is over the size target (575 lines of code plus tests), and the description says so.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by imnicho on 2026-12-01T09:47:11Z.
New head
a9aa32db5(one more commit on the same base).@thehollowedone, the predication case on
e228ed5dais right: the pass's draws were recorded with the title's predicate still on, and a failing one left the plane undrawn while the recording noted it as drawn.depth_only_passnow takes a predicate set with SetPredicationBufferX off for its draws and sets it again after them from the list's own copy of the latched value (pred_buf), so the title's later draws see what its call latched, whatever its memory holds by then.Two things it does not do, both in the description:
SetPredication(console slot 31) is passed on without XCL following it, so it still decides the pass's draws. Following that path means snapshotting it as slot 85 is, which is a change to howmaintreats slot 31 for every title, and I would rather not make it inside this PR.main's 105 list and predication tests, all passing on a clean build.Regression run in the description: 1,551 frames against
main's 1,560 in 60 s (three runs of the binary gave 1,110, 1,551 and 1,533; the first came straight after an hour of long title runs here).A word on scope, said with thanks for the findings on this PR and on #3094, every one of them real: this PR has grown from 437 to 575 lines of code by taking them. Where a further case is a defect in what the PR does today I will keep fixing it here; where it is a wider model (submission order, slot 31's predicate), I think it belongs in a follow-up, and I am glad to review or write one.
AI use: Claude Code with Claude Fable 5.2 wrote the change and this comment.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T11:27:42Z.
merge-check
base:
493dbd3dd0head:
a9aa32db58merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+1038/-38). The twin is an R16 / R32 texture the title's compute program writes through its UAV, drawn into the depth plane by an
SV_Depthpass at each DSV bind. Off by default (XCL_DEPTH_UAV_TWIN_R24); the default path gains an atomic check perOMSetRenderTargetswith a DSV,note_plane_statestores on depth-buffer transitions, and oneArcper depth object. The run below has a second smoke with the switch on, which in 60 s doesn't reach the world's lighting. Findings, switch on: (1) The pass can overwrite the plane. It redraws after any dispatch recorded anywhere (depth_uav.rs~1043, a global count), and nothing copies the plane to the twin, so depth the title drew or cleared since the last pass is lost. The retail title survives because its compute program rewrites the twin each time; another title with such a buffer would have its depth corrupted. #1989 and #3480 both copy plane to twin; worth taking. (2) Stencil plane state (~1101): the pass binds a DSV with writable stencil unless the stencil plane's state includes DEPTH_READ. In PARK (0x800), SRV-only or unknown states that breaks D3D12's state rules; the debug layer wasn't run on this head, and moving the stencil plane lost the device in 4 of 4 runs. (3) The R32 path reads the twin as float (~971) while a title's R32_UINT UAV is kept as uint (no title reaches it). (4) The 16-bit step constant0x37800080(~845) is fitted to one title's vertex shader. (5) Tests: the switch defaults to on undercfg!(test)(~59-62), and the existing default-path check (depth UAV stays a null view) was rewritten to expect a twin (real.rs~14965), so the off path now has no test. The predication fix has none either, and the hook atreal.rs~11403 is called by no test. (6) Cost when on: one full-screen draw per level and slice per bind plus a descriptor-heap switch, unmeasured; one twin per buffer (7-15 MB at 1440p). (7) 1,038 lines with no reason given for not splitting: plane-state tracking first, thendepth_only_passand predication with a test, then the R24 twin and switch. Fine: heaps live as long as a recorded list can name them, what spares a pass is per recording and cleared at Reset / KickoffX, pipelines are built on their own thread, the predicate is restored from the list's latched copy, and the switch-offresolve_uavpath is unchanged.performance: 60 s smoke of a retail title, main
493dbd3dvs this merge (a9aa32db): 1670 -> 1682 frames shown (100 %; last presents per 2 s: 60 60 60), peak commit 17083 -> 17343 MB, 0 device removals, 0 crashes. A second 60 s run of the same merge withXCL_DEPTH_UAV_TWIN_R24=1: 1694 frames shown (last presents per 2 s: 61 60 60), peak commit 17325 MB, 0 device removals, 0 crashes. Its log shows only the existing R16 twins of 768x768x6 D16 buffers and no R24 twin, so the new pass isn't used in 60 s; its pipeline is still built at 16 s, taking 7.6 s on its own thread.verdict: not yet: with the switch on, the pass can overwrite depth the title drew or cleared since the last pass (no plane-to-twin copy, finding 1), and the stencil-plane state can break D3D12's rules (finding 2); the switch-off path also lost its test (finding 5). Split as suggested
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by imnicho on 2026-12-01T12:17:34Z.
@Foniass thank you for the read and the second regression run.
On the findings, on
a9aa32db5:cfg!(test), so the null-view case of the default path lost its test when I rewrote that one, and the predicate's move around the pass has only thepredicationtests oflist_xthat were there before.What I will do, and one thing I would like settled first. The draft #3547 brings amd-dev's depth work, which has its own
SV_Depthpass for an R24G8 plane that compute programs write (execute_r24g8_copyin itsdepth_uav.rs). I would rather not put this PR in front of reviewers again, as three new PRs, ifmainis about to get that. So I am holding the fixes for findings 1, 2 and 5 and the split until it is clear whether #3547 goes in; if it does not, I will push them as (a) the plane's state, (b) the pass and the predicate with a test of their own, (c) the R24 twin and its switch, with the default path's test back. Meanwhile this machine (RTX 5080) is running #3547's branch, where results on NVIDIA were asked for.Nothing was built or run for this comment.
AI use: Claude Code with Claude Fable 5.2 read the review against the code and wrote this comment.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by afpruivo on 2026-12-02T09:11:49Z.
World test of
a9aa32db5in the retail title, 16 view windows: the twin reaches the plane, the R32_UINT lighting target covers the room, but the HDR target is lit only in a hatched pattern on a few surfaces.Setup
4586a280(main493dbd3dd+ local merges of #3094, #3282, #3509) merged with this PR's heada9aa32db5→d26eda58; release build from a clean worktree.XCL_ACTIVITY=1 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PREPARE=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_UMA_DRIVER=mixed:1536:1792 XCL_UMA_WINDOWS=16 XCL_DUMP_TARGETS=4000,1,64 XCL_DUMP_AFTER_S=330, 400 s, the same input to enter the world. The second run addsXCL_DEPTH_UAV_TWIN_R24=1; nothing else differs. Shader caches warm, 0 pipeline failures.What the log shows with the switch on
the pass that draws a twin into an R24G8 depth plane was made in 21 msdepth UAV twin #315: drawn into the depth plane of 0xdca69fa20 before a DSV of it is bound (the title has its planes in states 0x8e0 and 0x10 …), then with0x10 and 0x10; 12 such lines in 400 s, nobinds needed none, no pass left out.Picture (frames ≥ 2100, mean of every dumped frame)
Off: the cell is dark except the window. On: the door frame, the edge of the left wall and the figure are lit as well; walls and floor stay black. No device removal, no crash.
Targets at frame 2802 (switch on)
So the lighting draws see the room now, but on most pixels they still do not pass. The hatch looks like the EQUAL test passing on some texels and failing on their neighbours, i.e. the plane's values matching the title's vertex depth on only part of the surface. I have not confirmed that with a pixel history yet; that is my next run, and I will add it here.
Not checked
mainwithout #3094/#3282/#3509.4586a280without this PR showed the grey wash; I have not settled whether that is run-to-run variation or this PR's always-on part (note_plane_state, theArcper depth object).Tool and model: Claude Code, Claude Opus 5.5 (ran the builds and runs on the hardware above, measured the frames, wrote this report).
Imported from ivall/xcl. Originally posted by afpruivo on 2026-12-03T00:29:04Z.
The hatch in the HDR lighting target I reported above has a likely cause, and it is not in this PR: the lighting pixel shader's light-range reduction. With a one-line recompiler change, the hatch is gone from the same view.
Cause. Lighting PS
0a42a0099e8fec6dtakes the minimum and maximum of its tile's light indices over the wave, in the console compiler's usual form:s_or_saveexec -1, an identityv_cndmask, DPP8 ×3,row_mirror,v_permlanex16,v_readlane 0.mainrebuilds that form as wave operations (graphics_reductions,fb0931da). But the matcher refuses a row mirror withBOUND_CTRLset, and this shader's row mirror has it set (fa 00 00 26 00 40 09 ff). So the steps ran one by one, and they read 0 from lanes the PC did not launch, where the console's lanes hold the identity. In a wave that is not full, the minimum light index was 0.On an RTX 3090, a GPU test with the shader's own bytes drawn in small triangles gives a wave minimum of 0 for 27 of 27 pixels on
main, and for 0 of 27 with the matcher taking eitherBOUND_CTRLvalue. In that section EXEC is all ones and a row mirror stays in its row, so the bit cannot change the result. The change and its test are on branchps-wave-min-partialof my fork (e8b24228, onmain078358a0). I'll open it as its own PR.World A/B (RTX 3090, driver 621.40, Agility 1.620, 400 s, the same 16-window environment as my run above with
XCL_DEPTH_UAV_TWIN_R24=1). The two runs differ only in the binary:main078358a0+ #3509 + this PR (a9aa32db5), without and with that commit. Both reach the world and stop at the same view, a dark room with an open door to a lit building.target6) shows evenly lit walls, 36.7 % of pixels non-black.Limits: one pair of runs, NVIDIA only. The without-run's target dump was overwritten by the second run, so the target comparison is only against my earlier run on an older base. Helper lanes are still left out of the rebuilt reduction.
AI use: Claude Code (Claude Opus 5.5) found the cause, wrote the change and test, ran the A/B and wrote this while I was away; posted with my standing approval for this session.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T17:39:48Z.
World test of
a9aa32db5in the retail title on NVIDIA wave32 (RTX 5070 Ti), withXCL_DEPTH_UAV_TWIN_R24=1: the blocky grey patches on the near surfaces are gone, and so are the grey streaks over the window.Setup
main395405e4+ #3094 + #3282 + #3625 + afpruivo'se8b24228(theBOUND_CTRLrow-mirror reduction). Run A is that tree. Run B is the same tree with this PR merged (a9aa32db5, clean merge) andXCL_DEPTH_UAV_TWIN_R24=1.XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16), texture level pages, alias copy, target dump at 1000 s. 1300 s runs that reach the prison cell.Result
target6): in A, the surfaces right of the door are covered in flat grey blocks, and grey vertical streaks lie over the open window. In B those surfaces show their texture, the streaks are gone, and the left wall is lit where A has it black. The albedo target was clean in both, so the blocks were added after the G-buffer, by the lighting draws this PR feeds.Limits: one pair of runs, one dumped frame each, from slightly different moments of the same view (frames 4050 and 4244). NVIDIA only.
On
e8b24228: on the same base and environment, presents per minute at 600–1200 s were 78–82 without it and 93–98 with it (one run each). It did not remove the gold speckles here. Those come from lighting PS145b21e5a234713f, a wave64 program. Its reduction has the same steps plusv_readlane 32, but its seedv_cndmaskselects with the saved EXEC itself (v_cndmask_b32 v5, -1, v38, s[0:1]right afters_or_saveexec_b64 s[0:1], -1).graphics_reductionstakes the wave64 form only when that mask is narrowed by ans_and_b64, so this one still runs step by step and reads 0 from unlaunched lanes. I have a change for that with a test and am running it in the world now; I'll open it as its own PR.AI use: Claude Code (Claude Opus 5.5) ran both builds and runs, compared the frames and wrote this report.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T17:43:54Z.
Two corrections to my report above, from a third run on the same base (run C: A + only the wave64 reduction change I mentioned, without this PR):
The gold speckles on the door frame are gone in C, so their cause was the lighting shader's wave64 reduction, as I thought. I'll open that change as its own PR once its suite and smoke runs finish.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.