D3D12.X: title textures share video-memory pages on a macOS host too #2402
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!2402
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2402"
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?
@vakaobr on GitHub · 2026-11-25 17:50 UTC · original
vakaobr:d3d12x/mac-shared-title-pages→main· +198 −1 · 2 files · 2 commits · draftStacked on #2361; only the top commit belongs here. Part of #258.
On a Mac, title textures never use #288's shared video-memory pages: D3DMetal reports
D3D12_FORMAT_SUPPORT2_TILEDfor no format, soreservablerefuses every texture and each title texture keeps a copy of its own in video memory (about 16 GB more wired memory while a title loads). D3DMetal does make these reserved textures, but a texture written by a copy and read through another reserved texture on the same tiles reads scrambled bytes unless it is block-compressed or made withALLOW_UNORDERED_ACCESS. On a macOS host (util::mac_host) this takes block-compressed formats and formats with typed unordered access onto the pages, and gives the latter the unordered-access flag. Render and depth targets and GPU-owned textures stay in arenas. Windows is unchanged.To run on a Mac this also needs #1904 (D3DMetal's vtable layout; without it, placing the texture faults in
GetResourceTiling) and a deferred release for Releases that come from D3DMetal's own threads (#2445 + #2498; without it, a list that touches the texture never completes).What is in it
crates/xcl/src/hle/d3d12x/vram.rs:native_page_flags;reservableandplace_on_pagesuse it on a macOS host; testsampled_textures_at_one_address_share_their_pages_in_every_slice.Tested
x86_64-pc-windows-gnu, debug, at861903f(on #2361's6d6a3e3, onmain65fc114).cargo test -p xcl --lib --target x86_64-pc-windows-gnu --no-run, then every test inhle::d3d12x::title_texturesandhle::d3d12x::vramone per process in a CrossOver bottle (<exe> --exact <test> --test-threads=1):churn_update_tile_mappings_timing), none SKIPPED. Without this commit on the same stack: 32 passed, 3 failed (placed_title_textures_share_vram_and_preserve_pixels,reservable_agrees_with_the_driver, the new test), 1 SKIPPED, 1 ignored.d32s8_targets_take_their_own_size_of_video_memory, fault (the last one also crashes or hangs without this commit); 31 passed, 1 timed out, 1 ignored.Regression run
scripts/smoke.ps1on.Memory on a Mac: use with #2306's level pages. These textures get pages under every level unless
XCL_TEXTURE_LEVEL_PAGES=1(#2306, off by default) maps a level when its texels come. shortside ran a retail title on a 24 GB M5 Pro with this change's earlier version on the Mac branch from #258 (which has neither #2306 nor its level-by-level mapping on this path): wired memory about 80 s into loading was 16.5 GB with shared pages, 12.6 GB without (XCL_VRAM_ARENAS=1), and 12.3 – 14.0 GB with their level tiles. So on a Mac this should go with level pages, and the Mac branch keeps it off by default for now. Whether this plusXCL_TEXTURE_LEVEL_PAGES=1beats committed copies on a Mac is not measured: I have no title to run.Formats this leaves with a copy of their own (measured on D3DMetal; nothing to change here): of 11 formats I checked (depth, typeless and SNORM ones that are neither block-compressed nor plain typed-UAV), the ones left out are the depth formats.
D16_UNORMandD32_FLOATcan be made reserved, but a depth target cleared through one reserved texture reads back wrong through another on the same tiles (3968 of 4096 pixels);D24_UNORM_S8_UINT,D32_FLOAT_S8X24_UINTandR32G8X24_TYPELESScannot be made reserved at all. A render target with unordered access (R8G8B8A8_UNORM) does share correctly (0 of 4096 wrong); letting render targets onto the pages is a follow-up.Not tested
AI use
main, ported the change, wrote the test, ran the tests above under CrossOver, found the two runtime prerequisites, and drafted the commit message and this description.@FIJI1299 on GitHub · 2026-11-25 17:56 UTC · original
Summary of Test Results for Commit
861903fon Windows 11Environment
621.35,wave32)1.8.2502.11(Windows SDK10.0.26100.0)Test Execution Summary
hle::d3d12x::vramsuite (cargo test -p xcl --lib hle::d3d12x::vram):.\scripts\test.ps1):gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState->E_OUTOFMEMORY0x8007000Eon NVIDIA driver during full sequential run).no wave64support.wave32form refusals (unsupported V_CVT_F16_F32 / V_MUL_F16 / V_PK_MUL_F16: VOP3 modifiers).0x887A002D— requires Windows Developer Mode).@DavidM1911 on GitHub · 2026-11-25 19:15 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
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.