Repository navigation
D3D12.X: depth UAV twins on by default, stencil twins copied with the plane - #3290
Conversation
|
On In
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. |
|
merge-check Merged cleanly onto
|
|
merge-check claim |
|
merge-check |
… plane 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 the depth buffer. The PC has no UAV of a depth format: 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 (no colour format shares a family with a depth-stencil one, but the PC copies between a buffer and one plane): plane to twin on a DIRECT list's way into UNORDERED_ACCESS, twin to plane on the way out (StencilCopy, list_x::stencil_copies_on). Like the depth twin, it is copied back only after a copied way in (Cell::stencil_entered): a twin entered on a compute list, or made since, holds something else than the plane. - A D24S8 buffer (console D16S8 and D24S8) has its transitions into and out of UNORDERED_ACCESS parked like the others (`parked`): its depth plane has no twin, but its stencil plane can, and the PC has no depth-stencil buffer in UNORDERED_ACCESS. Before, they went to the PC as they came, so its stencil twin was never copied (review on xcl-dev#3290). Ported from amd-dev a68f609 (raylitebull, written with Claude Code), the depth_uav part, with the stencil-subresource underflow fix of a46703b (`then_some(sub - n)` evaluated sub - n for every sub). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3370d35 to
4dd049f
Compare
|
Thanks throny and andrewDoing, both findings were right. Fixed in 4dd049f:
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.) |
|
Note for the maintainers: this PR and #3089 (imnicho) both change They also both handle R24G8 (console D16S8 / D24S8) depth buffers, in different ways:
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.) |
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_uavgives 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.XCL_DEPTH_UAV_TWIN=0turns them off).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 reachplan_barriers.Review fixes (throny, andrewDoing):
plan_barriersas 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:Closefailed withE_INVALIDARG). Its transitions are now parked like the others (parked): its depth plane is not copied, its stencil twin is.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 namesbarrier_groups, which main does not have.a_stencil_twin_is_copied_around_unordered_access_after_a_copied_way_in(console D16S8 and D32S8), and the D24S8 case inonly_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 ofplan_barriers(parked,stencil_entered); with the underflow fix of amd-deva46703b6(then_some(sub - n)evaluatedsub - nfor every subresource, a panic in debug builds whensub < n)crates/xcl/src/hle/d3d12x/list_x.rs:stencil_copies_onand its two calls aroundplane_copies_onTested
cargo test --workspace --no-fail-fast -- --test-threads=4on 4dd049f: 2605 passed, 4 failed, 49 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(E_OUTOFMEMORYfromCreateComputePipelineState, seeds 70 / 545 / 1019 / 1507). They fail the same way on this branch's base, main fa20459, on this machine, and pass here on newer main (Recompiler: early-exit-safe multi-wave s_barrier in direct DXIL #3264, rebased onto 0fe06eb, has 0 failures). SKIPPED GPU tests: 44 distinct notices, almost allno wave64.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:
this PR:
Not tested
AI use
a68f609fand the fix ofa46703b6to main, resolved the conflicts, made the review fixes and their tests, ran the tests and the smoke run, wrote this description.a68f609fanda46703b6(raylitebull, written with Claude Code).🤖 Generated with Claude Code