Textures written behind their guards are hashed at every check (intro video showed old frames) #701

Closed
traeb0n wants to merge 1 commit from upstream-pr/701 into main
traeb0n commented 2026-11-25 05:00:09 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by traeb0n on 2026-11-25T05:00:09Z.


What was wrong

The intro video (the collage that turns into the logo) flashed and stuttered: the screen cycled through three frames, one current and two from up to two seconds earlier.

The video decodes into a ring of three plane sets (luma 3840x2160 and two 1920x1080 chroma, R8) in view memory, written through another view. Those textures have no write watch and are guarded, so the guard never fires. The only thing that finds the change is the hash on the texture's eighth-frame turn. The YUV-to-RGB draw (pixel 3bfe730f7e24ee1a) reads a different set each frame, and a set's use and its turn line up only about every 24 frames.

Evidence:

  • A diagnostics build with VICTORY_CAPTURE_FRAMES + VICTORY_DUMP_TARGETS showed the planes uploaded only twice in 12 captured frames, while the draw read a different set every frame.
  • A 120 Hz screen capture had 104 of 280 presented frames closer to the frame two back than to the one before.

The change (texture.rs only)

  • A texture whose hash finds it changed while its guard saw no write is hashed at every check from then on (Last::behind_guard).
  • A guarded texture's first three checks hash it whatever the turn, so a texture like this is found at its second use, not at its first turn. The ring's memory moves from run to run, so it can't be remembered by address.
  • VICTORY_TEXTURE_BEHIND_GUARD=0 restores the old behaviour.

Result (RTX 5070, i7-14700K)

  • The planes are uploaded every frame during the video: 12.7 MB, about 4 ms of refresh a frame.
  • 0 of 318 frames out of order and no doubled frames over the whole intro, from its first frame.
  • Tested through boot, the intro and the loading screens, where only the 9 planes were flagged. Not yet tested in the open world.
  • The cost outside the video is three hashes for each new guarded texture.

Tested on top of 310c6eb. cargo check -p victory-gpu is clean apart from an existing dead-code warning.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:5485468528 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/701). Originally posted by [traeb0n](https://github.com/traeb0n) on 2026-11-25T05:00:09Z. --- ## What was wrong The intro video (the collage that turns into the logo) flashed and stuttered: the screen cycled through three frames, one current and two from up to two seconds earlier. The video decodes into a ring of three plane sets (luma 3840x2160 and two 1920x1080 chroma, R8) in view memory, written through **another view**. Those textures have no write watch and are guarded, so the guard never fires. The only thing that finds the change is the hash on the texture's eighth-frame turn. The YUV-to-RGB draw (pixel `3bfe730f7e24ee1a`) reads a different set each frame, and a set's use and its turn line up only about every 24 frames. Evidence: - A diagnostics build with `VICTORY_CAPTURE_FRAMES` + `VICTORY_DUMP_TARGETS` showed the planes uploaded only twice in 12 captured frames, while the draw read a different set every frame. - A 120 Hz screen capture had 104 of 280 presented frames closer to the frame two back than to the one before. ## The change (`texture.rs` only) - A texture whose hash finds it changed while its guard saw no write is hashed at every check from then on (`Last::behind_guard`). - A guarded texture's first three checks hash it whatever the turn, so a texture like this is found at its second use, not at its first turn. The ring's memory moves from run to run, so it can't be remembered by address. - `VICTORY_TEXTURE_BEHIND_GUARD=0` restores the old behaviour. ## Result (RTX 5070, i7-14700K) - The planes are uploaded every frame during the video: 12.7 MB, about 4 ms of refresh a frame. - 0 of 318 frames out of order and no doubled frames over the whole intro, from its first frame. - Tested through boot, the intro and the loading screens, where only the 9 planes were flagged. Not yet tested in the open world. - The cost outside the video is three hashes for each new guarded texture. Tested on top of `310c6eb`. `cargo check -p victory-gpu` is clean apart from an existing dead-code warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
traeb0n commented 2026-11-28 04:19:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by traeb0n on 2026-11-28T04:19:54Z.


Closing: superseded by VItoriaBr 5668b8b and the fork's VICTORY_VIEW_GUARD work. Thanks!

<!-- greyfinch-sync:fxceless/victory-fork:comment:7233933194 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/701#issuecomment-7233933194). Originally posted by [traeb0n](https://github.com/traeb0n) on 2026-11-28T04:19:54Z. --- Closing: superseded by VItoriaBr 5668b8b and the fork's VICTORY_VIEW_GUARD work. Thanks!

Pull request closed

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
fxceless/victory-fork!701
No description provided.