perf(victory-gpu): fence-safe LRU texture eviction and kept-view yielding #354

Open
Vladimir-Human wants to merge 1 commit from upstream-pr/354 into main
Vladimir-Human commented 2026-11-26 12:14:12 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-26T12:14:12Z.


Summary

Rebased onto current main (132da61, #563 + #564) with all three behavioral switches strictly opt-in (default OFF) per maintainer review (fxceless/victory-fork#1289 / avatarmanz/VIctory-7900XTX#212).

Defaults & Default-Path Parity

  • VICTORY_TEXTURE_LRU_EVICT (default OFF, active only for 1/true/on): fence-safe LRU texture eviction stays inactive by default.
  • VICTORY_KEPT_VIEWS_YIELD (default OFF, active only for 1/true/on): superseded kept-view yielding stays inactive by default (keeping_slots allocates 0 capacity when off).
  • VICTORY_KEEP_SHOWN pressure drop (default OFF): keep_shown_with short-circuits to 1 without calling has_room_lately() (no 100 ms pressure check on draws) unless VICTORY_KEPT_VIEWS_YIELD is explicitly enabled.
  • texture::staging() untouched vs 132da61: only adds serial-scoped take_staged(resource, serial) and propagates &copy to defer_texture/defer_gpu_texture.
  • Modular texture_lru.rs stays under 400 lines (397 lines) and logs refusals via tracing::warn!.
  • Added Rule 10 credits (Source: / Co-authored-by: trailers and THIRD_PARTY.md row).

Honest Performance Note

  • In-game Full HD warm-cache median and 1% low FPS are unmeasured (any gain is assumed).

Verification

Verified locally on Windows 11 (third_party/victory workspace) after the final edit:

  • cargo xtask policy (380 files ok)
  • Hunk-accurate cargo clippy --no-deps -p victory-gpu --locked --all-targets (default & --features diagnostics: 0 errors, 0 own warnings)
  • Both HW (VICTORY_D3D12_WARP=0) and WARP (VICTORY_D3D12_WARP=1, default env):
    • texture_lru::tests::: 5/5 passed
    • descriptor::host::kept_yield_tests::: 5/5 passed
    • detile::tests::: 5/5 passed
    • texture::detile_fallback_tests::: 2/2 passed
    • feedback::tests::: 2/2 passed
    • host::budget_pool::tests::: 1/1 passed
    • resource::tests::slot_eviction: 2/2 passed
    • resource::tests::refused_texture_allocation_has_one_retry: 1/1 passed

Checklist

  • Neutral naming (0 game, character, or console strings)
  • Rule 10 credits (Source: / Co-authored-by: trailers + THIRD_PARTY.md row)
  • All three unmeasured behaviors opt-in (default OFF) + staging() unchanged from 132da61
  • In-game Full HD warm-cache A/B benchmark (unmeasured)
<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5509826024 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-26T12:14:12Z. --- ## Summary Rebased onto current `main` (`132da61`, `#563` + `#564`) with **all three behavioral switches strictly opt-in (default OFF)** per maintainer review (`fxceless/victory-fork#1289` / `avatarmanz/VIctory-7900XTX#212`). ### Defaults & Default-Path Parity - **`VICTORY_TEXTURE_LRU_EVICT`** (`default OFF`, active only for `1`/`true`/`on`): fence-safe LRU texture eviction stays inactive by default. - **`VICTORY_KEPT_VIEWS_YIELD`** (`default OFF`, active only for `1`/`true`/`on`): superseded kept-view yielding stays inactive by default (`keeping_slots` allocates 0 capacity when off). - **`VICTORY_KEEP_SHOWN` pressure drop** (`default OFF`): `keep_shown_with` short-circuits to `1` without calling `has_room_lately()` (no 100 ms pressure check on draws) unless `VICTORY_KEPT_VIEWS_YIELD` is explicitly enabled. - **`texture::staging()` untouched vs `132da61`:** only adds serial-scoped `take_staged(resource, serial)` and propagates `&copy` to `defer_texture`/`defer_gpu_texture`. - Modular `texture_lru.rs` stays under 400 lines (`397` lines) and logs refusals via `tracing::warn!`. - Added Rule 10 credits (`Source:` / `Co-authored-by:` trailers and `THIRD_PARTY.md` row). ### Honest Performance Note - In-game Full HD warm-cache median and 1% low FPS are **unmeasured** (any gain is assumed). ## Verification Verified locally on Windows 11 (`third_party/victory` workspace) after the final edit: - `cargo xtask policy` (380 files ok) - Hunk-accurate `cargo clippy --no-deps -p victory-gpu --locked --all-targets` (default & `--features diagnostics`: 0 errors, 0 own warnings) - Both HW (`VICTORY_D3D12_WARP=0`) and WARP (`VICTORY_D3D12_WARP=1`, default env): - `texture_lru::tests::`: 5/5 passed - `descriptor::host::kept_yield_tests::`: 5/5 passed - `detile::tests::`: 5/5 passed - `texture::detile_fallback_tests::`: 2/2 passed - `feedback::tests::`: 2/2 passed - `host::budget_pool::tests::`: 1/1 passed - `resource::tests::slot_eviction`: 2/2 passed - `resource::tests::refused_texture_allocation_has_one_retry`: 1/1 passed ## Checklist - [x] Neutral naming (0 game, character, or console strings) - [x] Rule 10 credits (`Source:` / `Co-authored-by:` trailers + `THIRD_PARTY.md` row) - [x] All three unmeasured behaviors opt-in (default OFF) + `staging()` unchanged from `132da61` - [ ] In-game Full HD warm-cache A/B benchmark (unmeasured)
Skyfrye commented 2026-11-26 14:22:40 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Skyfrye on 2026-11-26T14:22:40Z.


Test report, for information. I stacked this PR with #381 and #382 and the open #278, #279, #291, #292, #307 and #360–#362, on main at 8ed1109. Setup: RTX 5080, Series X, one 600 s run in the world, VICTORY_INDIRECT_RAW=3, VICTORY_TEXTURE_AUTO_MIP_CLAMP=auto, VICTORY_STAGE_POOL_MB=2048.

Results:

  • The picture was right in screen captures every 15 s, with textures drawn.
  • No exception, no device lost.
  • "The texture queue is refused" was logged 2 times in 10 minutes, against 8 without the auto mip clamp.
  • Median 14.8 fps after the first two minutes, against 12.5.
  • It was one run each, with the machine about 62 % loaded by other work, so take the frame rate as a hint only.

One merge note: with #278 applied, SHADER_HEAPS is a RwLock. The SHADER_HEAPS.lock() in this PR's descriptor.rs (the eviction walk) then has to become heaps_read(). That is the only change I needed to build the two together.

🤖 Generated with Claude Code

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7194730135 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7194730135). Originally posted by [Skyfrye](https://github.com/Skyfrye) on 2026-11-26T14:22:40Z. --- Test report, for information. I stacked this PR with #381 and #382 and the open #278, #279, #291, #292, #307 and #360–#362, on `main` at `8ed1109`. Setup: RTX 5080, Series X, one 600 s run in the world, `VICTORY_INDIRECT_RAW=3`, `VICTORY_TEXTURE_AUTO_MIP_CLAMP=auto`, `VICTORY_STAGE_POOL_MB=2048`. Results: - The picture was right in screen captures every 15 s, with textures drawn. - No exception, no device lost. - "The texture queue is refused" was logged 2 times in 10 minutes, against 8 without the auto mip clamp. - Median 14.8 fps after the first two minutes, against 12.5. - It was one run each, with the machine about 62 % loaded by other work, so take the frame rate as a hint only. One merge note: with #278 applied, `SHADER_HEAPS` is a `RwLock`. The `SHADER_HEAPS.lock()` in this PR's `descriptor.rs` (the eviction walk) then has to become `heaps_read()`. That is the only change I needed to build the two together. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Vladimir-Human commented 2026-11-26 14:27:42 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-26T14:27:42Z.


Pushed 6539f20 (synced from fxceless/victory-fork#1289 16a6f8e) fixing a live bindless texture regression isolated during RTX 3080 A/B testing on #1289:

  • Why: HostList::stamp_textures() only stamps textures tracked in HostList::states (barriers), not bindless textures bound once into shader-visible HostHeap::kept and read continuously by shaders. Passing allow_heap_unmake: true by default in evict_if_pressured() could unmake live shader-visible HostHeap SRVs onto the 240-frame cooldown under VRAM pressure.
  • Fix: Gated allow_heap_unmake (across both passes of evict_if_pressured()) and NEED_HEAP_EVICT reads/writes strictly behind opt-in VICTORY_TEXTURE_LRU_HEAP_EVICT=1 (default off), and completed the VICTORY_TEXTURE_LRU_EVICT=0 kill-switch in hosted(). By default (VICTORY_TEXTURE_LRU_EVICT=1), LRU eviction only reclaims fence-completed idle textures with references == 1 (never pinned by any live HostHeap slot), keeping VICTORY_TEXTURE_AUTO_MIP_CLAMP and flush_unclamped_rebinds() unchanged.
  • Verification: Added resource::tests::default_lru_eviction_preserves_live_host_heap_textures_until_opt_in (11/11 targeted tests passing on both hardware D3D12 and WARP with VICTORY_D3D12_DEBUG=1 VICTORY_REAPER=1, 199 files ok in xtask policy, 0 clippy warnings in resource.rs).
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7194853725 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7194853725). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-26T14:27:42Z. --- Pushed `6539f20` (synced from [fxceless/victory-fork#1289](https://github.com/fxceless/victory-fork/pull/1289) `16a6f8e`) fixing a live bindless texture regression isolated during RTX 3080 A/B testing on `#1289`: - **Why:** `HostList::stamp_textures()` only stamps textures tracked in `HostList::states` (barriers), not bindless textures bound once into shader-visible `HostHeap::kept` and read continuously by shaders. Passing `allow_heap_unmake: true` by default in `evict_if_pressured()` could unmake live shader-visible `HostHeap` SRVs onto the 240-frame cooldown under VRAM pressure. - **Fix:** Gated `allow_heap_unmake` (across both passes of `evict_if_pressured()`) and `NEED_HEAP_EVICT` reads/writes strictly behind opt-in `VICTORY_TEXTURE_LRU_HEAP_EVICT=1` (**default off**), and completed the `VICTORY_TEXTURE_LRU_EVICT=0` kill-switch in `hosted()`. By default (`VICTORY_TEXTURE_LRU_EVICT=1`), LRU eviction only reclaims fence-completed idle textures with `references == 1` (never pinned by any live `HostHeap` slot), keeping `VICTORY_TEXTURE_AUTO_MIP_CLAMP` and `flush_unclamped_rebinds()` unchanged. - **Verification:** Added `resource::tests::default_lru_eviction_preserves_live_host_heap_textures_until_opt_in` (`11/11` targeted tests passing on both hardware D3D12 and WARP with `VICTORY_D3D12_DEBUG=1 VICTORY_REAPER=1`, `199 files ok` in `xtask policy`, `0` clippy warnings in `resource.rs`).
Vladimir-Human commented 2026-11-26 17:25:35 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-26T17:25:35Z.


Updated perf/texture-vram-lru-mipcap to 7031e42 (rebased cleanly onto main ef4791e preserving #396 and #398, mergeable):

Summary

  • Tier 2 (default ON, VICTORY_KEPT_VIEWS_YIELD=1): Tracks keeping slots where keep_views() retained an older copy while a sharper view waits (clearing on keep(), unmake(), or pressure), and invokes yield_kept_views() under VRAM pressure (!room() or want > 0) to free stale superseded copies without touching non-superseded active textures.
  • Tier 3 (opt-in VICTORY_TEXTURE_LRU_HEAP_EVICT=1, OFF by default): Tracks per-slot last_used_frame (mirror(..., for_draw = true) and keep()), drains unpinned refs == 1 victims first, then evicts cold HostHeap slots oldest-last_used_frame first while protecting taken dynamic slots, non-heap COM pins (refs > 1 + kept_refs), and slots within VICTORY_TEXTURE_LRU_HEAP_IDLE_FRAMES (default 120), with a 30-frame recreate cooldown.

Verification (7031e42, VICTORY_D3D12_DEBUG=1 VICTORY_REAPER=1)

  • cargo xtask policy: 214 files ok; clippy (default & diagnostics): 0 new warnings in PR files
  • HW & WARP mip_clamp_and_evict_kept_tests (6/6), resource:: (24/24)
  • Full victory-gpu --lib: default 256/256 + 3 pre-existing main failures (4 ignored), diagnostics 269/269 + same 3 pre-existing main failures (4 ignored)
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7198995177 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7198995177). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-26T17:25:35Z. --- Updated `perf/texture-vram-lru-mipcap` to `7031e42` (rebased cleanly onto `main` `ef4791e` preserving `#396` and `#398`, mergeable): ### Summary - **Tier 2 (default ON, `VICTORY_KEPT_VIEWS_YIELD=1`):** Tracks `keeping` slots where `keep_views()` retained an older copy while a sharper view waits (clearing on `keep()`, `unmake()`, or pressure), and invokes `yield_kept_views()` under VRAM pressure (`!room()` or `want > 0`) to free stale superseded copies without touching non-superseded active textures. - **Tier 3 (opt-in `VICTORY_TEXTURE_LRU_HEAP_EVICT=1`, OFF by default):** Tracks per-slot `last_used_frame` (`mirror(..., for_draw = true)` and `keep()`), drains unpinned `refs == 1` victims first, then evicts cold `HostHeap` slots oldest-`last_used_frame` first while protecting taken dynamic slots, non-heap COM pins (`refs > 1 + kept_refs`), and slots within `VICTORY_TEXTURE_LRU_HEAP_IDLE_FRAMES` (default `120`), with a `30`-frame recreate cooldown. ### Verification (`7031e42`, `VICTORY_D3D12_DEBUG=1 VICTORY_REAPER=1`) - `cargo xtask policy`: 214 files ok; `clippy` (default & `diagnostics`): 0 new warnings in PR files - HW & WARP `mip_clamp_and_evict_kept_tests` (`6/6`), `resource::` (`24/24`) - Full `victory-gpu --lib`: default `256/256` + 3 pre-existing `main` failures (`4 ignored`), `diagnostics` `269/269` + same 3 pre-existing `main` failures (`4 ignored`)
Vladimir-Human commented 2026-11-26 19:11:30 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-26T19:11:30Z.


Rebased onto main (50936c0 -> 5865586, resolving descriptor/host.rs and texture.rs with #395 prepare::take_ready/staged_from/build_staging_untimed).
Verified locally (VICTORY_D3D12_DEBUG=1): cargo xtask policy (215 files ok), cargo clippy -p victory-gpu --features diagnostics --all-targets exit 0; texture:: 8/8, resource:: 24/24, draw:: 5/5 (1 ignored) passed (descriptor:: 36/37 with only upstream spans_say_the_next_start_and_the_lowest_level_viewed failing).

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7201293619 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7201293619). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-26T19:11:30Z. --- Rebased onto `main` (`50936c0` -> `5865586`, resolving `descriptor/host.rs` and `texture.rs` with #395 `prepare::take_ready`/`staged_from`/`build_staging_untimed`). Verified locally (`VICTORY_D3D12_DEBUG=1`): `cargo xtask policy` (`215 files ok`), `cargo clippy -p victory-gpu --features diagnostics --all-targets` exit `0`; `texture::` `8/8`, `resource::` `24/24`, `draw::` `5/5` (1 ignored) passed (`descriptor::` `36/37` with only upstream `spans_say_the_next_start_and_the_lowest_level_viewed` failing).
Vladimir-Human commented 2026-11-26 19:19:14 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-26T19:19:14Z.


Noting that #409 (37d4686) replaced third_party/victory with the combined avatarmanz + cool_fox base, putting this branch in CONFLICTING right after the 50936c0 rebase.
The clean avatarmanz-lineage version is open at avatarmanz/VIctory-7900XTX#212 (and fxceless/victory-fork#1289); happy to re-port onto 37d4686+ once #409 settles if you want it here.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7201451784 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7201451784). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-26T19:19:14Z. --- Noting that #409 (`37d4686`) replaced `third_party/victory` with the combined `avatarmanz + cool_fox` base, putting this branch in `CONFLICTING` right after the `50936c0` rebase. The clean `avatarmanz`-lineage version is open at `avatarmanz/VIctory-7900XTX#212` (and `fxceless/victory-fork#1289`); happy to re-port onto `37d4686+` once `#409` settles if you want it here.
Vladimir-Human commented 2026-11-27 13:29:44 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-27T13:29:44Z.


Rebased onto latest main (fa6b209, updated third_party/victory base) in ed2b10e:

  • Re-applied fence-safe 2-pass LRU eviction of idle title-filled textures (VICTORY_TEXTURE_LRU_EVICT, default ON), Tier 2 superseded keep_views yielding (VICTORY_KEPT_VIEWS_YIELD, default ON), opt-in Tier 3 shader-heap unmaking (VICTORY_TEXTURE_LRU_HEAP_EVICT=1, default OFF), and opt-in budget-aware mip-tail clamping (VICTORY_TEXTURE_AUTO_MIP_CLAMP, default OFF) with adjust_srv_for_base_mip and ensure_unclamped / PendingUnclamp ABA-safe rebinds.
  • Extended Step::Texture to carry Arc<HostTexture> alongside Arc<Staging> so HostList::stamp_textures stamps and pins skipped/deferred texture uploads across flights, and aligned descriptor/host.rs unit tests cleanly with e04cc0b's HostHeap::release() kept-resource cleanup.
  • Verified (--features diagnostics, VICTORY_D3D12_DEBUG=1, --test-threads=1): clippy clean on touched files; xtask policy (296 files ok); HW resource::tests 24/24 (1 ignored), mip_clamp_and_evict_kept_tests 9/9, descriptor::host::tests 39/39, bake_flip_tests 4/4, textures_are_kept 1/1; WARP mip_clamp_and_evict_kept_tests 9/9, mip_clamp 12/12, tier 3/3, lru 4/4.
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7219546444 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7219546444). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T13:29:44Z. --- Rebased onto latest `main` (`fa6b209`, updated `third_party/victory` base) in `ed2b10e`: - Re-applied fence-safe 2-pass LRU eviction of idle title-filled textures (`VICTORY_TEXTURE_LRU_EVICT`, default ON), Tier 2 superseded `keep_views` yielding (`VICTORY_KEPT_VIEWS_YIELD`, default ON), opt-in Tier 3 shader-heap unmaking (`VICTORY_TEXTURE_LRU_HEAP_EVICT=1`, default OFF), and opt-in budget-aware mip-tail clamping (`VICTORY_TEXTURE_AUTO_MIP_CLAMP`, default OFF) with `adjust_srv_for_base_mip` and `ensure_unclamped` / `PendingUnclamp` ABA-safe rebinds. - Extended `Step::Texture` to carry `Arc<HostTexture>` alongside `Arc<Staging>` so `HostList::stamp_textures` stamps and pins skipped/deferred texture uploads across flights, and aligned `descriptor/host.rs` unit tests cleanly with `e04cc0b`'s `HostHeap::release()` kept-resource cleanup. - Verified (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `--test-threads=1`): `clippy` clean on touched files; `xtask policy` (`296 files ok`); HW `resource::tests` 24/24 (1 ignored), `mip_clamp_and_evict_kept_tests` 9/9, `descriptor::host::tests` 39/39, `bake_flip_tests` 4/4, `textures_are_kept` 1/1; WARP `mip_clamp_and_evict_kept_tests` 9/9, `mip_clamp` 12/12, `tier` 3/3, `lru` 4/4.
LooperSalty commented 2026-11-27 15:40:04 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T15:40:04Z.


Thanks for the fence-safe eviction work. Before merge:

  1. LRU eviction and kept-view yielding are on by default (VICTORY_TEXTURE_LRU_EVICT, VICTORY_KEPT_VIEWS_YIELD), and VICTORY_KEEP_SHOWN drops to 0 under VRAM pressure. Please state this in the description and give an in-game A/B (Full HD, warm cache, median and 1% low) for the default path.
  2. The eviction result is discarded in evict_if_pressured: a texture refused after eviction is marked refused with no log. Please at least trace the refusal.
  3. About 6,400 lines, and resource.rs goes from 4,729 to 7,437 lines (AGENTS.md asks for files under about 400 lines). Please split: fence-safe LRU eviction first, then mip clamp and heap eviction (opt-in) in separate PRs.
  4. No fps figure is given. Add the measurement method and results, or mark the gain as assumed.
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7222335843 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7222335843). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T15:40:04Z. --- Thanks for the fence-safe eviction work. Before merge: 1. LRU eviction and kept-view yielding are on by default (VICTORY_TEXTURE_LRU_EVICT, VICTORY_KEPT_VIEWS_YIELD), and VICTORY_KEEP_SHOWN drops to 0 under VRAM pressure. Please state this in the description and give an in-game A/B (Full HD, warm cache, median and 1% low) for the default path. 2. The eviction result is discarded in evict_if_pressured: a texture refused after eviction is marked refused with no log. Please at least trace the refusal. 3. About 6,400 lines, and resource.rs goes from 4,729 to 7,437 lines (AGENTS.md asks for files under about 400 lines). Please split: fence-safe LRU eviction first, then mip clamp and heap eviction (opt-in) in separate PRs. 4. No fps figure is given. Add the measurement method and results, or mark the gain as assumed.
Vladimir-Human commented 2026-11-27 19:51:21 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-27T19:51:21Z.


@LooperSalty Thank you for the clear review on #354. Acknowledged on all four points:

  1. We will split #354 cleanly into smaller PRs starting with the fence-safe texture LRU eviction alone (~<= 400 lines), leaving opt-in mip clamping (VICTORY_TEXTURE_AUTO_MIP_CLAMP) and heap eviction (VICTORY_TEXTURE_LRU_HEAP_EVICT) for separate follow-up PRs.
  2. We will add explicit tracing in evict_if_pressured when an allocation still fails after eviction, and document that VICTORY_TEXTURE_LRU_EVICT, VICTORY_KEPT_VIEWS_YIELD, and VICTORY_KEEP_SHOWN pressure reduction are active on the default path.
  3. Because we do not have a retail game dump locally to run Full HD warm-cache median / 1% low A/B benchmarks, any gameplay FPS impact should be treated as unmeasured / assumed until measured in-game.
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7226935926 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7226935926). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T19:51:21Z. --- @LooperSalty Thank you for the clear review on `#354`. Acknowledged on all four points: 1. We will split `#354` cleanly into smaller PRs starting with the fence-safe texture LRU eviction alone (~<= 400 lines), leaving opt-in mip clamping (`VICTORY_TEXTURE_AUTO_MIP_CLAMP`) and heap eviction (`VICTORY_TEXTURE_LRU_HEAP_EVICT`) for separate follow-up PRs. 2. We will add explicit tracing in `evict_if_pressured` when an allocation still fails after eviction, and document that `VICTORY_TEXTURE_LRU_EVICT`, `VICTORY_KEPT_VIEWS_YIELD`, and `VICTORY_KEEP_SHOWN` pressure reduction are active on the default path. 3. Because we do not have a retail game dump locally to run Full HD warm-cache median / 1% low A/B benchmarks, any gameplay FPS impact should be treated as unmeasured / assumed until measured in-game.
LooperSalty commented 2026-11-27 21:58:50 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T21:58:50Z.


Thanks for splitting this; the refusal trace and the file sizes are fine now, and the eviction checks (fence complete, single Arc, COM refs, serial recheck) look sound. Two points from the earlier review are still open:

  1. Defaults. LRU eviction (texture_lru.rs:20, on unless VICTORY_TEXTURE_LRU_EVICT=0), kept-view yield (descriptor/host.rs:5134, on unless VICTORY_KEPT_VIEWS_YIELD=0) and KEEP_SHOWN falling to 0 under pressure (descriptor/host.rs:5161) are all on by default, and the description says the gain is unmeasured. KEEP_SHOWN=0 shows zeros or the neutral texture, a visible regression, and it flips on a 100 ms room check read per draw. Please make these opt-in until there is a Full HD, warm-cache A/B (median and 1% low) on the default path.
  2. Credits (rule 10). The code comments say it is synced from fxceless/victory-fork#1289 and avatarmanz/VIctory-7900XTX#212, but the commits have no Source: / Co-authored-by: trailers and THIRD_PARTY.md has no row.

Also note that texture.rs staging() changes unconditionally (stricter cache hit, on_demand from copy.tiled), which is a default-path change too, and that this conflicts with #555 and #347 in host.rs / resource.rs / texture.rs.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7228921874 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7228921874). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T21:58:50Z. --- Thanks for splitting this; the refusal trace and the file sizes are fine now, and the eviction checks (fence complete, single `Arc`, COM refs, serial recheck) look sound. Two points from the earlier review are still open: 1. **Defaults.** LRU eviction (`texture_lru.rs:20`, on unless `VICTORY_TEXTURE_LRU_EVICT=0`), kept-view yield (`descriptor/host.rs:5134`, on unless `VICTORY_KEPT_VIEWS_YIELD=0`) and `KEEP_SHOWN` falling to 0 under pressure (`descriptor/host.rs:5161`) are all on by default, and the description says the gain is unmeasured. `KEEP_SHOWN=0` shows zeros or the neutral texture, a visible regression, and it flips on a 100 ms room check read per draw. Please make these opt-in until there is a Full HD, warm-cache A/B (median and 1% low) on the default path. 2. **Credits (rule 10).** The code comments say it is synced from fxceless/victory-fork#1289 and avatarmanz/VIctory-7900XTX#212, but the commits have no `Source:` / `Co-authored-by:` trailers and `THIRD_PARTY.md` has no row. Also note that `texture.rs` `staging()` changes unconditionally (stricter cache hit, `on_demand` from `copy.tiled`), which is a default-path change too, and that this conflicts with #555 and #347 in `host.rs` / `resource.rs` / `texture.rs`.
Vladimir-Human commented 2026-11-27 22:01:30 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-27T22:01:30Z.


@LooperSalty Split and updated as requested:

  1. This PR (#354, b106642) is now narrowed strictly to fence-safe LRU texture eviction (VICTORY_TEXTURE_LRU_EVICT, default ON) + Tier-2 superseded kept-view yielding (VICTORY_KEPT_VIEWS_YIELD, default ON, with VICTORY_KEEP_SHOWN dropping to 0 under VRAM pressure unless explicitly set):
    • Extracted into modular texture_lru.rs (384 lines), texture_lru_tests.rs (301 lines), and descriptor/kept_yield_tests.rs (187 lines), shrinking the resource.rs diff to +99/-53 lines.
    • Added explicit tracing::warn! logging (submit_pressure and allocation_refused) retaining the eviction outcome, resource info, evicted count/bytes, and remaining budget status when pressure persists or an allocation is refused.
    • Updated the PR description to document the default-ON flags and explicitly mark Full HD warm-cache gameplay FPS median / 1% low as unmeasured / assumed (no local retail game dump available here).
  2. Follow-up opt-in mip-tail clamping PR (#555, 6708faf): https://github.com/LooperSalty/AnyXboxX/pull/555 (VICTORY_TEXTURE_AUTO_MIP_CLAMP, default OFF).
  3. Follow-up opt-in Tier-3 shader-heap eviction (VICTORY_TEXTURE_LRU_HEAP_EVICT=1, default OFF): staged cleanly on top of #354 at Vladimir-Human/AnyXboxX:perf/texture-optin-heap-evict (2e9a6e4), ready to open as a standalone PR once #354 merges.
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7228960446 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7228960446). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T22:01:30Z. --- @LooperSalty Split and updated as requested: 1. **This PR (`#354`, `b106642`)** is now narrowed strictly to **fence-safe LRU texture eviction** (`VICTORY_TEXTURE_LRU_EVICT`, default ON) + **Tier-2 superseded kept-view yielding** (`VICTORY_KEPT_VIEWS_YIELD`, default ON, with `VICTORY_KEEP_SHOWN` dropping to `0` under VRAM pressure unless explicitly set): - Extracted into modular `texture_lru.rs` (`384` lines), `texture_lru_tests.rs` (`301` lines), and `descriptor/kept_yield_tests.rs` (`187` lines), shrinking the `resource.rs` diff to `+99/-53` lines. - Added explicit `tracing::warn!` logging (`submit_pressure` and `allocation_refused`) retaining the eviction outcome, resource info, evicted count/bytes, and remaining budget status when pressure persists or an allocation is refused. - Updated the PR description to document the default-ON flags and explicitly mark Full HD warm-cache gameplay FPS median / 1% low as **unmeasured / assumed** (no local retail game dump available here). 2. **Follow-up opt-in mip-tail clamping PR (`#555`, `6708faf`)**: `https://github.com/LooperSalty/AnyXboxX/pull/555` (`VICTORY_TEXTURE_AUTO_MIP_CLAMP`, **default OFF**). 3. **Follow-up opt-in Tier-3 shader-heap eviction (`VICTORY_TEXTURE_LRU_HEAP_EVICT=1`, default OFF)**: staged cleanly on top of `#354` at `Vladimir-Human/AnyXboxX:perf/texture-optin-heap-evict` (`2e9a6e4`), ready to open as a standalone PR once `#354` merges.
Vladimir-Human commented 2026-11-28 07:24:52 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-28T07:24:52Z.


Rebased on current main (132da61, preserving #563 & #564) and addressed both remaining review items at commit e0950ac:

  1. Defaults (all OFF): Switched VICTORY_TEXTURE_LRU_EVICT, VICTORY_KEPT_VIEWS_YIELD, and the KEEP_SHOWN pressure drop to explicit opt-in (switch::opt_in matching 1/true/on only). With yield OFF, keep_shown_with short-circuits to 1 without calling the 100 ms pressure check and keeping_slots stays empty.
  2. Credits (Rule 10): Added Source: / Co-authored-by: trailers and the French row in THIRD_PARTY.md for fxceless/victory-fork#1289 and avatarmanz/VIctory-7900XTX#212.
  3. texture.rs staging() parity: Left staging() completely untouched vs 132da61 (#354 only adds take_staged(resource, serial) and passes &copy to defer_texture/defer_gpu_texture).

Verified locally on HW and WARP after the final edit: cargo xtask policy (380 ok), hunk-accurate clippy (default & diagnostics: 0 own warnings), texture_lru::tests:: 5/5, kept_yield_tests:: 5/5, detile::tests:: 5/5, detile_fallback_tests:: 2/2, feedback::tests:: 2/2, budget_pool::tests:: 1/1, slot_eviction 2/2, and refused_texture_allocation_has_one_retry 1/1. Note: #555 has already been rebased on 132da61; once one of #354/#555 merges we'll rebase the other cleanly.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7235923990 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/354#issuecomment-7235923990). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-28T07:24:52Z. --- Rebased on current `main` (`132da61`, preserving `#563` & `#564`) and addressed both remaining review items at commit `e0950ac`: 1. **Defaults (all OFF):** Switched `VICTORY_TEXTURE_LRU_EVICT`, `VICTORY_KEPT_VIEWS_YIELD`, and the `KEEP_SHOWN` pressure drop to explicit opt-in (`switch::opt_in` matching `1`/`true`/`on` only). With yield OFF, `keep_shown_with` short-circuits to `1` without calling the 100 ms pressure check and `keeping_slots` stays empty. 2. **Credits (Rule 10):** Added `Source:` / `Co-authored-by:` trailers and the French row in `THIRD_PARTY.md` for `fxceless/victory-fork#1289` and `avatarmanz/VIctory-7900XTX#212`. 3. **`texture.rs` `staging()` parity:** Left `staging()` completely untouched vs `132da61` (`#354` only adds `take_staged(resource, serial)` and passes `&copy` to `defer_texture`/`defer_gpu_texture`). Verified locally on HW and WARP after the final edit: `cargo xtask policy` (380 ok), hunk-accurate `clippy` (default & `diagnostics`: 0 own warnings), `texture_lru::tests::` 5/5, `kept_yield_tests::` 5/5, `detile::tests::` 5/5, `detile_fallback_tests::` 2/2, `feedback::tests::` 2/2, `budget_pool::tests::` 1/1, `slot_eviction` 2/2, and `refused_texture_allocation_has_one_retry` 1/1. Note: `#555` has already been rebased on `132da61`; once one of `#354`/`#555` merges we'll rebase the other cleanly.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/354:upstream-pr/354'
git switch 'upstream-pr/354'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/354'
git switch 'upstream-pr/354'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/354'
git switch 'upstream-pr/354'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/354'
git switch 'main'
git merge --squash 'upstream-pr/354'
git switch 'main'
git merge --ff-only 'upstream-pr/354'
git switch 'main'
git merge 'upstream-pr/354'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
LooperSalty/AnyXboxX!354
No description provided.