D3D12.X: title texture refresh walks the written pages, not every texture #2397
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#2397
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@KOLESNiii on GitHub · 2026-11-25 17:43 UTC · original
Part of #2390.
On every submit that has written pages,
title_textures::refresh_once(crates/xcl/src/hle/d3d12x/title_textures.rs:791-815onmain3f4495a) holds theTEXTURESlock and walks every registered texture (t.by_res.iter_mut()). For each one it binary-searches the sorted dirty list. The cost grows with the number of textures times the number of submits, about 120 a second in my title's menus, even when only a few pages were written.Proposal: keep an index of the textures by source address (a
BTreeMap<src, res>next toby_res) and walk the dirty pages instead. For each run of dirty pages, take the textures whose[src, src + size)overlaps it. The pending textures are already counted inPENDING, and could be kept in their own list.Smaller than the other parts. It is worth doing once a title keeps thousands of textures in step.
Found by code reading with Claude Code (Claude Opus 5.5); not measured yet.
@itsSio on GitHub · 2026-11-25 23:03 UTC · original · edited 2026-11-25 23:51 UTC
Completed #2397 on my fork (itsSio/xcl#5, branch
d3d12x/title-textures-dirty-index, commit7a7b3acf), staged as a fork draft PR pending paired retailscripts/smoke.ps1runs before upstream submission.Update:
xcl-dev/xcl:amd-dev(1286a94by @raylitebull) andxcl-dev/xcl:nvidia-dev(9acc031by @theaustinayers) already implement dirty-page range indexing fortitle_textures.rs, so itsSio/xcl#5 is kept as a draft reference only.Implemented (
7a7b3acf)crates/xcl/src/hle/d3d12x/title_textures.rs(+312/-40): addedby_src((src, res) -> src + size),max_active_src_size, andpending_restoTable(kept in sync acrossinsert,remove,retire_range,recheck_gpu_view_sources, andrecheck_streamed_unwatched_at), extractedTable::collect_dirty_and_pendingfor coalesced dirty-page span lookups +pending_resdrains, and added 3 pure-CPU unit tests (exact boundaries/coalesced runs, mirror/shadow/retire/pendingtransitions, and randomized + 16k-texture parity against a full scan).Tested (debug build, clean commit
7a7b3acf1ef687ddaeff13189e225c2e84aa3d1a)32.0.16.1088, rustc 1.97.0, DXC 1.9.2609.5):cargo test --workspace -- --test-threads=4: 1426 passed, 0 failed, 46 ignored (26SKIPPED: 21no wave64, 3#1426f16/cvt per-lane refused, 1 Windows Developer Mode required for driver-cache disable, 1 no heap windows).cargo test -p xcl --lib title_textures -- --test-threads=1: 22 passed, 0 failed, 0 ignored (0SKIPPED).32.0.16.1088, rustc 1.99.1, SDK DXC 1.8.2502.11):cargo test --workspace -- --test-threads=4: 1426 passed, 0 failed, 46 ignored (29SKIPPED: same 26 as Main PC + 3no d3d12SDKLayers.dll/ D3D12 debug layer).cargo test -p xcl --lib title_textures -- --test-threads=1: 22 passed, 0 failed, 0 ignored (0SKIPPED).Not tested
XCL_SAMPLE_*tests (unset), retail titlescripts/smoke.ps1regression runs, and release builds.AI use
Ran via Samaritan: