d3d12: publish texture writes to plain data pages with a store #290
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/290"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T01:11:21Z.
Refs #215. A throughput improvement for texture publication. It does not resolve #215; see the measurements there.
Problem
Publication writes each run of texels back to guest memory with one
NtWriteVirtualMemorycall. Under Wine each call is a wineserver round trip. In the ProjectScarlett intro stall that was about 98k calls per publication job and 90k wineserver context switches per second. The texture readback thread and wineserver spent most of their time on it.Change
write_mappedcopies with a store when the region is committed, exactlyPAGE_READWRITE, and not write-watched.rep movsbroutine. The provider's existing vectored handler resumes it at its failure return if the store faults (access violation, in-page error or guard page). So a page the title decommits or protects mid-copy gives the sameE_FAILas before, not a crash.PAGE_WRITECOPYand executable regions keep the native write, so what a title's write watch sees is unchanged.Measured (RTX 5090, driver 620.70.10, GE-Proton11-14, ProjectScarlett story intro, same build with and without the change, probe totals over the world phase):
Each job still reads back and copies about 650 MiB, which is why frames stay slow. That cost is the subject of #215.
Tests
texture-publication.MEM_WRITE_WATCHallocation.PAGE_NOACCESStexel page is left unchanged, that all padding keeps its sentinel, and that nothing past the texture in the watched allocation is touched.tests/device/placement_guarded_copy.rsandtests/device/placement_writeback.rs. These are typechecked for the Windows target but not run, since the d3d12 tests have no runner here.Checks (on
ab644f0)python -m unittest discover -s tests -q: OK.python tuxbox.py check --adapter 1002:13c0 --proton … --prefix … --windows-dxc …passed, 128 gates, includinglanes-selftest-texture-publication.Overlap: #258 also edits
write_mapped, in a different hunk. The only conflict is theregionparameter type on the signature line.🤖 Generated with Claude Code