Repository navigation
GPU: refresh unwatched textures without a region query; detile into cached memory - #388
ItsYusei99 wants to merge 1 commit into
Conversation
…ached memory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Native Windows numbers, since the description says it isn't tested there. RTX 4090, driver 621.01, Windows 11, i9-14900K, diag build, from boot through the first mission's opening. Base: From the
In the world that's 86 to 95 ms of texture preparation per frame with this PR, against 54 to 68 ms without, for 118 to 137 MB. So on native Windows it costs about 40% more per MB in the menus and more in the world. That fits the caveat in the description: AI-assisted (Claude Code). |
|
A phase split from a real title run on the gap your thread lacks: Linux/Wine, AMD. I instrumented Setup: RX 9060 XT (RDNA4, RADV 26.3.1), Arch Linux, kernel 6.18.x; Wine 11.22 (system), DXVK 3.1.1 In-world, per 512 texture refreshes:
The frame line in the same run is That matches what this PR removes. It also suggests #776 (write-watch askings) and #401 (hash bypass) stack after it, but this one is the biggest on Wine, where each Not tested: a controlled A/B with the PR itself (I can run it on this machine next), Windows/NVIDIA, long sessions (runs freeze at #774 ~3 min in). |
|
Stack result on AMD/Wine (main
Setup: RX 9060 XT (RDNA4/RADV 26.3.1), Arch, Wine 11.22, DXVK 3.1.1 This was the biggest texture win in the stack — thanks. |
|
Independent test & review on Windows 11 + NVIDIA RTX 3070 (8 GB, Rust 1.98.1) at head
Looks clean and ready to merge once rebased on |
|
Measured on Linux: RTX 5090, Wine 11.22 with the wineserver view-tree patch from #340, vkd3d-proton from GE-Proton11-14. Prologue world frames, medians over about 55 summary lines per run. With this PR merged together with #514, The patched wineserver has already made the AI-assisted (Claude Code). |
…query; detile into cached memory
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content will be reviewed once the branch is rebased onto Generated by Claude Code |
|
@ItsYusei99 I tested a local FIND-2 candidate on Local follow-up: exact #388 |
docs/value-vs-upstream.md: the most-starred forks are all doing shader fidelity (JMAN730 42 stars, DexNom wave64 masks, PastiiJay FidelityFX) and nobody measures frame composition, host memory or how to drive the menus. Group by group: rpcrt4 and Marvisak#928 are upstream's; COPY_PLAIN, FRAME_LOG, DRIVER_WATCH supersede ours; the texture-refresh numbers complement Marvisak#388 and Marvisak#1873; the staging budget, the page-bitmap detile, the pad-stick gap (Marvisak#1702's missing half), the terms page, the committed saves, the wave64 sentence (Marvisak#2105/Marvisak#599/Marvisak#2035), the ALERT_ERROR_SUPPORT trap and the memory series complement Marvisak#1479 - with what is worth sending where.
Under Wine, the menus and the intro stuttered. Each frame spent about 28 ms refreshing sampled textures. Two parts of
Staging::refresh_nowcaused it.1.
committed()on the unwatched path. Before it hashes a texture that is not write-watched,refresh_nowcheckscommitted(self.memory, size). That check walks the range withVirtualQuery, one region at a time. Wine implementsVirtualQuerywith a server round trip, so for big texture pools this one check costs most of the refresh. The path now copies the whole texture out withhost::read_into(ReadProcessMemory) intoLast::read, which the watched path already uses. The copy fails by itself when any page is not committed, so it replaces the check and keeps the same "not committed, skip it" result. A side effect: the hash and the detile now read the copy rather than the title's memory directly. That removes the fault #143 describes, where the title unmaps the pages between the check and the read.2. Detiling straight into the upload heap.
detilewrote each subresource directly into the mapped staging buffer. That buffer is an upload heap, which is write-combined memory, and the scattered writes of a detile are very slow there. Each subresource is now detiled into a cached scratchVeckept inLast, then copied to the staging buffer in one sequentialcopy_nonoverlapping.Cost: one extra CPU copy of each unwatched texture per refresh (the read), and one scratch buffer per staged texture, as large as its biggest subresource.
Measured
Linux, Wine 11.22, vkd3d-proton 3.2.0, RTX 4070 (driver 620.70.06), Ryzen 7 9800X3D. These are frame lines in the menu intro:
I measured this on my local tree, which also carries other patches: #177, and a 16-bit render target substitution like #89. I have not re-measured on this exact commit, and I have not measured the two parts separately. Not tested on native Windows.
VirtualQueryis much cheaper there, so most of the gain there would come from part 2, if any.Relation to open PRs
committed()check, which is the slow call under Wine. It uses a thread-local buffer, so it keeps no copy per texture. If that memory matters more, this change can use GPU: hash and detile unwatched textures from a kernel-read copy #143's / Reuse one CPU read buffer for watched textures #215's thread-local scratch instead ofLast::read, as long as thecommitted()call goes away.Checks
cargo xwin test -p victory-gpuunder Wine: 43 passed, 1 ignored.cargo xwin clippy -p victory-gpu --all-targets: no warnings intexture.rs. The one warning is athost.rs:267, which is onmain.diag(--features diagnostics) builds OK.cargo xtask policypasses, andrustfmt --check texture.rsis clean.🤖 Generated with Claude Code