Repository navigation
GPU: copy title textures to the host once per change, and check them on several threads - #1500
A6thGraderFr wants to merge 2 commits into
Conversation
Every list that read a texture the title writes through memory recorded a copy of all its subresources from the staging buffer into the host texture, at every submission, whether or not the memory had changed: a texture read by ten lists of a submission crossed the bus ten times, and went to the copy destination state and back in each of those lists. All of those copies read the same staging buffer, which the submission's steps fill before any list runs. A texture's staging buffer now counts its detilings, and remembers the one its host copy was last given. At submission, after the refreshes, each texture whose host copy lacks the staging buffer's contents is copied once, in a list that runs before the submission's lists; with diagnostics, its copies carry markers and timestamps as before. A texture whose memory did not change is not copied at all, and stays in the state the lists that read it leave it in. The frame-rate line now gives the megabytes uploaded per frame. Tested end to end on the host device (resource::tests): a title texture copied by one list, and by two lists of one submission, reaches its host copy once per change of its memory over several submissions, read back from the host GPU; with the copy left out, the read-back finds zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Un9eWGTSggLRDdpjft9Gjd
A texture in physical-page memory, which cannot be write-watched, is hashed whole at every submission that samples it, and a submission's textures were checked one after another on the submitting thread, while the title's render thread waited for it. Texture checks now wait in the submission's batch with the buffer refreshes and are done together at the same points: before a step that writes title memory, before a range goes to shaders, and before the lists run, so each still reads the memory as its step saw it. They run on up to eight threads, one per 4 MiB of memory to hash, the calling one among them; memory known to be write-watched counts for nothing, as it is only read when its pages were written. The frame-rate line's texture time is the time the submission waited for them. A benchmark (ignored test, release build) hashing 48 textures of 4 MiB: about 42 ms on one thread, 14 ms on four (3.0x; a 4-core VM, median of seven runs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Un9eWGTSggLRDdpjft9Gjd
|
First real-GPU / in-game A/B data point on Linux + Proton + NVIDIA RTX 5080 ( Integration note:
No regressions or texture glitches observed in the debug world view; AI-assisted log analysis and write-up; built and run locally on my own retail copy, no game files or raw logs attached. |
Changed title textures are now copied into their host copies once per submission on a dedicated upload list, instead of once per sampling list; texture refresh hashing is also split across threads. Ported from Marvisak/VIctory Marvisak#1500. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #230. Same goal as #230 (copy a title texture once per change, not per list) with a second change on top (checking textures on several threads). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
What
Two changes to how textures the title writes through memory reach the host GPU.
How
Copiesintexture.rs).Host::record_uploads). Unchanged textures are not copied and keep the state the lists left them in. Diagnostics markers and timestamps for the copies are kept.Batchwith the buffer refreshes and run at the same points (before a title-memory write, before a range goes to shaders, before the lists run), so each still reads memory as its step saw it. One thread per 4 MiB to hash, at most one per texture, per core and 8; write-watched memory counts as no work.Benchmark (synthetic)
cargo test --release -p victory-gpu -- --ignored --nocapture texture_hashing: 48 textures of 4 MiB hashed in about 42 ms on one thread and 14 ms on four (3.0x; 4-core VM, median of 7 runs). Gains in the world are not measured; the new "MB uploaded" figure and the "on the GPU" time in the frame-rate line should show them.Tests
cargo clippy --workspace --all-targets -- -D warnings, with and without--all-features(targetx86_64-pc-windows-msvc): clean.cargo xtask policy: ok. rustfmt: no new differences.resource::tests::title_textures_reach_the_host_once_per_change(end to end through the queue, lists andCopyResource, read back from the host GPU; it fails with the upload copy left out), andtexture::testsfor the copy bookkeeping and the thread split.cargo test -p victory-gpuunder Wine on software Vulkan, with a local, uncommitted fallback to feature level 11_0 (that stack refuses 12_0): 52 passed, 55 withdiagnostics.argument_clamp_buildsanda_rejected_blob_gives_an_empty_libraryfail the same way on unmodified main there.#230 attempts the first change too. This one tracks whether the host copy holds the latest contents (not only whether they were detiled in this submission), copes with a submission that names a list twice, and keeps the diagnostics notes.
No game data was used.
AI-assisted (Claude Code).