D3D12.X: depth UAV twins on by default, stencil twins copied with the plane #3290

Merged
Foniass merged 1 commit from upstream-pr/3290 into main 2026-11-29 22:19:29 +00:00
Foniass commented 2026-11-29 05:51:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T05:51:08Z.


A title's tiled lighting tests depth EQUAL against a class buffer (a console D16S8 depth buffer, R24G8 on the PC) that only compute writes, through a UAV of that depth buffer. The PC has no UAV of a depth format, so depth_uav gives such a buffer a twin the shaders write instead, copied to and from the depth plane around the title's transitions. That was opt-in (XCL_DEPTH_UAV_TWIN=1) and covered the depth plane only.

  • Depth UAV twins are on by default (XCL_DEPTH_UAV_TWIN=0 turns them off).
  • The stencil plane's twin is copied too, through a buffer: twin to plane on the way out of UNORDERED_ACCESS, plane to twin on the way in, on direct lists (StencilCopy, list_x::stencil_copies_on). No colour format shares a family with a depth-stencil one, but the PC copies between a buffer and one plane.

This is one of the two pieces amd-dev used to light the retail world; the other, barrier groups (#146: #3287 / #3299), turns the title's enhanced barriers into the transitions that reach plan_barriers. This PR does not depend on it: without it, the title's legacy barriers still reach plan_barriers.

Review fixes (throny, andrewDoing):

  • A D24S8 buffer (console D16S8 and D24S8) went past plan_barriers as it came: only buffers whose depth plane can have a twin were taken, so its stencil twin was never copied, and its UNORDERED_ACCESS transition went to the PC, where a depth-stencil buffer cannot be in that state (andrewDoing's run: Close failed with E_INVALIDARG). Its transitions are now parked like the others (parked): its depth plane is not copied, its stencil twin is.
  • The stencil copy back into the plane had no guard like the depth plane's entered: after a way in on a compute list, or with a twin made since, it would write stale or empty twin contents over the plane. It now copies back only after a copied way in (Cell::stencil_entered).
  • kept() is back to tests only, and the module comment no longer names barrier_groups, which main does not have.
  • Tests: a_stencil_twin_is_copied_around_unordered_access_after_a_copied_way_in (console D16S8 and D32S8), and the D24S8 case in only_depth_plane_subresources_are_copied_and_other_buffers_go_as_they_came (now parked; before, it went as it came).

What is in it

  • crates/xcl/src/hle/d3d12x/depth_uav.rs: DEFAULT_ON = true, the stencil twin's buffer (through), StencilCopy, the stencil part of plan_barriers (parked, stencil_entered); with the underflow fix of amd-dev a46703b6 (then_some(sub - n) evaluated sub - n for every subresource, a panic in debug builds when sub < n)
  • crates/xcl/src/hle/d3d12x/list_x.rs: stencil_copies_on and its two calls around plane_copies_on

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 4dd049f6: 2605 passed, 4 failed, 49 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (E_OUTOFMEMORY from CreateComputePipelineState, seeds 70 / 545 / 1019 / 1507). They fail the same way on this branch's base, main fa204595, on this machine, and pass here on newer main (#3264, rebased onto 0fe06eb0, has 0 failures). SKIPPED GPU tests: 44 distinct notices, almost all no wave64.
  • Retail title, with the default on: 60 s smoke run below: no device removal or crash, frames and peak commit within the limits. The title makes depth twins in that run (its log: R16 twins of D16 buffers, depth UAV twin #1...). I did not check which scenes a 60 s run reaches, so it does not show whether the tiled lighting changed.

Regression run

main:

xcl-smoke v1
commit: 3b6a91ed096d6d6e0fee52cfb86dc0a7d7c8c1b0
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1193 (PresentX 1193)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15684 MB

this PR:

xcl-smoke v1
commit: 4dd049f646c1724444810a4a2ecc1775c5f8b23a
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1662 (PresentX 1662)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17720 MB

Not tested

  • whether the world's tiled lighting looks right (amd-dev reports "the world is lit" with barrier groups too, on an RX 9070 XT); not checked here
  • AMD GPUs; titles other than this one
  • the stencil copies on compute or copy lists (only direct lists copy; others warn once, as for the depth plane)
  • the stencil copies on real hardware: the new test drives the planner with stand-in twins; no title run here makes a stencil twin

AI use

  • Claude Code with Claude Opus 5.5: ported the depth_uav part of amd-dev a68f609f and the fix of a46703b6 to main, resolved the conflicts, made the review fixes and their tests, ran the tests and the smoke run, wrote this description.
  • Original code: amd-dev a68f609f and a46703b6 (raylitebull, written with Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5548039595 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T05:51:08Z. --- A title's tiled lighting tests depth EQUAL against a class buffer (a console D16S8 depth buffer, R24G8 on the PC) that only compute writes, through a UAV of that depth buffer. The PC has no UAV of a depth format, so `depth_uav` gives such a buffer a *twin* the shaders write instead, copied to and from the depth plane around the title's transitions. That was opt-in (`XCL_DEPTH_UAV_TWIN=1`) and covered the depth plane only. - Depth UAV twins are **on by default** (`XCL_DEPTH_UAV_TWIN=0` turns them off). - The **stencil plane's twin** is copied too, through a buffer: twin to plane on the way out of UNORDERED_ACCESS, plane to twin on the way in, on direct lists (`StencilCopy`, `list_x::stencil_copies_on`). No colour format shares a family with a depth-stencil one, but the PC copies between a buffer and one plane. This is one of the two pieces amd-dev used to light the retail world; the other, barrier groups (#146: #3287 / #3299), turns the title's enhanced barriers into the transitions that reach `plan_barriers`. This PR does not depend on it: without it, the title's legacy barriers still reach `plan_barriers`. **Review fixes (throny, andrewDoing):** - A D24S8 buffer (console D16S8 and D24S8) went past `plan_barriers` as it came: only buffers whose *depth* plane can have a twin were taken, so its stencil twin was never copied, and its UNORDERED_ACCESS transition went to the PC, where a depth-stencil buffer cannot be in that state (andrewDoing's run: `Close` failed with `E_INVALIDARG`). Its transitions are now parked like the others (`parked`): its depth plane is not copied, its stencil twin is. - The stencil copy back into the plane had no guard like the depth plane's `entered`: after a way in on a compute list, or with a twin made since, it would write stale or empty twin contents over the plane. It now copies back only after a copied way in (`Cell::stencil_entered`). - `kept()` is back to tests only, and the module comment no longer names `barrier_groups`, which main does not have. - Tests: `a_stencil_twin_is_copied_around_unordered_access_after_a_copied_way_in` (console D16S8 and D32S8), and the D24S8 case in `only_depth_plane_subresources_are_copied_and_other_buffers_go_as_they_came` (now parked; before, it went as it came). **What is in it** - `crates/xcl/src/hle/d3d12x/depth_uav.rs`: `DEFAULT_ON = true`, the stencil twin's buffer (`through`), `StencilCopy`, the stencil part of `plan_barriers` (`parked`, `stencil_entered`); with the underflow fix of amd-dev `a46703b6` (`then_some(sub - n)` evaluated `sub - n` for every subresource, a panic in debug builds when `sub < n`) - `crates/xcl/src/hle/d3d12x/list_x.rs`: `stencil_copies_on` and its two calls around `plane_copies_on` **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 4dd049f6: 2605 passed, 4 failed, 49 ignored. The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` (`E_OUTOFMEMORY` from `CreateComputePipelineState`, seeds 70 / 545 / 1019 / 1507). They fail the same way on this branch's base, main fa204595, on this machine, and pass here on newer main (#3264, rebased onto 0fe06eb0, has 0 failures). SKIPPED GPU tests: 44 distinct notices, almost all `no wave64`. - Retail title, with the default on: 60 s smoke run below: no device removal or crash, frames and peak commit within the limits. The title makes depth twins in that run (its log: R16 twins of D16 buffers, `depth UAV twin #1`...). I did not check which scenes a 60 s run reaches, so it does not show whether the tiled lighting changed. **Regression run** main: ``` xcl-smoke v1 commit: 3b6a91ed096d6d6e0fee52cfb86dc0a7d7c8c1b0 gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1193 (PresentX 1193) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15684 MB ``` this PR: ``` xcl-smoke v1 commit: 4dd049f646c1724444810a4a2ecc1775c5f8b23a gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1662 (PresentX 1662) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17720 MB ``` **Not tested** - whether the world's tiled lighting looks right (amd-dev reports "the world is lit" with barrier groups too, on an RX 9070 XT); not checked here - AMD GPUs; titles other than this one - the stencil copies on compute or copy lists (only direct lists copy; others warn once, as for the depth plane) - the stencil copies on real hardware: the new test drives the planner with stand-in twins; no title run here makes a stencil twin **AI use** - Claude Code with Claude Opus 5.5: ported the depth_uav part of amd-dev `a68f609f` and the fix of `a46703b6` to main, resolved the conflicts, made the review fixes and their tests, ran the tests and the smoke run, wrote this description. - Original code: amd-dev `a68f609f` and `a46703b6` (raylitebull, written with Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewDoing commented 2026-11-29 06:11:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T06:11:58Z.


On 3370d35f, the DIRECT-list planner skips the stencil copy for console D16S8 (118), which becomes R24G8_TYPELESS (44). A test on an RTX 5070, driver 616.92, created the R8 stencil UAV twin successfully. With the stock planner predicate, recording two alternating stencil-plane updates produced zero stencil-copy messages and command-list Close returned E_INVALIDARG (0x80070057). The fixture stopped before submitting that list.

In depth_uav::plan_with, filter(plane_twinnable) admits formats 19, 39 and 53. The later stencil branch explicitly handles 19 and 44, so 44 cannot reach it. I repeated the same synthetic fixture in a fresh process with one test-only change to admit format 44 for stencil subresource 1 of this single-mip, single-slice resource. That recorded two copies in each direction, completed the fence, and matched both planes on all 256 texels after each round:

Round DSV update Guest stencil UAV rectangle Actual left / right stencil Actual depth on all texels (24-bit)
1 Depth 0.25, stencil 0x19 Left half to 0xA7 0xA7 / 0x19 0x400000
2 Depth only, 0.75 Right half to 0x53 0xA7 / 0x53 0xBFFFFF

The fixture used the guest stencil UAV creation, legacy ResourceBarrier and ClearUnorderedAccessViewUint paths, and read back the original depth/stencil resource. This points to separating stencil-copy eligibility from depth-plane-twin eligibility. The narrow diagnostic covered plane-specific DIRECT transitions on one resource. Whole-resource transitions, enhanced barriers and retail lighting remain untested here.

AI disclosure: OpenAI Codex prepared and ran the fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7251708102 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7251708102). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-29T06:11:58Z. --- On `3370d35f`, the DIRECT-list planner skips the stencil copy for console D16S8 (118), which becomes R24G8_TYPELESS (44). A test on an RTX 5070, driver 616.92, created the R8 stencil UAV twin successfully. With the stock planner predicate, recording two alternating stencil-plane updates produced zero stencil-copy messages and command-list Close returned E_INVALIDARG (0x80070057). The fixture stopped before submitting that list. In `depth_uav::plan_with`, `filter(plane_twinnable)` admits formats 19, 39 and 53. The later stencil branch explicitly handles 19 and 44, so 44 cannot reach it. I repeated the same synthetic fixture in a fresh process with one test-only change to admit format 44 for stencil subresource 1 of this single-mip, single-slice resource. That recorded two copies in each direction, completed the fence, and matched both planes on all 256 texels after each round: | Round | DSV update | Guest stencil UAV rectangle | Actual left / right stencil | Actual depth on all texels (24-bit) | |---|---|---|---|---| | 1 | Depth 0.25, stencil 0x19 | Left half to 0xA7 | 0xA7 / 0x19 | 0x400000 | | 2 | Depth only, 0.75 | Right half to 0x53 | 0xA7 / 0x53 | 0xBFFFFF | The fixture used the guest stencil UAV creation, legacy ResourceBarrier and ClearUnorderedAccessViewUint paths, and read back the original depth/stencil resource. This points to separating stencil-copy eligibility from depth-plane-twin eligibility. The narrow diagnostic covered plane-specific DIRECT transitions on one resource. Whole-resource transitions, enhanced barriers and retail lighting remain untested here. AI disclosure: OpenAI Codex prepared and ran the fixture and drafted this report.
Kalmarv commented 2026-11-29 07:54:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T07:54:00Z.


merge-check
base: fa204595
head: 3370d35f
verdict: safe to merge

Merged cleanly onto origin/main (fa204595) in a 5-PR batch (#3288, #3290, #3292, #3294, #3300) and verified on NVIDIA GeForce RTX 5070 Ti with DXC 1.9.2609.5:

  • Targeted depth/stencil UAV twin GPU tests (gpu_a_stencil_uav_of_a_console_depth_buffer_is_a_view_of_its_twin, gpu_clear_uav_of_a_stencil_uav_clears_the_twin, gpu_a_stencil_uav_by_address_is_a_view_of_the_placed_buffers_twin): all passed on RTX 5070 Ti.
  • gpu::: 853 passed, 0 failed, 24 ignored (10.45 s, including fuzz_validate_and_gpu_0..3).
  • hle::d3d12x:: (--test-threads=1, skipping 2 known main #3187 uma_driver mixed-window tests): 1144 passed, 0 failed, 3 ignored (30.21 s).
  • Remaining xcl --lib (--test-threads=1): 0 failed.
  • -p xcl --test e2e (after rebuilding xcl-testtitle): 5 passed, 0 failed (including D3D12 debug layer + DRED).
  • GitHub CI (Build and test (Windows, no GPU) and PR description): green.
<!-- greyfinch-sync:ivall/xcl:comment:7252759703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7252759703). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T07:54:00Z. --- merge-check base: fa204595 head: 3370d35f verdict: safe to merge Merged cleanly onto `origin/main` (`fa204595`) in a 5-PR batch (`#3288`, `#3290`, `#3292`, `#3294`, `#3300`) and verified on NVIDIA GeForce RTX 5070 Ti with DXC 1.9.2609.5: - Targeted depth/stencil UAV twin GPU tests (`gpu_a_stencil_uav_of_a_console_depth_buffer_is_a_view_of_its_twin`, `gpu_clear_uav_of_a_stencil_uav_clears_the_twin`, `gpu_a_stencil_uav_by_address_is_a_view_of_the_placed_buffers_twin`): all passed on RTX 5070 Ti. - `gpu::`: 853 passed, 0 failed, 24 ignored (10.45 s, including `fuzz_validate_and_gpu_0..3`). - `hle::d3d12x::` (`--test-threads=1`, skipping 2 known `main` `#3187` `uma_driver` mixed-window tests): 1144 passed, 0 failed, 3 ignored (30.21 s). - Remaining `xcl --lib` (`--test-threads=1`): 0 failed. - `-p xcl --test e2e` (after rebuilding `xcl-testtitle`): 5 passed, 0 failed (including D3D12 debug layer + DRED). - GitHub CI (`Build and test (Windows, no GPU)` and `PR description`): green.
throny commented 2026-11-29 09:21:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:21:17Z.


merge-check claim
head: 3370d35f36

<!-- greyfinch-sync:ivall/xcl:comment:7253706469 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7253706469). Originally posted by [throny](https://github.com/throny) on 2026-11-29T09:21:17Z. --- merge-check claim head: 3370d35f36a8138acdb473b8acde435fbd9b2f45
throny commented 2026-11-29 09:36:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:36:08Z.


merge-check
base: d8bd9a38
head: 3370d35f36
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored: the same count as the base, so the suite runs no new test for this change (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored.
review: three findings from reading the diff against main d8bd9a38. (1) The new stencil copy is selected with matches!(key.format, 19 | 44), but it runs only for objects that pass plane_twinnable, which on main accepts formats 19, 39 and 53. Format 44 never gets there, so its stencil twin is never copied although the code reads as if it were. (2) The copy from the stencil twin back into the plane on the way out of UNORDERED_ACCESS has no guard like the depth path's entered; on a compute list, or before the twin exists, the way in copies nothing, so the way out can write stale or empty twin contents over the plane's stencil. The missing guard is confirmed by reading; the effect is my reading of it, not a run. (3) kept() loses #[cfg(test)] and the module comment names a caller barrier_groups, which does not exist on main or in this diff, so this looks stacked on work that is not merged. On top of that the switch goes on by default while the new stencil copies and the staging buffer have no test (the existing tests only gain through: None). Cost when on: one twin per depth buffer the title gives unordered access (an R8 texture and a staging buffer more for a stencil twin), and for a depth-stencil target two copies and two to three barrier calls per subresource in each direction, never skipped. XCL_DEPTH_UAV_TWIN=0 turns it off.
performance: not measured.
verdict: not yet: fix (1) and (2) with a test of the stencil path, say what kept() is for on main (or stack the PR on its base), and show a title run with the default on.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7253872230 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7253872230). Originally posted by [throny](https://github.com/throny) on 2026-11-29T09:36:08Z. --- merge-check base: d8bd9a38 head: 3370d35f36a8138acdb473b8acde435fbd9b2f45 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored: the same count as the base, so the suite runs no new test for this change (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored. review: three findings from reading the diff against main d8bd9a38. (1) The new stencil copy is selected with `matches!(key.format, 19 | 44)`, but it runs only for objects that pass `plane_twinnable`, which on main accepts formats 19, 39 and 53. Format 44 never gets there, so its stencil twin is never copied although the code reads as if it were. (2) The copy from the stencil twin back into the plane on the way out of UNORDERED_ACCESS has no guard like the depth path's `entered`; on a compute list, or before the twin exists, the way in copies nothing, so the way out can write stale or empty twin contents over the plane's stencil. The missing guard is confirmed by reading; the effect is my reading of it, not a run. (3) `kept()` loses `#[cfg(test)]` and the module comment names a caller `barrier_groups`, which does not exist on main or in this diff, so this looks stacked on work that is not merged. On top of that the switch goes on by default while the new stencil copies and the staging buffer have no test (the existing tests only gain `through: None`). Cost when on: one twin per depth buffer the title gives unordered access (an R8 texture and a staging buffer more for a stencil twin), and for a depth-stencil target two copies and two to three barrier calls per subresource in each direction, never skipped. `XCL_DEPTH_UAV_TWIN=0` turns it off. performance: not measured. verdict: not yet: fix (1) and (2) with a test of the stencil path, say what `kept()` is for on main (or stack the PR on its base), and show a title run with the default on. hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Foniass commented 2026-11-29 17:18:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T17:18:58Z.


Thanks throny and andrewDoing, both findings were right. Fixed in 4dd049f6:

  • (1) D24S8 buffers (format 44) now go through the planner (parked). Their transitions into and out of UNORDERED_ACCESS go to COPY_SOURCE like the others, so no depth-stencil buffer is left in UNORDERED_ACCESS on the PC. Their depth plane is not copied (it has no twin), and their stencil twin is. This is andrewDoing's change of admitting 44 for the stencil plane, without giving 44 a depth twin.
  • (2) The stencil copy back now needs a copied way in (Cell::stencil_entered, like entered for the depth plane). After a way in on a compute list, or with a twin made since the way in, nothing is copied back.
  • (3) kept() is back to #[cfg(test)], and the module comment no longer names barrier_groups. This PR does not depend on #3287 / #3299.
  • Tests: a_stencil_twin_is_copied_around_unordered_access_after_a_copied_way_in (console D16S8 and D32S8: no twin, twin made since, direct way in, compute way in, the stencil subresource alone). The existing D24S8 case now expects "parked".

About a title run with the default on: the smoke run in the description has it on, and the title makes depth twins there (R16 twins of D16 buffers, from its log). It makes no stencil twin in that run, so the stencil copies were only exercised by the planner tests. The PR says so under Not tested.

(Written with Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:ivall/xcl:comment:7259593607 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7259593607). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T17:18:58Z. --- Thanks throny and andrewDoing, both findings were right. Fixed in 4dd049f6: - (1) D24S8 buffers (format 44) now go through the planner (`parked`). Their transitions into and out of UNORDERED_ACCESS go to COPY_SOURCE like the others, so no depth-stencil buffer is left in UNORDERED_ACCESS on the PC. Their depth plane is not copied (it has no twin), and their stencil twin is. This is andrewDoing's change of admitting 44 for the stencil plane, without giving 44 a depth twin. - (2) The stencil copy back now needs a copied way in (`Cell::stencil_entered`, like `entered` for the depth plane). After a way in on a compute list, or with a twin made since the way in, nothing is copied back. - (3) `kept()` is back to `#[cfg(test)]`, and the module comment no longer names `barrier_groups`. This PR does not depend on #3287 / #3299. - Tests: `a_stencil_twin_is_copied_around_unordered_access_after_a_copied_way_in` (console D16S8 and D32S8: no twin, twin made since, direct way in, compute way in, the stencil subresource alone). The existing D24S8 case now expects "parked". About a title run with the default on: the smoke run in the description has it on, and the title makes depth twins there (R16 twins of D16 buffers, from its log). It makes no stencil twin in that run, so the stencil copies were only exercised by the planner tests. The PR says so under **Not tested**. (Written with Claude Code, Claude Opus 5.5.)
Foniass commented 2026-11-29 18:23:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T18:23:20Z.


Note for the maintainers: this PR and #3089 (imnicho) both change hle/d3d12x/depth_uav.rs and conflict with each other: a test merge of both onto main gives a content conflict there. Each merges cleanly on its own.

They also both handle R24G8 (console D16S8 / D24S8) depth buffers, in different ways:

  • #3089, behind XCL_DEPTH_UAV_TWIN=1, gives the depth plane of an R24G8 buffer a twin and draws it into the plane before the buffer's DSV is bound.
  • This PR turns the twins on by default. It parks an R24G8 buffer's transitions into and out of UNORDERED_ACCESS (parked), and copies its stencil plane's twin around them. The depth plane is not copied, because here it has no twin.

Whichever merges second needs a rebase, and its author should check that the two R24G8 paths fit together: with both, an R24G8 buffer would have a depth twin, so this PR's depth-plane copies would apply to it as well.

(Written with Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:ivall/xcl:comment:7260442845 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3290#issuecomment-7260442845). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T18:23:20Z. --- Note for the maintainers: this PR and #3089 (imnicho) both change `hle/d3d12x/depth_uav.rs` and conflict with each other: a test merge of both onto main gives a content conflict there. Each merges cleanly on its own. They also both handle R24G8 (console D16S8 / D24S8) depth buffers, in different ways: - #3089, behind `XCL_DEPTH_UAV_TWIN=1`, gives the depth plane of an R24G8 buffer a twin and draws it into the plane before the buffer's DSV is bound. - This PR turns the twins on by default. It parks an R24G8 buffer's transitions into and out of UNORDERED_ACCESS (`parked`), and copies its stencil plane's twin around them. The depth plane is not copied, because here it has no twin. Whichever merges second needs a rebase, and its author should check that the two R24G8 paths fit together: with both, an R24G8 buffer would have a depth twin, so this PR's depth-plane copies would apply to it as well. (Written with Claude Code, Claude Opus 5.5.)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3290
No description provided.