D3D12.X: fix sparse buffer uncommitted holes, sub-tile VRAM reclaim, query delta, and heap/DMA leaks #99
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!99
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/99/head"
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-23 11:11 UTC · original
raylitebull:fix/d3d12x-sparse-offsets-and-heaps→main· +678 −81 · 3 files · 1 commits · merged 2026-11-23 11:25 UTCSummary
Fixes 6 bugs in sparse UMA page tracking, placed-buffer offsets, descriptor heap remapping, and DMA command list cleanup in
crates/xcl/src/hle/d3d12x/{sparse.rs, list_x.rs, real.rs}:sparse::place_bufferuncommitted page hole mask (sparse.rs):place_bufferpreviously calledensure_mappedwithholes = 0for all 64 KiB tiles covering[start, va + bytes), even when pages in that range were still uncommitted (MEM_RESERVE/PAGE_NOACCESS), causingreadback_now/readback_rangesto access-violate on uncommitted pages.query_tile_holes(tile)viaVirtualQueryover each 64 KiB tile forplace_buffer, whilecommitted()initializes newly mapped tiles to0xFFFFand clears holes for[a, a + n).sparse::decommittedsub-tile VRAM pool tile reclamation (sparse.rs):decommit_tiles()so incremental sub-tile decommits (e.g. 2 × 32 KiB or 16 × 4 KiB) reclaim and unmap the 64 KiB pool tile back tos.freeas soon asentry.holes == 0xFFFF, pruning stales.to_zeroentries.ResolveQueryData(#30) applyingbuffer_delta(dest)(list_x.rs):real::buffer_delta(dest)tooffsetinresolve_query_data_xfor both PCResolveQueryDataand nested occlusionWriteBufferImmediatewritebacks, fixing misaligned query writes on non-64 KiB-aligned placed buffers.place_console_buffercoherent fallback state & flags sanitization (real.rs):sanitize_coherent_buffer()to maskd.Flagswith0xFFbefore OR-ingALLOW_CROSS_ADAPTERand maskstatewithPC_RESOURCE_STATESon the coherent fallback path (matching the sparse path).CopyDescriptors/CopyDescriptorsSimpleremappingXBOX_EXTRA_CBV_SRV_UAV(real.rs):pc_heap_type(ty)mappingXBOX_EXTRA_CBV_SRV_UAV(4) ->CBV_SRV_UAV(0) acrossdev_create_descriptor_heap_x,dev_increment_size_x,copy_console_slots,dev_copy_descriptors_simple_x, anddev_copy_descriptors_x.Kind::DmaListRelease/Close/Resetoverrides (real.rs):Kind::DmaListtooverrides()so releasing a DMA command list removes itslist_x::LISTSentry and decrements fast-path counters instead of leaking permanently.Testing
query_tile_holes_detects_reserved_noaccess_and_committed_pagesensure_mapped_with_query_holes_skips_uncommitted_pages_on_readbackdecommit_sub_tile_reclaims_pool_tile_when_all_pages_become_holesresolve_query_data_applies_buffer_delta_to_pc_resolve_and_occlusion_writebackcoherent_buffer_sanitizes_console_flags_and_statecopy_descriptors_remaps_xbox_extra_cbv_srv_uav_to_pc_enumdma_list_release_cleans_up_list_state32.0.32015.2008(sparse/coherence D3D12 tests verified on AMD only).origin/main(60599a9):cargo build --workspaceandcargo test --workspace -- --test-threads=4pass (466 passed, 0 failed, 36 ignored, 0 new warnings).@ivall on GitHub · 2026-11-23 11:25 UTC · original
Merged together with #95–#102 and checked on Windows 11 with an RX 9070:
cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), lib tests also withXCL_SPLIT_WAVE64=1; XDefiant (title screen, a scripted A reaches its "Xbox network unavailable" dialog), Unicorn Overlord and Minecraft run. Thanks!