perf(gpu): a due index for the texture queue (VICTORY_TEXTURE_DUE_CURSOR) #107
No reviewers
Labels
No labels
accessibility
bug
crash
documentation
duplicate
enhancement
good first issue
graphics
help wanted
invalid
needs logs
performance
question
rdna2
rdna3
rdna4
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/eikkapine--victory-amd!107
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-107"
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?
@RicardoLocher on GitHub · 2026-12-01 13:42 UTC · original
RicardoLocher:perf/texture-due-cursor→main· +158 −4 · 2 files · 23 commits · closed without mergingA new CPU-side idea, not on the docs/WAVE13-FPS.md list. Gated, off by default.
The cost it removes
TextureQueue (crates/victory-gpu/src/descriptor/host.rs) holds every title slot whose texture view waits to be brought up to date. Its ll_due(frame) walked every slot it held to find the ones due at the frame:
The map is keyed by slot, so it cannot range-query by
due. This runs once per indexed-heap draw (heap_textures, draw.rs), i.e. on the submitting thread, which is the CPU-side bottleneck this project is chasing. The code's own comments size the queue at "some ten thousand slots" / "tens of thousands of such views". No switch gated the walk (only VICTORY_HEAP_TEXTURES=0 disables the whole pass).What this does
With
VICTORY_TEXTURE_DUE_CURSOR=1the queue keeps a due index -slot -> dueanddue -> slots- kept in step withslotsby a singlereindexcalled at every mutation (insert/take_out/later/hold/room/partly/recheck, withwritten/changedgoing throughinsert). A pass then reads only the frames up to the current one. Off (default): the same walk as before, andreindexis a no-op so the off path pays nothing.censusstill walks every slot: its waiting/partly-uploaded counts span the whole queue and the index cannot answer them (documented in the code).Correctness
New test
the_due_index_answers_what_the_walk_answersdrives writes, re-arms (later), removals (done/remove), holds androom,partlyandrecheck, and asserts the index answers exactly what the walk answers at 9 frame values, and that both halves of the index stay in step withslots(every slot named once, at itsdue).in_orderis unchanged; only the source of theDuemultiset changes.Verification
cargo build -p victory: clean.cargo test -p victory-gpu --lib -- descriptor::host::tests: 43 passed (incl. the new one).cargo clippy -p victory-gpu --all-targets: no new warnings (the two remainingdraw.rscasts are pre-existing onmain).cargo xtask policy: asset policy 330 files ok. (xtaskdocumented_switches_are_readfails identically on cleanmainfor theVICTORY_NAMEplaceholder inREADME.md- pre-existing, not touched here.)Not done yet (needs the bench)
No in-game A/B in this PR: it is off by default, so nothing changes unless the switch is set. Before any default change I'll run the same save/scene warm, FG off and on reported separately, and record native FPS and frames>50 ms with
VICTORY_TEXTURE_DUE_CURSORunset vs1. Happy to post that as a follow-up if you'd like the switch on by default or exposed in the launcher.Pull request closed