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

Open
github-bot wants to merge 1 commit from github-bot/gh-701 into main AGit
Owner

@⁠traeb0n on GitHub · 2026-11-25 05:00 UTC · original
traeb0n:pr/video-ring-textures → main · +43 −1 · 1 files · 1 commits · open

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

**@⁠traeb0n** on GitHub · 2026-11-25 05:00 UTC · [original](https://github.com/fxceless/victory-fork/pull/701) `traeb0n:pr/video-ring-textures` → `main` · +43 −1 · 1 files · 1 commits · open ## 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)
A sampled texture in view memory has no write watch; it is guarded, and
what the guard cannot see is found only by the hash taken on the
texture's eighth-frame turn. The intro video decodes into a ring of three
plane sets (luma 3840x2160 and two 1920x1080 chroma, R8) written through
another view, so the guard never fires. The YUV-to-RGB draw reads a
different set each frame, and a set's use and its hash turn met only about
every 24 frames: two presented frames in three showed video from up to two
seconds before (frame captures: 2 uploads of the planes in 12 frames; at
120 Hz screen capture, 104 of 280 presented frames were closer to the frame
two back than to the one before).

- 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
  such a texture is found at its second use rather than its first turn
  (the ring's memory moves from run to run, so it cannot be remembered by
  address).

With both, the planes are uploaded every frame (12.7 MB, about 4 ms of
refresh a frame during the video) and the intro plays without old frames:
0 of 318 frames out of order, no doubled frames, on an RTX 5070.
VICTORY_TEXTURE_BEHIND_GUARD=0 restores the turn only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:49:15 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/texture.rs
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.
git fetch -u origin '+refs/pull/701/head:github-bot/gh-701'
git switch 'github-bot/gh-701'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-701'
git switch 'github-bot/gh-701'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-701'
git switch 'github-bot/gh-701'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-701'
git switch 'main'
git merge --squash 'github-bot/gh-701'
git switch 'main'
git merge --ff-only 'github-bot/gh-701'
git switch 'main'
git merge 'github-bot/gh-701'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.