D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers #1989
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1989
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1989"
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?
@raylitebull on GitHub · 2026-11-25 00:26 UTC · original
raylitebull:feat/lit-world-d3d12x-v2→main· +4347 −90 · 8 files · 1 commits · openAdds 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.@gsucristo on GitHub · 2026-11-25 00:57 UTC · original
Technical review findings:
Blocking
depth_uav.rs:873-899copy_plane_through_buffer,format_alias.rs:696-722copy_one_subresource_through_buffer): Both populateD3D12_TEXTURE_COPY_LOCATION::pResourcewithManuallyDrop::new(Some(res.clone()))(AddRef), then callstd::mem::forget(...)withoutManuallyDrop::drop. This leaks +1 ref onsrc, +1 ref ondst, and +2 refs on the per-listCopyScratchbuffer per subresource per copy, preventingres_releasecleanup and leaking VRAM monotonically.FullscreenPassDepthToTwincompute dispatch (depth_uav.rs:1429-1438execute_syncs,list_x.rs:3857-3861resource_barrier_x):resource_barrier_xemits the global UAV barrier beforedepth_uav::execute_syncs. InDepthToTwin(FullscreenPass), the compute shader writestwin_resvia UAV whiletwin_resstays inUNORDERED_ACCESSand returns without a UAV barrier ontwin_res, racing subsequent title compute dispatches.restore_after_internal_passclobbers PC root signatures, root parameters, and dynamic depth-bias PSO state (list_x.rs:134-147,depth_uav.rs:1317-1336, 1423-1435):FullscreenPasscallsSetGraphicsRootSignature/SetComputeRootSignatureandSetPipelineStateon the PC list (invalidating bound root parameters), butrestore_after_internal_passdoesn't restore the title's PC root signature/root args or handleusing_fallback_pso/pso_dirty/RSSetDepthBiasX.StateBeforemismatches (depth_uav.rs:197-198, 563-642, 763-774, 802-827):Entrytracks only onepc_state_depth/pc_state_stencilper plane instead of per subresource, so a single-subresource barrier transitions all0..per_planesubresources.entering_uavsetsbefore_depth/before_stencilto the title'sbeforeinstead ofprev_d/prev_s.before_bind_dsv,PlaneMask::Bothtransitions both planes toe.pc_state_depthwithout updatinge.pc_state_stencil.depth_uav.rs:1128, 1147, 1179, 328-346):pass_dsv_heapandpass_srv_uav_heapare created viaorig_fn(dev_raw, 14)(bypassinglate_release), sodepth_uav::forgetdrops them immediately even if a command list that bound them is still in flight on the GPU.RENDER_TARGETstate allowed onCOMPUTElists (format_alias.rs:755sync_pair): The non-DIRECT guardst & !0xC4F != 0permits0x4(RENDER_TARGET),0x2(INDEX_BUFFER), and0x1(VERTEX_AND_CONSTANT_BUFFER), which are illegal onCOMPUTEcommand lists.Major
placed_uavs/placed_srvsinformat_alias.rsownID3D12Resources permanently (never evicted onforgetor VA reuse), andon_uav_barriercopies everyPlacedUavpair on the device on globalbind::activity()changes.note_title_transitionreturns early whenACTIVE_PAIRS == 0(leavingpc_statestale for textures that transitioned before their alias peer was created) and ignoressubresource/ split-barrierBEGIN_ONLYflags.try_copy_texture_regionskipscan_copy_through_bufferand only comparesrows/RowPitch/Depth, which can silently alias incompatible bytes-per-texel formats that share the same 256-byte-alignedRowPitch.dev_create_uav_x(real.rs:2435-2449) creates the paired SRV (slot.pc_srv) on the original depthresrather thanuav_res(twin_res).@futurepro62 on GitHub · 2026-11-25 00:59 UTC · original · edited 2026-11-25 01:10 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
3443fd3(on its base8c4a46a).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 991 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.twin_plans_cover_console_depth_formats,uav_format_and_plane_classification,state_machine_handles_split_and_async_compute_transitions,uav_barrier_returns_zero_for_untracked_resources,r32_uint_and_r9g9b9e5_alias_needs_buffer_through,placed_uav_and_srv_descs_are_sanitized,alias_table_links_in_both_creation_orders.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1001 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@Anon64 on GitHub · 2026-11-25 01:47 UTC · original
Regression run for this PR: head
3443fd3, based onmain80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
80f4819: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:
XCL_DIRECT_DXILandXCL_HEAP_WINDOWSunset).Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@raylitebull on GitHub · 2026-11-25 01:53 UTC · original
Thanks for the exhaustive review and every single catch,
@gsucristo!Updated
#1989cleanly ontobf9eebd(39d08cc), addressing all 6 Blocking + 4 Major findings:depth_uav.rs,format_alias.rs): replacedManuallyDrop::new(Some(res.clone()))+mem::forgetwith RAIIOwnedCopyLoc(ManuallyDrop::drop) so COM refcounts and VRAM never leak.DepthToTwinUAV barrier (depth_uav.rs): emitted an explicitD3D12_RESOURCE_BARRIER_TYPE_UAVontwinimmediately afterFullscreenPassDepthToTwindispatches.bind.rs,list_x.rs): trackedbind::rs_csalongsiders_gfxand updatedlist_x::restore_after_internal_pass(list, clobbered_gfx, clobbered_cs)to restore PC root signatures,bound_pso,using_fallback_pso/pso_dirty, and dynamicRSSetDepthBias.depth_uavtracking: replaced scalar plane states with per-subresourcepc_states_depth/pc_states_stencil+split_uav_*, used trackedprevstates onentering_uav, preserved separate per-subresource depth/stencil states onbefore_bind_dsvPlaneMask::Both, and scoped transitions/copies (copy_direct_subs,transition_plane_subs) to the targeted subresources.late_release.rs,depth_uav.rs,format_alias.rs): guardedlate_release::drain_knownwithreal::is_adoptedand routedpass_dsv_heap/pass_srv_uav_heapteardown + evicted alias textures throughlate_release::hold.format_alias.rs::sync_pair): replaced0xC4FwithCOMPUTE_VALID_STATES = 0x8 | 0x40 | 0x400 | 0x800(0xC48).depth_uav.rs,format_alias.rs,real.rs): evicted stale/orphanedplaced_uavs/placed_srvsonforgetand VA reuse (late_release::hold), scopedon_uav_barrierto specific barrier targets when non-global, trackednote_title_transitionbefore peer creation with per-subresourcepc_states+BEGIN_ONLYignore, validated element byte width and block-scaled dimensions intry_copy_texture_region, and pointeddev_create_uav_x's paired SRV (slot.pc_srv) attwin_resinstead of depthres.Compiled cleanly in release (
0errors) and pushed39d08ccfor GitHub ActionsBuild and test+ reviewer verification.@raylitebull on GitHub · 2026-11-25 01:58 UTC · original
Fixed the
Build and testcompile error in197b104(rebased cleanly onto1e4fc10):Noneas thespecific_targetsargument tosuper::format_alias::on_uav_barrier(this, None)atcrates/xcl/src/hle/d3d12x/list_x.rs:2889.descbinding incrates/xcl/src/hle/d3d12x/real.rs.@JJAutoCompare on GitHub · 2026-11-25 02:25 UTC · original
PR #1989 GPU verification
PR head
197b104b7a97a0fd9f68c7602291660802f552c4was fetched fromoriginatrefs/pull/1989/headand tested in a clean detached worktree. Fetchedorigin/mainwasaaa093657bd96a146c05c0c1a9b61149fe761453.git merge-tree --write-tree origin/main HEADexited 0 with treec301c54bdb36c4dc9be3e1b1c779e01438160404and no conflicts.Tested
32.0.101.9175,DoublePrecisionFloatShaderOps=0, wave size 8–32), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build26200.9974.rustc 1.100.0 (0ef1bc386 2026-11-09). DXC and DXIL1.9.2609.5.cargo build --workspaceandcargo test --workspace --no-runboth succeeded in unoptimized profiles with debug info and incremental compilation disabled.cargo test -p xcl --lib hle::d3d12x::depth_uav::tests -- --show-outputreported 4 passed, 0 failed, 0 ignored, 0 skips.cargo test -p xcl --lib hle::d3d12x::format_alias::tests -- --show-outputreported 3 passed, 0 failed, 0 ignored, 0 skips.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputcompleted in one pass. Cargo exit 101. Across 20 harness summaries, libtest reported 1100 passed, 28 failed, 46 ignored. There were 27 SKIPPED lines across 17 tests, including partial skips. The harness pass count includes early returns. Skipped paths are excluded from coverage.CreateComputePipelineStatereturned0x80070057. The other five reported result mismatches in FMA contraction, implicit LOD sampling, split-wave reduction tails, 16/64-bit VALU, and pixel-shader whole-wave reductions.test_title_runs_and_game_folder_is_untouched. Its dynamic depth-bias check (#94) read blue[0, 0, 255, 255]where the test expected green afterRSSetDepthBiasX(-1000.5).L:\XclTooling\sol-slot-9\tmp\pr1989-suite.log.SKIPPED output
Not tested
mainand the PR head, execution of the synthetic merge tree, and AMD or NVIDIA adapters. This run had nomainbaseline for the failures.XCL_SAMPLE_RPF,XCL_SAMPLE_TTPF, andXCL_SAMPLE_AWCinputs. The seven targeted CPU tests covered format, state, and alias tracking logic. Retail GPU execution of depth/UAV twin synchronization, alias copies, and dual-twin barriers remains unverified.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
pr1989-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 03:33 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
@CharlyRien on GitHub · 2026-11-25 09:45 UTC · original
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
Setup in short:
197b104merged three-way into a local tree (main689f2db+ a stack of open PRs, listed in the linked comment; 9 conflicts, both sides kept), RTX 3090 24 GB (driver 616.56), Windows 11 22631.on_uav_barrier/filter_transition), and this title uses enhanced barriers (list #146), which end up as a global UAV barrier. Sobefore_bind_dsvfinds nothing dirty and the depth target stays 100 % zero.R24_UNORMplane, or a later overwrite.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.
@raylitebull on GitHub · 2026-11-25 11:03 UTC · original
Thanks so much for catching the D24S8 Enhanced Barriers sync issue on RTX 3090,
@CharlyRien(#issuecomment-7158762448)!Rebased
#1989cleanly ontof087b998(3c86172c) and fixed the Enhanced Barriers / global UAV sync path plus two additional bugs uncovered under the WARP D3D12 Debug Layer:#146list_x::uav_barrier_x) & global UAV barriers (#26res == 0):depth_uav::filter_enhanced_barriersto parseD3D12_BARRIER_GROUP(D3D12_BARRIER_TYPE_TEXTUREandD3D12_BARRIER_TYPE_GLOBAL) on slot#146, executingTwinToDepth/DepthToTwin/TransitionOnlydirectly onDIRECTlists (handlingAccess*,Layout*including queue-specific layouts,DISCARD,UNDEFINED, and per-planeSubresources) and deferring cleanly onCOMPUTElists.depth_uav::on_global_uav_barrierto mark materialized twins dirty on#146global barriers and#26wildcard UAV barriers only when!plane_dirty(so compute-written depth+UAV targets flush onbefore_bind_dsvwithout overwriting graphics-rendered depth targets).before_bind_dsvSTATE_COMMONlegal state &CreatePlacedResource#29hook:D3D12_DSV_FLAGS(READ_ONLY_DEPTH/READ_ONLY_STENCIL) innote_dsvso flushing a target still inSTATE_COMMONtransitions to legalDEPTH_READ/DEPTH_WRITEinstead of illegalSTATE_COMMON.depth_uav::register_if_depth_uavintoreal.rs::dev_create_placed_resource_x(#29) and integrated upstream#1914uav_companion_srv+null_uav_descindev_create_uav_x.RowPitchmismatch incopy_plane_through_buffer(depth_uav.rs,format_alias.rs):R24G8_TYPELESSplane 1 (stencil) can reportRowPitch = 512while itsR8_TYPELESStwin reports256, previously dropping the stencil copy onsrc_fp.RowPitch != dst_fp.RowPitch. Unified both footprints tomax(src_pitch, dst_pitch)in bothdepth_uav.rsandformat_alias.rs.Verified on WARP (
XCL_ADAPTER=warp,XCL_D3D12_DEBUG=1):cargo check --workspace --testsPASS (0warnings in touched files) andhle::d3d12x::depth_uav+hle::d3d12x::format_alias9 passed, 0 failed (0.07s), includingenhanced_barriers_handle_texture_subresources_uav_and_discardand GPU draw testgpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test(D24_UNORM_S8_UINTandD16_UNORM_S8_UINTDepthFunc = EQUAL+ stencil preservation,0D3D12 debug errors). Pushed3c86172c!@raylitebull on GitHub · 2026-11-25 11:12 UTC · original
Fixed the
0xc0000005crash ingpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_testunder--test-threads=4in commit51ee197c(rebased cleanly onto96331383):real::adopt(dev, Kind::Device)before creating its own test PC heaps/resources (uav_heap,dsv_heap,rtv_heap, PSOs, depth targets), causinguav_heapto be adopted with the consoleheap_cpu_start_xRAX-return ABI instead of PC's hidden out-param when called viawindows-rs.depth_uav.rs): created all test PC heaps, resources, footprints, and depth targets before adoptingdevandlist, usedorig_fn(dev, 21)forCreateDepthStencilViewafter adoption, and cleaned upPIPELINESfordevon test exit.XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(2 consecutive runs):214 passed, 0 failed, 2 ignored(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.09s,0D3D12 debug errors).Pushed
51ee197c!@ivall on GitHub · 2026-11-25 15:16 UTC · original
The crash in
gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test(0xc0000005, the CI failure of51ee197looks like it) is the test, not the twin code: fix below. With it, all tests of this PR pass on AMD.On AMD RDNA4, Windows, DXC 1.8.2502.11,
51ee197merged into my tree (main+ other open PRs), debug, the test crashed every time without the debug layer and passed withXCL_D3D12_DEBUG=1.Backtrace:
list_x::transition(list_x.rs:124) ←execute_syncs←before_bind_dsv← phase 2 of the test, reading the vtable slot before the list's vtable at0xffffffffffffffff. The runtime'sResetputs its own vtable back on the list; the title's path restores XCL's (preserve_vtable, called inlist_x::reset_pc). The test calls the originalResetat both phase changes and does not. The debug layer's list does not swap it, so the test passed there.After both resets:
cargo test -p xcl --lib -- hle::d3d12x --test-threads=4: 254 passed, 0 failed, 2 ignored (merged tree, so not only your tests).Not checked: the
D16_UNORM_S8change you described (the stencil-read depth asR16_UINTtimesasfloat(0x37800080)) is not in51ee197, so I have not run it; and no title run with this PR yet.AI use: Claude Code (Claude Opus 5.5) found it, wrote the fix and this on the maintainer's behalf.
@Toons29 on GitHub · 2026-11-25 03:51 UTC · original · edited 2026-11-25 15:29 UTC
Regression run of
51ee197con the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 103 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; both blocks are exactly as printed, and I approved posting this.@raylitebull on GitHub · 2026-11-25 18:15 UTC · original
Thanks for tracking down the debug-layer-off
Resetvtable overwrite on RDNA4/CI and sharing the exact fix,@ivall(#issuecomment-7166572303)!Updated
#1989cleanly onto73e3aba6(ced48914):Resetvtable preservation (depth_uav.rs): wrapped bothreset_origcalls ingpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_testwithlet ext = *(list.as_raw() as *const usize); assert_eq!(reset_orig(...), 0); real::preserve_vtable(list.as_raw(), ext);so the PC runtime'sResetdoes not overwrite XCL's vtable whenXCL_D3D12_DEBUG=0.D16_UNORM_S8_UINTdepth/stencil note: for consoleD16_UNORM_S8_UINT(118..=120),depth_uav.rsallocates anR16_TYPELESS(53) depth twin and binds theFullscreenPassSRV asDXGI_FORMAT_R16_UNORM(56), which convertsu16depth directly in hardware without needing an explicitasfloat(0x37800080)scale (and if a title performs a separate stencil-view read on aD16_UNORM_S8_UINTtexture, we can check that in a dedicated follow-up).ced48914):XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa->236 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.09s,0D3D12 debug errors).Pushed
ced48914!@raylitebull on GitHub · 2026-11-25 18:24 UTC · original
Rebased
#1989cleanly onto569f0fc5in commitbfafdf77, resolving thereal.rsadjacency conflict cleanly alongside#2280(pc_clear_for_desc+effective_st).Verified on WARP (
bfafdf77):cargo check --workspace --testsPASS (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).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).Pushed
bfafdf77!@St5sz2Jk on GitHub · 2026-11-26 00:00 UTC · original · edited 2026-11-26 01:50 UTC
Linux / Wine / RADV (RX 9070 XT) on
bfafdf7: all of this PR's tests pass with vkd3d-proton once the GPU test's two direct submits use #871'sUnadoptGuard(part 1). In the retail title the twins are created and sync thousands of times, but the cutscene frame behind the credits and subtitles stays the flat grey of #970. One run each.Setup:
ec207194.main+ #871 + #684 + #433 + #2357 (see #1269).vram.rs(the fences of #871 againstmain's retire changes).Correction (edited): my first version of part 1 came from a test run without
WINEDLLOVERRIDES. It used Wine's built-in vkd3d, not vkd3d-proton, and that run failed atfmt 44 stencil at (2,2)(0 for 17). With vkd3d-proton loaded, as the title runs:1. This PR's tests under Wine + vkd3d-proton (each run alone): 8 passed.
gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_testcrashes:d3d12core.dll+0x597fbd=d3d12_command_queue_ExecuteCommandLists.cold. In other words, vkd3d-proton was handed a command list it does not recognise; its release build has the vtable check compiled out.q.ExecuteCommandLists(&[Some(list.cast().unwrap())])submit a list whose vtable XCL patched. Wrapped in #871's guard, the test passes on RADV + vkd3d-proton, stencil check included: So the twin sync itself works on this driver. Only the test needs the guard under Wine (with #871). #1993's copy-back submit had the same crash, and the same line fixed it (#1993).2. The retail title, to the opening cutscene (
XCL_HEAP_WINDOWS=1, frame dumps):2560x1440x1, console fmt 19, two_plane true;2560x1440x1, console fmt 118, two_plane true;fmt 53).TwinToDepthand more than 4096 other syncs ran (execute_syncs, counted with local logging).3. Two other things the runs showed (not caused by this PR):
main's newvram::retire_heaps_and_sweepmakes its retire fences withdev.CreateFence. Under Wine the title then crashes about 20 s in, inRetireQueue::retire_with(IUnknown::clone, read of-1).real::create_raw_fencethere fixes it. #871's current head153730dalready does this.a UAV of a resource that cannot have one on the PC (a depth buffer) – a null view) are not depth buffers. They areR8G8B8A8_UNORM_SRGBrender targets with UNORM UAV views:pc_resource_descdropsALLOW_UNORDERED_ACCESSfrom them, because sRGB has no typed UAV.R8G8B8A8_TYPELESS(and gave description-less RTVs of them an sRGB format). The null UAVs went away, but the grey stayed, so they are not the cause of it.Update: a title assert with this PR in a longer run (one run each).
main569f0fc+ #871 + #684 + #2357 + #1993 (with itsUnadoptGuardline) + #751;XCL_TARGET_PAGES_MB=6144, warm caches.bfafdf7): the title asserts (0x80000003atgame+0x5149aec, 7 times) from about 614 s. I stopped the run there.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.
@CharlyRien on GitHub · 2026-11-26 05:42 UTC · original
Test report, RTX 3090: a title-placed R32_UINT writer never reaches its R9G9B9E5
PlacedSrvreader when the title moves it with enhanced barriers. Copying it at the reader's bind, with copy buffers of its own, fills the screen-probe radiance atlas: from 0–10 KB to 2.5 MB non-zero of 4.96 MB. The picture is still over-exposed, so this is one missing piece, not a fix of the frame. One run per arm.What happens (read in
format_alias.rs)buffer_through true). It is synced only from a legacy transition out of a write state, or from a UAV barrier forPlacedUavwriters. This title uses enhanced barriers and aTitlePlacedwriter, so neither path fires and the reader stays zero.Local changes (local commits on our tree, not pushed)
sync_pairruns for anyPlacedSrvreader whose pair has aTitlePlacedwriter. A UAV barrier and a null aliasing barrier come before the copy.CopyResourceon Microsoft Learn, as 1:1 pairs. We copy texture to texture, with no intermediate buffer. Measured bit-exact on this 3090, with 0 debug-layer messages.Measured (in the title, captures of the reading pass and of the frame)
Setup
maine1d84b7dmerged with our integrated tree, which carries #1989 at197b104and #2384 (ported), plus local diagnostics. On top: the three changes above, behind local switches.XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0 XCL_GPU_VIEW_BUFFERS=1 XCL_DIRECT_DXIL=1 XCL_PAGE_BUDGET_MB=1024 XCL_GPU_VIEW_MB=1024, plus the switches of each row.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.
@DavidM1911 on GitHub · 2026-11-26 06:51 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.