fix(gpu/texture,descriptor): default-on TEXTURE_SAFE_SHOW to prevent binding unuploaded pooled textures #299

Manually merged
github merged 1 commit from github-bot/gh-299 into gh-pr/299/base 2026-12-02 00:24:15 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-02 00:11 UTC · original
Androtim:fix/texture-safe-show → main · +255 −7 · 5 files · 1 commits · merged 2026-12-02 00:19 UTC

Summary

Prevents reused 64 MiB pool texture placements from being exposed to shader descriptor slots before their first GPU upload finishes executing (eliminating stale/swapped pool-chunk texture artifacts, adapted cleanly from crbns/victory-tapin @ 3dba942, GPL-3.0).

Changes

  • crates/victory-gpu/src/resource.rs & crates/victory-gpu/src/texture/ahead.rs: Track HostTexture::sent (first recorded upload submission) and expose HostTexture::note_sent(), sent_submission(), and landed() (with Release/Acquire ordering across ahead copy workers).
  • crates/victory-gpu/src/texture.rs: Record
    ote_sent() at all GPU upload paths (
    ecord_upload for movie planes & direct CPU uploads, PreludeUpload::finish_refresh, and upload_on_card).
  • crates/victory-gpu/src/descriptor/host.rs & crates/victory-gpu/src/draw.rs:
    • Enable VICTORY_TEXTURE_SAFE_SHOW and VICTORY_SHOW_AFTER by default (=0 kill-switches only).
    • Keep previous compatible views or neutral stand-ins for unlanded pooled title-filled non-aliased textures in HostHeap::mirror, HostHeap::mirror_after, and draw.rs (shows_other / same == true bindless path).
    • Bound exture_slots_flip to requeue once (sent_sub > finished up to SAFE_SHOW_MAX_WAIT_FRAMES = 8) for in-flight uploads, or hand back immediately to the texture pass when no main-queue upload was submitted (sent_sub == 0).

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: 319 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked texture_safe_show: 3/3 passed
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked descriptor::: 86/86 passed
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked texture::: 15/15 passed (4 ignored bench measurements)
  • Dual workspace clippy --workspace --locked --all-targets -- -D warnings (default + --features diagnostics): clean
  • Plain --release --bin MiniVI --locked + objdump -p: standard Windows DLLs only

Paired 90s Plain --release 1440p A/B (PlayParity, LowVram, DLSS quality, -AutoNudgeMenu)

Metric origin/main (dbe161b) PR ( ix/texture-safe-show) Delta
Median / Min FPS 12.55 fps (79.7 ms) / 3.9 fps 11.80 fps (84.8 ms) / 7.9 fps min FPS +4.0 fps (smoother)
Preparing / Copyback 33.75 ms / 11.2 ms 37.0 ms / 9.9 ms -1.3 ms copyback
Peak VRAM / Budget 6273 / 6552 MB (over=0) 6091 / 6616 MB (over=0) -182 MB peak
oom_false /
o_room_so_far 23.1% / 6000 **
**@⁠Androtim** on GitHub · 2026-12-02 00:11 UTC · [original](https://github.com/Androtim/MiniVI/pull/299) `Androtim:fix/texture-safe-show` → `main` · +255 −7 · 5 files · 1 commits · merged 2026-12-02 00:19 UTC ### Summary Prevents reused 64 MiB pool texture placements from being exposed to shader descriptor slots before their first GPU upload finishes executing (eliminating stale/swapped pool-chunk texture artifacts, adapted cleanly from crbns/victory-tapin @ 3dba942, GPL-3.0). ### Changes - **crates/victory-gpu/src/resource.rs & crates/victory-gpu/src/texture/ahead.rs:** Track HostTexture::sent (first recorded upload submission) and expose HostTexture::note_sent(), sent_submission(), and landed() (with Release/Acquire ordering across ahead copy workers). - **crates/victory-gpu/src/texture.rs:** Record ote_sent() at all GPU upload paths ( ecord_upload for movie planes & direct CPU uploads, PreludeUpload::finish_refresh, and upload_on_card). - **crates/victory-gpu/src/descriptor/host.rs & crates/victory-gpu/src/draw.rs:** - Enable VICTORY_TEXTURE_SAFE_SHOW and VICTORY_SHOW_AFTER by default (=0 kill-switches only). - Keep previous compatible views or neutral stand-ins for unlanded pooled title-filled non-aliased textures in HostHeap::mirror, HostHeap::mirror_after, and draw.rs (shows_other / same == true bindless path). - Bound exture_slots_flip to requeue once (sent_sub > finished up to SAFE_SHOW_MAX_WAIT_FRAMES = 8) for in-flight uploads, or hand back immediately to the texture pass when no main-queue upload was submitted (sent_sub == 0). ### Verification - cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: 319 files ok - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked texture_safe_show: 3/3 passed - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked descriptor::: 86/86 passed - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked texture::: 15/15 passed (4 ignored bench measurements) - Dual workspace clippy --workspace --locked --all-targets -- -D warnings (default + --features diagnostics): clean - Plain --release --bin MiniVI --locked + objdump -p: standard Windows DLLs only ### Paired 90s Plain --release 1440p A/B (PlayParity, LowVram, DLSS quality, -AutoNudgeMenu) | Metric | origin/main (dbe161b) | PR ( ix/texture-safe-show) | Delta | |---|---:|---:|---:| | Median / Min FPS | 12.55 fps (79.7 ms) / 3.9 fps | 11.80 fps (84.8 ms) / 7.9 fps | min FPS **+4.0 fps** (smoother) | | Preparing / Copyback | 33.75 ms / 11.2 ms | 37.0 ms / 9.9 ms | -1.3 ms copyback | | Peak VRAM / Budget | 6273 / 6552 MB (over=0) | 6091 / 6616 MB (over=0) | **-182 MB peak** | | oom_false / o_room_so_far | 23.1% / 6000 | **
Adapted from crbns/victory-tapin (3dba942, GPL-3.0). Tracks the first GPU upload submission on HostTexture (via direct, prelude, card-detile, and ahead paths) and defaults VICTORY_TEXTURE_SAFE_SHOW and VICTORY_SHOW_AFTER to ON (=0 kill-switches). Before any pooled title-filled non-aliased texture finishes uploading on the GPU, HostHeap::mirror and draw-time mirror_after paths hold the previous compatible view or neutral stand-in, and texture_slots_flip waits cleanly once for in-flight submissions instead of binding stale pooled bytes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 00:13:40 +00:00
github-bot changed target branch from main to gh-pr/299/base 2026-12-02 00:24:13 +00:00
github manually merged commit 2805968e97 into gh-pr/299/base 2026-12-02 00:24:15 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-02 00:19 UTC · original

Audited full diff (2805968e, +255 -7 across 5 files), submission-ordering correctness, plain---release 90s A/B, and --features diagnostics visual frames:

  • Correctness & policy: Verified STARTED.fetch_add(1) runs at the start of Host::submit before Step::Host (defer_host) and PreludeUpload::finish_refresh, so note_sent() records the exact in-flight submission number (Release/Acquire paired with ahead::is_done). VICTORY_TEXTURE_SAFE_SHOW and VICTORY_SHOW_AFTER are default-on with =0 safety kill-switches only; texture_slots_flip is bounded by SAFE_SHOW_MAX_WAIT_FRAMES = 8.
  • Plain --release 90s A/B (20 windows):
    • Strong gains across stability, streaming, VRAM, and host RAM: min FPS 3.9 -> 7.9 fps, copyback 11.2 -> 9.9 ms, VRAM 6,273 -> 6,091 MB (over=0 MB, room_false 23.1% -> 0.0%, no_room_so_far 6,000 -> 0), final_waiting 11,165 -> 1,830 (PASS, -83.6%), showed_another_view 5 -> 0, peak private RAM -792 MB (22,192 -> 21,400 MB), peak WS -1,135 MB, 0 crashes.
    • Compared against same-scene main (eff27355, 7,346 draws): +0.35 fps (11.45 -> 11.80), -0.2 ms preparing (37.2 -> 37.0 ms), -1.1 ms copyback (11.0 -> 9.9 ms), -76% final_waiting (7,610 -> 1,830).
  • Direct --features diagnostics PNG inspection: Inspected frame-4752.png, frame-5721.png, and frame-5737.png directly — crisp lighting, zero swapped/corrupted textures, 0.0% magenta (near_black=55.25% is purely natural dim interior scene shadow under bright HDR windows, not black-texture corruption).
  • Disjoint from eff27355 (host.rs), CI green (46776659252). Merging now.
**@⁠Androtim** on GitHub · 2026-12-02 00:19 UTC · [original](https://github.com/Androtim/MiniVI/pull/299#issuecomment-7330406533) Audited full diff (`2805968e`, `+255 -7` across 5 files), submission-ordering correctness, plain-`--release` 90s A/B, and `--features diagnostics` visual frames: - **Correctness & policy:** Verified `STARTED.fetch_add(1)` runs at the start of `Host::submit` before `Step::Host` (`defer_host`) and `PreludeUpload::finish_refresh`, so `note_sent()` records the exact in-flight submission number (Release/Acquire paired with `ahead::is_done`). `VICTORY_TEXTURE_SAFE_SHOW` and `VICTORY_SHOW_AFTER` are default-on with `=0` safety kill-switches only; `texture_slots_flip` is bounded by `SAFE_SHOW_MAX_WAIT_FRAMES = 8`. - **Plain `--release` 90s A/B (`20` windows):** - Strong gains across stability, streaming, VRAM, and host RAM: `min FPS 3.9 -> 7.9 fps`, `copyback 11.2 -> 9.9 ms`, `VRAM 6,273 -> 6,091 MB` (`over=0 MB`, `room_false 23.1% -> 0.0%`, `no_room_so_far 6,000 -> 0`), `final_waiting 11,165 -> 1,830` (`PASS`, `-83.6%`), `showed_another_view 5 -> 0`, peak private RAM `-792 MB` (`22,192 -> 21,400 MB`), peak WS `-1,135 MB`, `0` crashes. - Compared against same-scene `main` (`eff27355`, `7,346` draws): `+0.35 fps` (`11.45 -> 11.80`), `-0.2 ms` `preparing` (`37.2 -> 37.0 ms`), `-1.1 ms` `copyback` (`11.0 -> 9.9 ms`), `-76%` `final_waiting` (`7,610 -> 1,830`). - **Direct `--features diagnostics` PNG inspection:** Inspected `frame-4752.png`, `frame-5721.png`, and `frame-5737.png` directly — crisp lighting, zero swapped/corrupted textures, `0.0%` magenta (`near_black=55.25%` is purely natural dim interior scene shadow under bright HDR windows, not black-texture corruption). - Disjoint from `eff27355` (`host.rs`), CI green (`46776659252`). Merging now.
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!299
No description provided.