Repository navigation
D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers - #1989
D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers#1989raylitebull wants to merge 1 commit into
Conversation
|
Technical review findings: Blocking
Major
|
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Regression run for this PR: head main this PR: No device removals or crashes; 100 % of main's frames, 104 % of its peak commit. Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: Written with Claude Code (Claude Opus 5.5) from runs on this machine. |
3443fd3 to
39d08cc
Compare
|
Thanks for the exhaustive review and every single catch, Updated
Compiled cleanly in release ( |
39d08cc to
197b104
Compare
|
Fixed the
|
PR #1989 GPU verificationPR head
Tested
SKIPPED output Not tested
AI use T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 handles verification and publication. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Regression run of Against the limits in CONTRIBUTING.md: 100 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
A test of this PR in the retail title's world, on the case that matters most there: a 2560 × 1440 D24S8 target that a compute program writes through its two UAVs and that the title's tiled lighting then tests with EQUAL. Full write-up, setup and numbers on #970: #970 (comment) Setup in short:
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the merge and the runs) did this and drafted the comment. |
197b104 to
3c86172
Compare
|
Thanks so much for catching the D24S8 Enhanced Barriers sync issue on RTX 3090, Rebased
Verified on WARP ( |
3c86172 to
51ee197
Compare
|
Fixed the
Pushed |
|
The crash in On AMD RDNA4, Windows, DXC 1.8.2502.11, Backtrace: // the runtime's Reset puts its own vtable back (as `list_x::reset_pc` knows)
let ext = *(list.as_raw() as *const usize);
assert_eq!(reset_orig(list.as_raw(), alloc.as_raw(), std::ptr::null_mut()), 0);
real::preserve_vtable(list.as_raw(), ext);After both resets: Not checked: the AI use: Claude Code (Claude Opus 5.5) found it, wrote the fix and this on the maintainer's behalf. |
51ee197 to
ced4891
Compare
|
Thanks for tracking down the debug-layer-off Updated
Pushed |
ced4891 to
bfafdf7
Compare
|
Rebased Verified on WARP (
Pushed |
Bring in 36 upstream PRs from origin/main (#2310..#587) onto amd-dev (c7a18d8) while preserving all local AMD RDNA4 work (#615 pipelined presenter SRVs, #495/#1405 XCL_PAGE_ALIAS=1 hooks, #2306 level tiling timers, #1989 vtable fix, mesh user SGPRs). Resolved 4 conflicts: - console_list.rs: kept both mesh_arguments_go_in_user_sgprs_from_s16 and #2323 dispatch-heap tests - real.rs: kept both effective_st depth-UAV tracking and #2280 pc_clear_for_desc - vram.rs: kept Step::Tiling timer around level_tiling - kernelx.rs: kept XCL_PAGE_ALIAS=1 hooks in physical_pages_live and XMemMapPhysicalPagesScatter Assisted-by: Antigravity (Gemini 4 Neon High)
The console lets shaders write a depth buffer through a UAV (ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS). The PC refuses the pair, so pc_resource_desc keeps the depth buffer and every UAV of it is a null view: what a compute program stores there, such as the stencil codes the lighting draws test, is lost. Giving those UAVs a texture of their own needs to know, from the view and the DSV, which buffer they name and in which PC state it was made. This commit only keeps that, behind XCL_DEPTH_UAV_TWIN=1; with the switch off (the default) nothing is registered and every hook stops at one atomic load. New module depth_uav: - the switch (enabled, on: "0" off, "1" on, else the default, off); - note_created at the creation paths with the PC state of the call that succeeded: CreatePlacedResourceX's three texture returns (with the title address), CreateCommittedResource, the PC's way of CreatePlacedResource and its memory of its own (0 after its retry). A single-sample 2D buffer with flags 6 and PC format 19/39/44/53 is kept; objects at one title address and shape share a Cell (on the PC they share texels), a buffer without a title address is a Cell of its own; - note_dsv at CreateDepthStencilView, and DSV descriptor copies (CopyDescriptorsSimple, CopyDescriptors range by range) followed: the destination names what the source names, or nothing; - forget at the last release: the object leaves its Cell, the last one takes the Cell with it. Returns at once when nothing is registered. vram::canonical_va becomes pub(super) for the key. Tests: the_switch_reads_0_and_1, only_depth_buffers_that_allow_unordered_access_are_kept, depth_buffers_at_one_title_address_share_a_cell_until_the_last_is_released, a_copied_dsv_names_what_its_source_names (no GPU). cargo check -p xcl --tests: no new warnings. cargo test --release -p xcl --lib on the software adapter, the depth_uav, real, device_x and vram tests: 108 passed, 0 failed, 0 ignored (56 tests that open the hardware GPU not run). Builds on xcl-dev#1989 by raylitebull (51ee197) Builds on xcl-dev#1063 by IvyNotFound (21aa52c) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A depth buffer the console lets shaders write keeps no ALLOW_UNORDERED_ACCESS on the PC, so every UAV of it was a null view: a compute program that stores stencil codes through it writes nothing, and the draws that test the stencil plane see zeros. Behind XCL_DEPTH_UAV_TWIN=1 (off by default: then nothing changes but the log lines), a UAV that names the stencil plane of a kept two-plane depth buffer (plane slice 1, or a stencil or 8-bit view format) is now made on a twin of the plane: an R8_TYPELESS texture of the buffer's size with unordered access, resting in UNORDERED_ACCESS, made at the first such UAV through real::dev_create_committed_resource (adopted, never in title memory) and kept with the buffer's Cell until its last object is released. dev_create_uav_x reads the resource description once and asks depth_uav::resolve_uav with the title's view as it came. For a twin it calls dev_create_uav_checked_x on the twin with the title's view on plane 0 in R8_UINT (or the R8 UNORM / SNORM / SINT class asked for), so the PC UAV, the published name, the companion SRV and the T# (GFX10 format 5, uint) come by the ordinary path of a texture with unordered access. A UAV of the depth plane, of a buffer XCL did not see created, or with the switch off stays a null view, counted with its reason. Nothing copies between the twin and the plane yet. Log lines: "depth UAV twins are off (XCL_DEPTH_UAV_TWIN)" once; each twin made (first 8, then powers of two); "a UAV of a depth buffer stays a null view (<why>): <n> so far" (first 4, then powers of two), in place of the old warning for depth buffers. Tests: a_view_names_the_stencil_plane_by_format_or_plane_slice, the_twins_view_keeps_the_slices_and_the_r8_class_asked_for (no GPU); gpu_a_stencil_uav_of_a_console_depth_buffer_is_a_view_of_its_twin on WARP in a child process with the switch and the shared view heap: a 16x16 console D24S8 buffer with flags 6 made through CreateCommittedResource, its DSV, two stencil UAVs and a depth UAV made through the device calls; one twin, R8_TYPELESS with unordered access and no title address; both stencil slots name it for UAV and SRV with an R8_UINT T#; the depth slot is a null view counted with its reason; the DSV is known; the twin goes with the buffer. cargo check -p xcl --tests: no new warnings. cargo test --release -p xcl --lib on the software adapter, the depth_uav, real, device_x and vram tests: 111 passed, 0 failed, 0 ignored (56 tests that open the hardware GPU not run). Builds on xcl-dev#1989 by raylitebull (51ee197) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Linux / Wine / RADV (RX 9070 XT) on Setup:
Correction (edited): my first version of part 1 came from a test run without 1. This PR's tests under Wine + vkd3d-proton (each run alone): 8 passed.
2. The retail title, to the opening cutscene (
3. Two other things the runs showed (not caused by this PR):
Update: a title assert with this PR in a longer run (one run each).
Not tested:
AI use: Claude Code (Claude Opus 5.5) merged the tree, ran the tests and the title, added the local logging, and wrote this comment. |
|
Test report, RTX 3090: a title-placed R32_UINT writer never reaches its R9G9B9E5 What happens (read in
Local changes (local commits on our tree, not pushed)
Measured (in the title, captures of the reading pass and of the frame)
Setup
Not tested: other GPUs; other pair formats. AI use: Claude Code (Claude Opus 5.5, coordinating session and agents). The agents read captures and code, wrote the local switches and the analysis scripts, and drafted this report; the coordinating session ran the in-title runs and checked the numbers. |
|
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current |
|
Correction (edited): the same assert also happened with this PR's features switched off ( The title assert I noted earlier with this PR came back today: two more of two long runs, AMD / Linux. It is Setup
Runs
Format-alias side, for reference
AI use: Claude Code (Claude Opus 5.5) ran and read the runs and wrote this. |
Adds two D3D12.X translation layers for console texture behaviors not natively allowed on PC D3D12:
depth_uav.rs): tracks console depth-stencil textures created withALLOW_UNORDERED_ACCESS(includingCreatePlacedResource#29viadev_create_placed_resource_x), creates typeless/UAV-compatible color (and optional stencil) twin resources (TwinPlan,plan_for_console_format), redirectsCreateUnorderedAccessViewto the twin (resolve_uav, integratinguav_companion_srv+null_uav_descand pointingslot.pc_srvat the twin resource), synchronizes dirty per-subresource planes across both legacyResourceBarrier(filter_transition,on_uav_barrier), Enhanced Barriers (#146D3D12_BARRIER_GROUPtexture & global barriers infilter_enhanced_barriers), wildcard global UAV barriers (on_global_uav_barrier), and DSV binds/clears (before_bind_dsv,on_clear_dsv, keepingSTATE_COMMONtargets in legalDEPTH_READ/DEPTH_WRITEvianote_dsvflags and unifyingRowPitch = max(src_pitch, dst_pitch)across 2-planecopy_plane_through_buffer), emits post-DepthToTwinUAV barriers, and restores internal-pass graphics/compute root signatures, PSO state, and dynamic depth bias (restore_after_internal_pass).format_alias.rs): tracks aliased placed textures at overlapping GPU addresses with per-subresource state tracking (COMPUTE_VALID_STATES = 0xC48), copies/synchronizes between incompatible formats via RAIIOwnedCopyLocbuffer-through passes (copy_one_subresource_through_bufferwithmax(src_pitch, dst_pitch)pitch alignment,try_copy_texture_region), and routes evicted/orphaned descriptors and heaps throughlate_release::hold(is_adopted-guarded).Part of #1833.
What is in it
crates/xcl/src/hle/d3d12x/depth_uav.rs&mod.rs:TwinPlan/DepthSyncKind/PlaneMask/SyncOpper-subresource state machine (filter_enhanced_barriers,on_global_uav_barrier,note_dsv,pc_states_depth,pc_states_stencil,split_uav_*,copy_direct_subs,transition_plane_subs,on_uav_barrier), post-DepthToTwinUAV barrier,late_release::holdteardown, plus unit & WARP GPU tests (depth_uav::tests, includingenhanced_barriers_handle_texture_subresources_uav_and_discardandgpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_testwithreal::preserve_vtableacross testResetcalls).crates/xcl/src/hle/d3d12x/format_alias.rs: placed texture alias tracking (list_reset), RAIIOwnedCopyLocbuffer-through sync (max(src_pitch, dst_pitch)),COMPUTE_VALID_STATES = 0xC48, element byte width / block-scaled dimension checks intry_copy_texture_region, and unit tests informat_alias::tests.crates/xcl/src/hle/d3d12x/bind.rs,device_x.rs,late_release.rs,list_x.rs,real.rs:rs_cs+rs_gfxrestoration (restore_after_internal_pass),is_adopted-guardedlate_release::drain_known,dev_create_placed_resource_x+dev_create_uav_xintegration (#1914companion SRV +slot.pc_srvtwin SRV +#2280pc_clear_for_desc), and Enhanced Barrier (#146) / UAV (#26) routing inlist_x.rs.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), WARP (XCL_ADAPTER=warp), rebased cleanly onto569f0fc5(bfafdf77).cargo check --workspace --tests: passed (0warnings in touched files).XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4: 251 passed, 0 failed, 2 ignored (4.25s,0crashes).XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias": 9 passed, 0 failed (0.11s,0D3D12 debug errors, includingenhanced_barriers_handle_texture_subresources_uav_and_discardandgpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test).Regression run
scripts/smoke.ps1pair onbfafdf77vs569f0fc5has not been run yet. AMD and NVIDIA reviewers are invited to test onbfafdf77vs569f0fc5(includingscripts/smoke.ps1,depth_uav/format_aliasGPU tests, and world lighting/depth-UAV workloads) and post results in the comments.Not tested
scripts/smoke.ps1pair onbfafdf77, fullcargo test --workspacesuite onbfafdf77, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
569f0fc5, and unit/GPU tests; the author reviewed the diff and test output.