GPU: a texture that changed with no write seen is hashed at each check for a while #159
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!159
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-159"
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?
@NuraadGit on GitHub · 2026-11-24 21:59 UTC · original
NuraadGit:gpu/texture-unseen-writes→main· +81 −6 · 1 files · 1 commits · openWhat it fixes
On the loading/intro video the picture switched between older and newer frames, so the video strobed.
The video's frames are textures that the runtime writes through another view of their pages, so write watching never sees those writes. Such textures are only hashed every eighth frame, staggered by address. With a ring of three frame textures, a slot kept showing its old picture until its turn came round.
Change (
crates/victory-gpu/src/texture.rs)Lastgets anunseencounter. If a texture's hash changed although no write to it was seen, it is hashed at each of its next 64 checks instead of waiting for its eighth-frame turn.n <= 8or powers of two).a_texture_that_changed_unseen_is_hashed_at_each_check.Testing
RTX 2080 (8 GB, Windows 11), on this fork, warm shader cache:
cargo test -p victory-gpu --libpasses;cargo clippyadds no warnings.Cost: only textures that changed without a seen write get hashed more often, and only for 64 checks after each change.
AI-assisted (Claude Code). I reviewed and tested it.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 21:59 UTC · original · edited 2026-11-24 22:01 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
6109393ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@BitWuehler on GitHub · 2026-11-24 22:40 UTC · original
Tested on CachyOS Linux (
Ryzen 7 9800X3D,RTX 5080620.73.04,GE-Proton11-14, release build, Series X files) bundled on4e17478with#454,#127,#154,#95,#108, and#92:victory-gpu(114/115non-ignored pass underGE-Proton11-14; only the known vkd3d-protonCreatePipelineLibrarystub fails).41world intervals, 0 crashes/device removals), the user visually noted the opening scene showed noticeably more cleanly compared to before#159(alongside#95/#92/#108).#95+#108+#92,preparing: texturesmedian dropped from596.55 ms(892.66 msmean) to91.30 ms(122.55 msmean;10.5 msin the final 5,426-draw frame), showing#159did not introduce texture-path slowdowns in this Proton stack.(AI-assisted build/log analysis.)
@Asenje on GitHub · 2026-11-24 23:04 UTC · original
Independent confirmation on RTX 3060 12 GB / i7-7700K, fork
4e17478+ an equivalent patch (hash a texture at every check for 60 frames after a change its guard did not see).Capture of the intro (OBS, 60 fps, mean luma per frame; counting frames where n matches n-6 but not n-2/n-4, i.e. a 3-texture cycle):
The log names the ring: three textures changed unseen in the same frame (0xb4a800000, 0xb4ac00000, 0xb4b000000), then two more triples a few frames later, and three more (0xc90…) during the opening cutscene. No new warnings, no visible cost in the intro (6 draws/frame, 30 fps).
@clypeal6 on GitHub · 2026-11-24 23:05 UTC · original
Tested on an RTX 4070 Laptop GPU (8 GB, driver 621.14, default TDR), i9-14900HX, Windows 11, Series X profile, diag build with
--features diagnostics. #159 applied on top of2119b0e(it applies cleanly;texture.rsis unchanged since its base4e17478). Warm shader cache, debug layer off.Jump-backs in the intro. Every presented frame from 300 to 850 was saved (
VICTORY_CAPTURE_FRAMES), which covers the loading-screen transitions. A frame counts as a jump-back when it differs from frame n-1 but matches one of frames n-2…n-8, and that older frame itself differs from n-1 (mean absolute difference on a 64×36 grey thumbnail: ≤ 0.6 is a match, > 2 is a change).2119b0e(texture guard on)2119b0e+VICTORY_TEXTURE_GUARD=02119b0e+ #159The PR's log line fired as expected (
a texture changed though no write to it was seenfor 1920×1080 and 3840×2160 2D textures). By eye on the unpatched build, each loading-screen transition flickers between the old, a half-faded and the new picture for about half a second.Cost, from runs without per-frame saving (saving every frame drops the intro to 5–7 fps, so those runs are not used here). The intro holds its 30 fps cap in all three, and reaches frames 512 and 1024 equally fast (about 18 s apart).
preparing: texturesduring the loading screensSo #159 costs more than turning the guard off while the video plays (it hashes the 3840×2160 target each check), but drops back to the guarded cost once the video stops.
cargo test -p victory-gpu --lib(texture tests, includinga_texture_that_changed_unseen_is_hashed_at_each_check): pass. No device removals or GPU errors in any run.Not checked: whether it changes anything in the world; runs were 75–120 s.
AI-assisted (Claude Code): the runs, frame comparison and numbers were produced by Claude Code and checked against the logs.
@ryotdev on GitHub · 2026-11-24 23:39 UTC · original
I found one path that misses this PR’s unseen-write tracking on
6109393. When a remap is in progress andVICTORY_TEXTURE_NO_WAIT=1,refresh_unlockedstores the new hash directly. If the texture changed through an alias, the next check can still take the every-eighth-frame shortcut. #270 makes this path the default.I put a one-file fix and synthetic regression directly on top of your head. The unlocked read now passes the same
unwrittenflag toLast::hashedas the ordinary path. The first snapshot and a reported write leave the counter at zero, a change without a reported write arms all 64 checks, and an unsuccessful kernel read preserves the last good state. Cherry-pickable commitI reproduced the zero-counter failure on native Windows x64 and reran the same test after the fix. All four texture tests and the mapping synchronization test passed. The regression uses a synthetic 16-byte texture. AI-assisted.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.