D3D12.X: a placed sparse buffer can wait for its tiles until first use #2798
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!2798
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2798"
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?
@MacieGx on GitHub · 2026-11-26 13:50 UTC · original
MacieGx:sparse/lazy-placed-buffers→main· +145 −9 · 1 files · 1 commits · openA placed sparse buffer can now be made without video memory and get its tiles when a list is about to use one of its addresses. This is preparation with no change in behaviour: nothing places a buffer lazily yet. The next PR uses it for the GPU-only buffers that the newer retail title places outside the memory windows; today those get an empty V#, so their light, ray and tile lists read as empty. Part of #505.
Why lazily: the title places 128 or more such buffers (about 580 MB) at start. In a lab tree that gave all of them video memory at once, the runs ran out of RAM before the world. Placed lazily, 108 buffers / 526 MB were in use 25 s into the world (573 of 578 MB by 365 s in a longer run).
#2539 (open) also changes
sparse::place_buffer; whichever lands second rebases. #637 (open) mirrors views of buffers outside UMA from their CPU pages, which these GPU-only buffers do not have.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:place_buffer_when(.., lazy), withplace_buffer=place_buffer_when(.., false)as before;use_range(va, len)maps the waiting buffers in that range, and checks two atomics before it takes the state's lock;State::back_buffer(the tile mappingplace_bufferdid inline),take_lazy,lazy_bounds;forget_indrops a buffer released before its first use;Tested
cargo test -p xcl --lib -- hle::d3d12x::sparse --test-threads=4: 19 passed, 0 failed, 1 ignored (the two new tests among them), no SKIPPED lines.stable-x86_64-pc-windows-msvc, release.cargo build --release --workspace && cargo test --release --workspace --no-fail-fast -- --test-threads=4on1b11d3d: 1433 passed, 4 failed, 47 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState: out of memory (0x8007000E)), which fail onmainas well. SKIPPED (the same as onmain): 21 "no wave64", 3 refused by the per-lane form,heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record.Regression run
main:
this PR:
Not tested
AI use
main's sparse state, wrote the tests and this description; Claude Opus 5.5 (coordinating) ran the full suite and the regression runs and reviewed the diff.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.