Repository navigation
Conversation
util::mac_host(): the process runs under Wine on a Mac (CrossOver or the Game Porting Toolkit), where D3D12 is Apple's D3DMetal and the title's code runs through Rosetta 2. ntdll's wine_get_host_version names the host's system; "Darwin" is a Mac. XCL_MAC_HOST=1 / 0 overrides it. Nothing calls it yet. The Mac changes that need to know they run there (the barrier default, title textures on shared pages) build on it; until now only Ahmet-Dedeler's mac7 branch had it. Part of xcl-dev#258.
xcl-dev#288's shared pages never run on D3DMetal: it reports D3D12_FORMAT_SUPPORT2_TILED for no format, so `reservable` refuses 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 on a Mac). D3DMetal does make the reserved textures. Measured with copies and shader reads on CrossOver 26.3: a texture written by a copy and read through another reserved texture on the same tiles reads scrambled bytes, whatever the barrier, format or layout. Block-compressed textures, and textures made with ALLOW_UNORDERED_ACCESS, share correctly. The likely reason is compression state that D3DMetal keeps per texture, not per tile. On a macOS host (util::mac_host): - `reservable` skips the TILED bit and accepts block-compressed formats and formats with typed unordered access (single-sample only); - `place_on_pages` gives the reserved texture ALLOW_UNORDERED_ACCESS unless it is block-compressed. Render and depth targets, and the GPU-owned `place`, stay in arenas: their sharing was not probed. Windows is unchanged. sampled_textures_at_one_address_share_their_pages_in_every_slice places two 256x256, 4-slice, 9-level textures (RGBA8 and BC7) at one address, writes all 36 subresources through one and reads them through the other. On the Mac it needs the native-host vtable fix of xcl-dev#1904 and a deferred release for D3DMetal's own threads: without the first, placing the texture faults in GetResourceTiling; without the second, a list that touches it never completes. With both, it fails without this change (not placed on the pages), passes with it, and fails again if RGBA8 gets no unordered-access flag (every subresource reads back wrong). Part of xcl-dev#258.
A title's GPU-owned textures (render targets, depth targets, UAVs) are placed through vram::place, which asks place_on_pages with require_aligned. On a Mac, xcl-dev#2402 returned there for all of them, so a render target never reached the shared pages; its own RT/DS flag check was never reached by a title's texture. Render targets share correctly on D3DMetal: with two reserved textures on the same tiles, an R8G8B8A8_UNORM render target (RT + UAV) cleared through one reads back through the other with 0 of 4096 texels wrong. A D32_FLOAT depth target reads back with 3968 of 4096 wrong (D3DMetal's compression state, kept per texture). Both measured with raw CreateReservedResource / UpdateTileMappings probes on an M5 Pro under CrossOver 26.3. On a macOS host, place_on_pages now lets render targets through the require_aligned return; they get ALLOW_UNORDERED_ACCESS from native_page_flags, and one whose format has no typed UAV still stays in its arena (native_page_flags is None). Depth targets and the other GPU-owned textures keep their arenas. Windows is unchanged. render_targets_at_one_address_share_their_pages places two render targets at one address through vram::place: it fails without this (not on the shared pages) and passes with it, 0 of 65536 pixels wrong.
A title's GPU-owned textures (render targets, depth targets, UAVs) are placed through vram::place, which asks place_on_pages with require_aligned. On a Mac, xcl-dev#2402 returned there for all of them, so a render target never reached the shared pages; its own RT/DS flag check was never reached by a title's texture. Render targets share correctly on D3DMetal: with two reserved textures on the same tiles, an R8G8B8A8_UNORM render target (RT + UAV) cleared through one reads back through the other with 0 of 4096 texels wrong. A D32_FLOAT depth target reads back with 3968 of 4096 wrong (D3DMetal's compression state, kept per texture). Both measured with raw CreateReservedResource / UpdateTileMappings probes on an M5 Pro under CrossOver 26.3. On a macOS host, place_on_pages now lets render targets through the require_aligned return; they get ALLOW_UNORDERED_ACCESS from native_page_flags, and one whose format has no typed UAV still stays in its arena (native_page_flags is None). Depth targets and the other GPU-owned textures keep their arenas. Windows is unchanged. render_targets_at_one_address_share_their_pages places two render targets at one address through vram::place: it fails without this (not on the shared pages) and passes with it, 0 of 65536 pixels wrong. On this branch mac7's on_pages() keeps every GPU-owned texture in arenas on a Mac before place_on_pages is asked, so place also takes render targets to the pages there when sampled_on_pages() does (XCL_VRAM_ARENAS=1 still keeps them in arenas). Ported from 4c97142 (xcl-dev#2492), with its test.
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
…M_ARENAS=0 xcl-dev#2402 puts sampled title textures on the shared pages on a Mac, with pages under every level, and xcl-dev#2492 render targets with them. The level tiles (level_tiles) give a streamed texture video memory level by level only once place_pages says no. shortside ran a retail title on mac/integration (xcl-dev#258, 24 GB M5 Pro): about 80 s into loading, wired memory was 16.5 GB with sampled textures on the pages and 12.6 GB without them (12.3 - 14.0 GB on their earlier builds with the level tiles). So on a Mac place_pages and place keep title textures off the pages unless XCL_VRAM_ARENAS=0, as on mac/integration (2b3f3d2); elsewhere XCL_VRAM_ARENAS set still means arenas. With XCL_VRAM_ARENAS=0, main's XCL_TEXTURE_LEVEL_PAGES=1 gives the pages a texture's levels lazily. The two shared-page tests of xcl-dev#2402 and xcl-dev#2492 skip where title textures are kept off the pages (arenas()).
|
Nothing has happened on this PR for 3 days, so it is marked |
|
Still waiting for a maintainer. Stacked on #2402; it still lets render targets share video-memory pages on a Mac and merges cleanly with |
|
Stacked on #2402, which is stacked on a version of #2361 (mac_host). The lines it shares with #2402, #2361, #2363 and #3525 are those base commits. Its own commit (4c97142) changes AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Stacked on #2402; only the top commit belongs here. Part of #258.
On a macOS host, #2402 keeps every GPU-owned texture (
vram::place: render targets, depth targets, UAVs) in an arena, sinceplace_on_pagesreturns atrequire_alignedthere; its RT/DS flag check is never reached by a title's texture. Render targets can share the title's video-memory pages on D3DMetal: with two reserved textures on the same tiles, anR8G8B8A8_UNORMrender target (RT + UAV) cleared through one reads back through the other with 0 of 4096 pixels wrong. AD32_FLOATdepth target reads back with 3968 of 4096 wrong, so depth targets, and the GPU-owned textures that were not probed, keep their arenas. Windows is unchanged.What is in it
crates/xcl/src/hle/d3d12x/vram.rs: on a Mac,place_on_pageslets render targets through therequire_alignedreturn; they getALLOW_UNORDERED_ACCESSfromnative_page_flags, and a format without typed UAV still stays in its arena. New testrender_targets_at_one_address_share_their_pages: two render targets placed throughvram::placeat one address must be on the shared pages, and a clear through one reads back through the other.Tested
x86_64-pc-windows-gnu, debug.vramtests need D3D12.X: preserve native host vtable prefixes and tails #1904 and a deferred release for D3DMetal's threads (then D3D12.X: defer a resource release arriving on a thread XCL did not create #2474, now D3D12.X: a native host's last Release only queues the resource #2445 + D3D12.X: a Release on a thread XCL did not create is made on a Wine thread #2498), so they ran on a stack: Memory: detect a macOS host under Wine (mac_host) #2361 + D3D12.X: preserve native host vtable prefixes and tails #1904 + D3D12.X: read the late-release setting at adoption, not at first release #1789 + D3D12.X: defer a resource release arriving on a thread XCL did not create #2474 + D3D12.X: title textures share video-memory pages on a macOS host too #2402, one test per process in the CrossOver bottle.render_targets_at_one_address_share_their_pages: fails without this change (not placed on the pages), passes with it (0 of 65536 pixels wrong).hle::d3d12x::vram::tests+hle::d3d12x::title_textures::tests, 38 tests: without this change 36 passed, 1 failed (the new test), 1 ignored (churn_update_tile_mappings_timing); with it 37 passed, 0 failed, 1 ignored. No SKIPPED.CreateReservedResource/UpdateTileMappingsprobes on the same Mac; those probes are not in this PR.Regression run
scripts/smoke.ps1on.Not tested
mac_host(), but I did not build or run it there.native_page_flags/reservable), not by a test.AI use