GPU: guarded in-process copy-back writes into title memory (VICTORY_WRITE_PLAIN=1) #1225
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1225
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1225"
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?
@RealAzemed on GitHub · 2026-11-26 00:41 UTC · original
RealAzemed:perf/plaincopy-guarded-writes→main· +170 −21 · 2 files · 1 commits · openSummary
Adds the symmetric write counterpart to
VICTORY_COPY_PLAIN=1/VICTORY_FILLS_PLAIN=1for shader copy-back writes into title memory (host::write_mapped), gated opt-in behindVICTORY_WRITE_PLAIN=1(off by default, cleanly based onmain006c353).What Changed
crates/victory-gpu/src/plaincopy.rs:victory_write_guarded(rep movsbwith no stack usage, preserving callee-savedrsi/rdiinr9/r10, identical tovictory_copy_guarded).plaincopy::install()'s first-chance VEH handler to catch write access violations / in-page / guard-page faults strictly atvictory_write_guarded_atand redirect RIP tovictory_write_guarded_fault(returningfalse).WRITE_RECENT) so blocks that fault fall straight through toNtWriteVirtualMemory/WriteProcessMemory, plus per-frame telemetry inplaincopy::line().guarded_write_copies_writable_and_falls_back_on_unwritable_pagescovering writable pages, reserved holes,PAGE_READONLYpages, and register preservation.crates/victory-gpu/src/host.rs:write_mapped()throughcrate::plaincopy::write(dst, src, len), falling back to existingNtWriteVirtualMemory/WriteProcessMemory(and 64 KiB piece fallback) whenever off or on any unwritable page.Why
write_mapped's callers already open write guards beforehand (watch::writing), yet every copy-back chunk still crosses into the kernel viaNtWriteVirtualMemory(and crosses wineserver IPC under Wine/Proton). On Linux/Proton (RTX 3070 8 GB, Proton Experimental),VICTORY_WRITE_PLAIN=1handled 100% of copy-back writes in-process (~200–275 writes/frame, 4.5–8.6 MB/frame, 0.0 unwritable faults), helping bringcopy-backdown from ~180–206 ms to ~18–49 ms alongside relay/queue2.Verification
plaincopy::tests::unit tests pass under Proton (0.01s), including the newguarded_write_copies_writable_and_falls_back_on_unwritable_pagestest.victory-gpu(lib + test).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.