perf(gpu): cache per-HostList RTV/DSV states, batch/window uses, and bindless heap tables #388

Manually merged
github merged 3 commits from github-bot/gh-388 into gh-pr/388/base 2026-12-03 13:10:50 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-03 12:30 UTC · original
Androtim:perf/draw-hotpath-cache → main · +147 −28 · 3 files · 3 commits · merged 2026-12-03 13:05 UTC

Summary

Eliminates tens of thousands of redundant per-draw mutex locks (\HostList::states, \HostList::deferred) and global \host_copy\ / \ win\ / \descriptor::heap\ lookups across open-world frames (~6k–10k draws/frame):

  1. Monotonic \HostList::use_id\ & \HostList::state_epoch\ (\crates/victory-gpu/src/host.rs):
    • \use_id\ is assigned on creation and bumped on every \HostList::reset().
    • \state_epoch\ is bumped on creation, \HostList::reset(), and every texture-state or depth-twin mutation (\ ransition_checked, \settle, \ win_use, \ wins_written).
  2. Per-\HostList\ RTV/DSV state cache in \State::prepare_for\ (\crates/victory-gpu/src/draw.rs, \list.rs):
    • Skips redundant \ensure_state\ + \ win_use\ calls when \list.state_epoch()\ and resolved \depth_wanted\ (\DEPTH_WRITE\ / \DEPTH_READ\ / \DEPTH_READ | SHADER_RESOURCE) match the previous draw on the same \HostList.
    • Invalidated automatically on \State::set_targets, any non-draw texture transition (\clear_rtv, \clear_dsv, \copy,
      esolve,
      eadable\ SRV/UAV barriers, depth-twin copies), \HostList::reset, or list cuts; never caches if any target lacked a live \host_copy.
  3. Lock-free \use_id\ validation for indirect batch/window and bindless heap tables (\crates/victory-gpu/src/draw.rs):
    • Replaces per-indirect \list.first_use(BATCH_USE)\ and \list.first_use(WINDOW_USE)\ (\deferred.lock()) with \atch_use_id\ / \window_use_id.
    • Caches (use_id, heaps, gpu)\ for \heap_buffers, \heap_strides, and \heap_addresses\ so repeat draws on the same list skip \descriptor::heap\ walks and \list.first_use\ locks.

Verification

  • \cargo test -p victory-gpu --lib\ (all 839 active tests pass)
  • \cargo clippy -p victory-gpu --all-targets -- -D warnings\ (0 warnings)
  • Gate 3 live RTX 4060 Ti visual & FPS verification in progress.
**@⁠Androtim** on GitHub · 2026-12-03 12:30 UTC · [original](https://github.com/Androtim/MiniVI/pull/388) `Androtim:perf/draw-hotpath-cache` → `main` · +147 −28 · 3 files · 3 commits · merged 2026-12-03 13:05 UTC ## Summary Eliminates tens of thousands of redundant per-draw mutex locks (\HostList::states\, \HostList::deferred\) and global \host_copy\ / \ win\ / \descriptor::heap\ lookups across open-world frames (~6k–10k draws/frame): 1. **Monotonic \HostList::use_id\ & \HostList::state_epoch\ (\crates/victory-gpu/src/host.rs\):** - \use_id\ is assigned on creation and bumped on every \HostList::reset()\. - \state_epoch\ is bumped on creation, \HostList::reset()\, and every texture-state or depth-twin mutation (\ ransition_checked\, \settle\, \ win_use\, \ wins_written\). 2. **Per-\HostList\ RTV/DSV state cache in \State::prepare_for\ (\crates/victory-gpu/src/draw.rs\, \list.rs\):** - Skips redundant \ensure_state\ + \ win_use\ calls when \list.state_epoch()\ and resolved \depth_wanted\ (\DEPTH_WRITE\ / \DEPTH_READ\ / \DEPTH_READ | SHADER_RESOURCE\) match the previous draw on the same \HostList\. - Invalidated automatically on \State::set_targets\, any non-draw texture transition (\clear_rtv\, \clear_dsv\, \copy\, \ esolve\, \ eadable\ SRV/UAV barriers, depth-twin copies), \HostList::reset\, or list cuts; never caches if any target lacked a live \host_copy\. 3. **Lock-free \use_id\ validation for indirect batch/window and bindless heap tables (\crates/victory-gpu/src/draw.rs\):** - Replaces per-indirect \list.first_use(BATCH_USE)\ and \list.first_use(WINDOW_USE)\ (\deferred.lock()\) with \atch_use_id\ / \window_use_id\. - Caches \(use_id, heaps, gpu)\ for \heap_buffers\, \heap_strides\, and \heap_addresses\ so repeat draws on the same list skip \descriptor::heap\ walks and \list.first_use\ locks. ## Verification - \cargo test -p victory-gpu --lib\ (all 839 active tests pass) - \cargo clippy -p victory-gpu --all-targets -- -D warnings\ (0 warnings) - Gate 3 live RTX 4060 Ti visual & FPS verification in progress.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 12:34:42 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-03 12:39 UTC · original

3-Gate Verification Summary (commit \2d7c529)

  • Gate 1 (GitHub CI \check): PASS (\7m26s)
  • Gate 2 (Read-only Reasoning Audit): VERIFIED CLEAN (0 P0, 0 P1, 0 P2) — logged on #282 (Pass #15).
  • Gate 3 (Live RTX 4060 Ti 8G): PASS (\1440\ DLSS Quality, \
**@⁠Androtim** on GitHub · 2026-12-03 12:39 UTC · [original](https://github.com/Androtim/MiniVI/pull/388#issuecomment-7378655858) ### 3-Gate Verification Summary (commit \2d7c529\) - **Gate 1 (GitHub CI \check\):** PASS (\7m26s\) - **Gate 2 (Read-only Reasoning Audit):** **VERIFIED CLEAN (0 P0, 0 P1, 0 P2)** — logged on #282 (Pass #15). - **Gate 3 (Live RTX 4060 Ti 8G):** PASS (\1440\ DLSS Quality, \
github-bot changed target branch from main to gh-pr/388/base 2026-12-03 13:10:47 +00:00
github manually merged commit 67f9c40274 into gh-pr/388/base 2026-12-03 13:10:50 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!388
No description provided.