GPU: read watched texture memory through a shared scratch buffer #495
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!495
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/495/head"
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?
@ghost on GitHub · 2026-11-24 04:05 UTC · original
gpu/texture-read-scratch-buffer→main· +22 −7 · 1 files · 1 commits · closed without mergingEvery texture the title samples through a watched pool stays in
STAGINGfor the rest of the run, and each one kept aVecthe size of its title memory (Last::read). That buffer is only needed while the texture is detiled, so on a long world run it adds gigabytes of commit on top of the title's own, and when Windows runs out of commit a failed allocation aborts the process: nocrashes.logentry, onlymemory allocation of N bytes failed.What I saw
RTX 3070 Ti, 31 GB RAM, the world loaded (black, minimap only), diagnostics build with the host debug layer. Two aborts, in different places and at different sizes:
System commit was about 52 GB of a 48 to 54 GB limit for the whole run (a growing pagefile), with the process at about 21 GB private. Neither abort left anything in
crashes.log.Fix
The buffer is one per thread (
READ), reused for every texture, and reserved withtry_reserve_exact. If the reservation fails the upload is skipped with a one-time warning, and the texture still asks to be detiled next time (askedis only updated after the reservation succeeds). No behaviour change otherwise.Verified
On the machine above, with this change the abort did not come back over several later runs (one of 20+ minutes with the process flat at about 21 to 22 GB private). I also raised the pagefile to 32 GB at the same time, so I cannot separate the two effects from those runs. I did not test the
try_reserve_exactfailure branch under real memory pressure.Not in this PR
The
STAGINGmap itself is still never cleared, so the upload buffers stay for the run. That is a separate question and I left it alone.🤖 Generated with Claude Code
@ghost on GitHub · 2026-11-24 06:00 UTC · original
Closing as a duplicate of #215, which makes the same change in
texture.rs(one thread-local read buffer in place ofLast::read), was opened first, and has tests and a measurement. I should have searched for existing PRs before opening this one. If you were including #495 in a test stack, please use #215 instead. The one difference, atry_reserve_exactfallback so a failed allocation skips the upload instead of aborting the process, is described in a comment on #215.Pull request closed