Repository navigation
Conversation
GetWriteWatch refuses a range spanning two reservations; one such range marked the buffer NOT_WATCHED and every later frame copied 100-750 MB of it. Halving the range keeps the rest watched and only the failing piece is copied whole.
D3D12's pipeline library does not load mesh pipelines. A mesh pipeline stored and at once loaded back under its name, with the description that created it, is refused (E_INVALIDARG; the debug layer: the pipeline state desc provided does not match the one used to create the PSO). So it is with trivial shaders and an empty root signature, without the title: on an RTX 3070 with the system runtime (10.0.26100.10068), on WARP, and with the Agility SDK runtime 1.618.1, while graphics and compute pipelines load back on each. Every form of the stream tried fails: the minimum, with an empty amplification shader, without a pixel shader, and the ten subobjects we hand over. In the game, of the 1,800 pipelines the early start makes, the 723 mesh pipelines are compiled in every run (the others load), each is stored again and refused (already exists), and its entry stays in a library that only grows (231 MB here). The first pipeline of a kind that is stored is now loaded back at once; refused, the library gets no more of that kind in the run, and says so once. With the debug layer on, the run's library errors go from 712 "already exists" and 717 "does not match" to one and two. Co-Authored-By: Claude <noreply@anthropic.com> (cherry picked from commit cae3f32d7edfe4ed3aa9e10382678143bc7fe185)
The kernel copy through ReadProcessMemory is one call per copy; the world makes thousands of small ones a frame. Read NtReadVirtualMemory directly for the title's own process.
The kernel read/write copied at 40 MB/s and 10 MB/s here (93 MB a frame read, 35 MB written back: 5.5 s of a 7.2 s world frame). One VirtualQuery per region says the bytes are committed and readable/writable, and the copy is then memory speed; anything else still goes through the kernel call and its page-by-page fallback.
Title memory is view memory with holes, so a whole-range fast path never matched and every put-back went through NtWriteVirtualMemory per 64 KiB piece (~6 ms a call). Walk the runs instead: memcpy what is committed and writable, kernel only for the holes.
A world frame makes ~9,000 title copies of ~600 bytes; one query each cost 5.4 s a frame against 53 ms through the kernel. Below 256 KiB the kernel call is the cheap one. The copystat line now says how many bytes took the memcpy path.
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes from the Linux/Proton run, where the frame is host-side copies and waits (the GPU is ~10% busy):
NtReadVirtualMemoryinstead of a kernel copy per call;memcpycommitted ranges instead of a kernel copy per call;VirtualQueryonly for large reads, and count whatmemcpymoves;The last two pipeline-library commits are Pablo Barros' from Pablo-Barros/VIctory#1683. The zero-padding fix from that series is deliberately left to #238.
Measured on the RTX 3070 host: world frames 0.3–0.5 fps, 2.1–3.6 s/frame; copies 1.1–2.1 s;
copied whole (memory not watched): 0.0 ms/frame; the library logs oncerefuses a mesh pipeline it just storedand stops growing (231 MB here). Nothing in shadow is fixed by this.This is the copy/pipeline part of the original #28, split as asked.
Checked with
cargo xwin check --all-targets -p victory-gpu --target x86_64-pc-windows-msvc. Behaviour on Windows is unchanged exceptNtReadVirtualMemory, which is the same kernel pathReadProcessMemoryuses; not run in the title here.