gpu: bind one leased XMem range for cached mesh draws #2295
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2303"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by sydney-0o on 2026-11-25T11:10:53Z.
A cached slot 86 mesh draw can now consume one GPU-written XMem DWORD through a graphics root SRV when
X2W_MESH86_XMEM_SRV=1. The cache publisher proves the shader's four-byte read from DXIL. The runtime checks the physical page and byte offset at bind and submission, orders the consumer queue after the writer's fence, and keeps the lease alive through GPU completion.The source-built fixture covers the wrapped COPY-to-DIRECT path. An ordered draw reads the fresh value in all eight pixels. Omitting the queue wait reads the old value in all eight pixels. A missing writer, a different page, a wrong offset, and an invalid proof marker leave the target clear. A gated consumer also verifies that the original XMem slot stays pinned after the guest mapping is removed and becomes reusable after completion.
Refs #1914, #870. Uses the XMem section lease from #2280.
Validation
Release on Windows 10 build 19045.6456 with app-local WARP 1.0.22 and Agility SDK 1.620.2. The rebased local commit
be2bad9dhas the same tree as this PR head (61a2d313).10 passed, 0 failed, 2 capability skips. Both wrapped mesh cases passed on WARP with the D3D12 debug layer enabled and zero warnings or errors. GTX 1080 Ti (32.0.15.8278) passed the wrapped writer check and skipped the mesh cases. The documentation link and bidi checks also passed.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:12:48Z.
Review: COMMENTED
Review of head
61a2d3139ccca613420a097018af8a7f881a359d(comment-only; no approval, no merge).Overlap with #2280: #2280 is merged (
76a9189c) and is an ancestor of this head. This PR does not redo it. It builds on the lease API and addsx2w_xmem_match_section(export @21,src/xmem_shim.def), aSectionLease{first_byte,length,slots}record, and two shared helpers (mirrored_range,mirrored_backing).x2w_xmem_lease_sectionnow uses those helpers, so there is one copy of the mirror-range and backing check. No duplicate behavior found.Scope read: 17 files, +1413/-69 (
git diff --stat origin/main...HEAD). Read in detail:src/xmem_mapped_pages.cpp,src/xmem_section_lease.h,src/startup_stubs/mesh_xmem_handoff.inl(lease open, write tracking, SRV bind),tools/startup/mesh86_cache.py.What looks right
x2w_xmem_match_section: the page-offset parity check, the bounds against the leasedfirst_byte/length, and the per-slot recheck of the live mirrored backing against the pinned(slab, offset)all hold. I found no overflow:mirrored_rangerejectsaddress + lengthwrap, andlengthis bounded by the lease before the slot arithmetic.!lengthremoval inlease_sectionis safe, becausemirrored_rangereturns false for length 0.prove_mesh_root_srvaccepts only: one raw SRVt0space 0 count 1; onecreateHandle(57, 0, 0, 0); exactly one constant-offset 4-byterawBufferLoadon that handle; and only mesh output ops otherwise. The pixel stage may only do input/output. The proof dumps the bytes staged for publication, not the original paths, so there is no check-then-swap window.v2manifest line is only written after the proof passes.Findings
tests/startup_mesh86_srv_proof_check.py, reject list): there is no mutant with a second DWORD load on the same handle. I replaced thelen(handles) != 1 or loads != handlesguard intools/startup/mesh86_cache.pywithif False:and ran synthetic mesh/pixel dumps throughprove_mesh_root_srv. The two-load dump was then accepted (two-loads ACCEPTED 4), and no Linux-runnable test covers it. The in-repo test needsdxcand could not run here. The compiler may merge two identical loads, but a different-offset or different-mask load on the same handle is already rejected by the regex. A fixture withLoad(0) + Load(0)that survives optimization, or a pure-Python dump unit test, would close this.gh pr checks: Linux Python checks, Windows build/test, gfx1013 fixtures). Please wait for it to go green before moving on.startup_indirect_mesh_lease_*,xmem_section_lease_check) are D3D12/Windows only. I did not run them. The PR body reports 10 passed and 2 capability skips on Win10 + WARP 1.0.22, from a local commit stated to have the same tree. I could not verify that claim from here.Commands run locally (Linux, in a detached worktree of the PR head)
git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: self-test passed; 18 Markdown files, 442 links OK.python3 tests/bidi_controls_check.py: self-test passed; 1593 files, no bidirectional controls.prove_mesh_root_srv: good dump -> 4; wide load, offset 4, space 1, range 1, pixel-stage resource access and two loads all rejected. With the mutation above, only the two-load case flipped to accepted. The mutation was reverted withgit checkout -- ..tests/startup_indirect_mesh_cache_check.pyandtests/startup_mesh86_srv_proof_check.pyneeddxcand a fixture backend. They were not run (nodxcon this host).Clean-room and title: title is neutral, body cites only issues (#1914, #870, #2280). Mergeable: yes.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T11:40:21Z.
Independent physical mesh readback at
61a2d313. Both hardware modes intests/startup_indirect_mesh_cache_check.pyexited 0 on a desktop GeForce RTX 4060, driver 32.0.15.9579, Windows 11 build 26100.9711. I verified the commit stamp and SHA-256 values from the Windows source build before running with Agility SDK 1.620.2 and DXC 1.9.2609.5. The physical device reported the debug layer unavailable.ordered_control: all eight pixels matched the freshly published XMem value. The submitted mesh draw still matched all eight after the guest mapping was removed.skip-wait: all eight pixels matched the stale value. Both runs preserved the argument guards.The commands were
python -B tests/startup_indirect_mesh_cache_check.py <dxc> <startup_indirect_draw_indexed.exe> hardware <xmem.dll> ordered_controland the same command ending inskip-wait.