GPU: hash textures that changed lately at every check (fixes startup flicker) #63
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!63
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/63/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?
@arminkhaleghirod on GitHub · 2026-11-24 21:02 UTC · original
arminkhaleghirod:texture-guard-live→main· +15 −2 · 1 files · 1 commits · closed without mergingFixes #39.
The texture guard (
VICTORY_TEXTURE_GUARD, on by default) skips a texture in view memory unless it saw a write, and hashes it only every eighth frame. It can't see writes made through another view, which is how the startup animation's frames get filled. So the three textures it cycles through were each refreshed only now and then, and the animation jumped back and forth between old frames.Now a texture whose hash changed is hashed at every check for the next 30 frames. Animated textures stay current, and static ones keep the guard's savings.
Frames 550 to 1000, on an RTX 4080 with the Series X profile. A jump back is a frame where n and n+2 match but n+1 doesn't.
VICTORY_TEXTURE_GUARD=0Also confirmed by eye: no flicker.
cargo test -p victory-gpupasses, and clippy is clean.@rostaddotcc on GitHub · 2026-11-24 21:16 UTC · original
Checked this on a Linux host (CachyOS, RX 7900 XT/RDNA3, Mesa 26.3.1 RADV) at
059ab35:cargo xwin build --release -p victory --target x86_64-pc-windows-msvc— clean, 19.4 s.cargo xtask policy— 169 files ok.cargo test -p victory-shader— 171 passed, 0 failed, 2 ignored.cargo test -p victory-gpu --libdoes not compile on Linux —cannot find function 'host_resource',cannot find 'host' in 'crate',cannot find 'texture' in 'crate'. That is pre-existing, not from this PR:mainfails the same three errors, because the test module references items behind#[cfg(windows)]. So nobody can run the victory-gpu unit tests off Windows today, which is worth knowing before merging a victory-gpu change on the strength of "tests pass".The change itself reads right to me: the guard misses writes made through another view, and a frame-ring texture is exactly that shape. Two things I would want in the PR before merge:
LIVE_FRAMES = 30is a sliding window, so a texture that changes every frame (the video ring this is aimed at) haschangedset on every check and therefore stays "live" forever — it is hashed on every check from then on, not for 30 frames. That may well be the right trade (a 4K texture is 33 MB to hash at ~20 GB/s of mapped reads, so ~1.5 ms), but the comment reads as if it were bounded.copystat'sTexChangedwill jump when the fix is active; quoting that number before/after on one machine would let the next person tell "fixed the flicker" from "fixed the flicker and halved the texture lane".If it helps, this rig can run the before/after on the loading phase (where the texture lane is already 146–907 ms/frame) and quote
TexChanged, the texture lane and the flicker withVICTORY_RELAY=2 VICTORY_LATE_WAIT=0versusVICTORY_RELAY=0. Not run yet.@adriaespii on GitHub · 2026-11-24 21:23 UTC · original
Independent test run on commit
059ab35(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 496 passed, 0 failed, 7 ignored (victory-gpu: 110 passed, 0 failed, 1 ignored;victory-shader: 210 passed, 0 failed, 2 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
@arminkhaleghirod on GitHub · 2026-11-24 21:37 UTC · original
Closing in favour of #58: same fix, opened first, and it also covers new textures and has an off switch. Tested it, it scores clean (numbers on #58). Thanks @rostaddotcc for the review. The cost point applies there too.
@rostaddotcc on GitHub · 2026-11-24 21:37 UTC · original
Correcting my earlier note: the
victory-gpusuite can run against this PR on Linux, and now I have. The recipe matters — with Wine'sd3d12stub the GPU tests return early and the run is vacuous, so these results come from vkd3d-proton servingd3d12and Microsoft'sd3dcompiler_47as the native override:main(4e17478)059ab35)The one failure is the same on both and is not yours:
pipeline::library::tests::a_rejected_blob_gives_an_empty_librarypanics atlibrary.rs:731—open()returnsNonefor a garbage blob on vkd3d-proton where native D3D12 hands back an empty library. So on this platform the change is at parity withmain, which is what I can say about it; the flicker itself needs a run withVICTORY_RELAY=2 VICTORY_LATE_WAIT=0versusVICTORY_RELAY=0, and I have not done that one.@ezbyDev on GitHub · 2026-11-24 21:39 UTC · original
Confirmed on AMD: RX 9060 XT 16 GB (RDNA4), Adrenalin driver 32.0.32029.2010, i7-9700K, Windows 11 Pro 26300, diag build, Series X profile, default switches plus
VICTORY_RELAY=2and the RDNA4 skip list from #3.main4e17478main,VICTORY_TEXTURE_GUARD=0main+ this PR (059ab35)Judged by eye over several runs, no frame captures. I also tried an extra change on top (making the host copy at once when a live slot gets a view of a texture that has no copy yet, for
VICTORY_LAZY_TEXTURES): no visible difference with this PR, so I'm not proposing it.AI-assisted (Claude Code, Claude Opus 5.5): bisected with the switches and wrote this; runs on my own machine.
@dkdknight on GitHub · 2026-11-24 22:17 UTC · original
Tested on an RTX 5080 (merged with #80, #71, #81, #77 and #38 on
4e17478): the loading-screen images no longer glitch. The person at the machine had seen them misbehave on every earlier build. No other visible change in the world, no device removal. Frame time unchanged: 221 ms at the same spot, against 202 ms for the same build without #80/#63 (one run each, within this machine's run-to-run spread).Setup: NVIDIA GeForce RTX 5080 16 GB, driver 621.14, i9-13900KF, Windows 11 26200, release build, Series X profile.
cargo test --release -p victory-gpu --libon the merged tree: 113 passed, 0 failed, 1 ignored.AI use: Claude Code, Claude Opus 5.5 merged, built, ran the tests and the game, and wrote this comment. The visual check is the user's.
Pull request closed