GPU: hash a view-memory texture once more at its next check, and ever… #509
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/509"
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?
Imported from fxceless/victory-fork. Originally posted by pug205gti6 on 2026-11-25T01:54:39Z.
…y check while it keeps changing
Why: the title's Bink 2 video planes live in view memory. They are written through the CPU view of their pages and sampled through the GPU view, and they cycle through a ring of three textures, so each texture is sampled (and checked) only every third frame. The guard on view memory sees writes made through the texture's own view but not a write to the same pages through another view, and what it cannot see was found only by a hash taken every eighth frame (
HASH_EVERY), by the texture's address. Each plane therefore showed up to seven frames late, and the intro's picture jumped between three older frames.What: a texture whose hash found it changed is hashed once more at its next check. If it changed again it is hot: it is hashed at every check while it keeps changing, and for 24 frames after its last change (
HOT_FRAMES). A texture that streams in changes once, is found as it was at the extra look, and is not hashed on. The state is three fields ofLast(hot_until,changed_at,verify) and three small methods (changed,unchanged,hash_due); the turn test becomesturn || last.hash_due(frame).Why the next check and not the next frame: a ring texture is checked every third frame, so "changed again" cannot mean "changed in the next frame"; the extra look counts for
VERIFY_FRAMES(24) frames after the change.Measured on frames of the intro: the ratio of the mean difference between consecutive frames to that between frames three apart was 7.5 with the bug and is 0.57 now (a smooth scene: 0.36). In the world the cost is as before (textures 12.9 ms against 13.2 ms, median frame 336 ms against 394 ms). Hashing every check (VICTORY_TEXTURE_GUARD=0) fixes the intro too but cost 160 ms a frame in the world in an earlier attempt, and a 120-frame hot window made the world's texture work 160 ms. Three unit tests (no GPU) cover the state machine: a texture changing at every check goes hot, one that changed once does not, a hot one cools down.
Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T07:35:59Z.
Duplicate of #460: @xunbreakablex opened this patch 42 minutes earlier, and
gh pr diffreturns the same bytes for both (+100/-1 on 1 file(s), same title).Please continue in #460 so the review history and any test data stay in one place.
Thanks.
Imported from fxceless/victory-fork. Originally posted by xunbreakablex on 2026-11-25T07:42:30Z.
For whoever follows this: #460 is closed (not merged). I closed it because
mainnow has8dd30ab("A write through one view of a page is seen at its other views"), which removes the cause both patches worked around, so the hash-twice-then-hot change may no longer be needed. I have not re-run the intro on the newmainto check, and I cannot follow either PR further. The cost numbers in #460's description (the first variant, 120 frames hot, cost 13 → 160 ms a frame in the world; this variant 13-21 ms) can be reused if the flicker comes back.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.