killflash v3: the one-frame tree blink fixed at its cause, with no waiting (replaces #42) #179

Manually merged
github merged 1 commit from github-bot/gh-178 into gh-pr/178/base 2026-12-06 01:29:06 +00:00 AGit
Owner

@⁠PillowFullOfBricks on GitHub · 2026-12-05 21:27 UTC · original
PillowFullOfBricks:table-writes → main · +230 −3 · 6 files · 1 commits · merged 2026-12-06 00:38 UTC

killflash v3: the one-frame tree blink fixed at its cause, with no waiting (replaces #43)


With thin lists on, trees, bushes and props could vanish for a single frame every few seconds. #43 ("killflash v2") hid that by making lists wait for each other. It worked, but the waiting was paid for on the submit thread: more submit time every frame, and a floor under frame time as soon as the processor is the limit. That is why it was kept off by default.

This change removes the cause instead. Nothing waits, nothing is ordered, and submit time is the same with it on and off. It is on by default. #43 is closed as obsolete.

Same scene, one launch, switch flipped every 8 s off (main as it is) on (this change)
Frames judged 4,418 4,337
Blink frames (26 to 80 picture blocks hit) 36 0
Submit work, prep + thin 8.8 + 1.5 ms 8.7 + 1.3 ms
Frame time 23.7 ms 23.3 ms

What was wrong

The title keeps a small table of descriptors for each frame and rewrites one buffer view in it every frame from a worker thread. Most of the time that write lands in the first millisecond or two of the frame. Now and then the worker runs late and the write lands about 10 ms in.

With thin lists, draws are translated while the title is still recording the frame. When the title writes a buffer view into a table slot, the host slot is deliberately left empty, to be made by the next draw that reads it. That is fine as long as a draw still comes. When the write is late, every draw that uses the slot has already been translated. Nothing makes the slot again, the lists run with an empty slot, and the mesh draws that read through it put nothing on screen. One frame later the write is early again and everything is back.

This also explains why every earlier remedy worked: a wait, a sleep, one translating thread, the frame recorder or the order rule of #43 all push translation past the title's late write.

What is changed

When the title writes a buffer view into a table slot that a draw of the frame under way has already read, the view is made at once instead of being left for a draw that will not come.

  • descriptor/host.rs: a per-slot mark, set only when a draw reads the slot directly through the title's table. A write of a buffer view into a slot marked for this frame is made on the spot. The existing tabled stamp and the texture path are untouched.
  • draw.rs: the mark is set before the slot's record is read, so a write and a read of the same slot cannot both miss each other.
  • tablewrite.rs (new): the few slots made this way are noted, and the submissions of the frame bring what those views show up to date.
  • shadow.rs, host.rs: a small split of Shadow::refresh and the hand-over at the top of Host::submit.

It is cheap because it is rare: in the run above the rule acted about once every three frames, 1,928 times in four and a half minutes.

How the cause was found

The blink was measured rather than guessed at, one step at a time, each step a run of a few minutes.

  1. A score that does not depend on the eye. The pop watch compares each frame's picture with its neighbours and counts the blocks that change for exactly one frame. With VICTORY_AB flipping a switch every 8 seconds, each run compares two arms in the same scene.
  2. What the card did in a blink frame. The card's own counters per pipeline showed that the prop and foliage mesh draws were issued in full and produced the same primitives as in the frames around them, but nearly all of them were clipped away. So no draw was lost: they ran with wrong data.
  3. What exactly those draws read. For those draws, every view they read was logged twice, when the draw was translated and when its list was submitted. One slot stood out: in every one of the 40 blink frames, draws had been translated before the title's write to it and were left with an empty or unfinished slot. None of 144 clean frames examined the same way showed that.
  4. The fix as a live switch. First on the test build, then as this commit on main, each scored the same way.

Measured

Radeon RX 9070 XT, Ryzen 9850X3D, Windows 11, 4K output with FSR 4 performance, ray tracing and frame generation, standing still in front of a treeline. The fix was scored in two separate A/B runs after about ten diagnostic runs of the same scene on the way there.

Run Arm Frames judged Blink frames prep + thin
This commit on main (ca49e25), 4.5 min off 4,418 36 10.3 ms
on 4,337 0 10.0 ms
Earlier, broader form of the rule, 3 min off 2,678 62 10.5 ms
on 2,603 0 10.5 ms

In the run on main one small frame of 5 to 6 blocks, in another part of the picture, was counted in each arm.

Checked for Windows in the diagnostics and release profiles with warnings as errors, and with clippy at -D warnings.

Switch and log line

  • VICTORY_TABLE_WRITES (on; 0 gives the behaviour before this change). In a diagnostics build it can be flipped live with VICTORY_AB='8,VICTORY_TABLE_WRITES'.
  • With VICTORY_STATS_LOG=1, every 5 seconds: table writes (VICTORY_TABLE_WRITES), since the start: N buffer views made as the title wrote them into slots draws of the frame had read, ...

Claude Fable 5.2

**@⁠PillowFullOfBricks** on GitHub · 2026-12-05 21:27 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/178) `PillowFullOfBricks:table-writes` → `main` · +230 −3 · 6 files · 1 commits · merged 2026-12-06 00:38 UTC killflash v3: the one-frame tree blink fixed at its cause, with no waiting (replaces #43) --- With thin lists on, trees, bushes and props could vanish for a single frame every few seconds. #43 ("killflash v2") hid that by making lists wait for each other. It worked, but the waiting was paid for on the submit thread: more submit time every frame, and a floor under frame time as soon as the processor is the limit. That is why it was kept off by default. **This change removes the cause instead. Nothing waits, nothing is ordered, and submit time is the same with it on and off.** It is on by default. #43 is closed as obsolete. | Same scene, one launch, switch flipped every 8 s | off (main as it is) | on (this change) | |---|---|---| | Frames judged | 4,418 | 4,337 | | Blink frames (26 to 80 picture blocks hit) | 36 | 0 | | Submit work, prep + thin | 8.8 + 1.5 ms | 8.7 + 1.3 ms | | Frame time | 23.7 ms | 23.3 ms | ## What was wrong The title keeps a small table of descriptors for each frame and rewrites one buffer view in it every frame from a worker thread. Most of the time that write lands in the first millisecond or two of the frame. Now and then the worker runs late and the write lands about 10 ms in. With thin lists, draws are translated while the title is still recording the frame. When the title writes a buffer view into a table slot, the host slot is deliberately left empty, to be made by the next draw that reads it. That is fine as long as a draw still comes. When the write is late, every draw that uses the slot has already been translated. Nothing makes the slot again, the lists run with an empty slot, and the mesh draws that read through it put nothing on screen. One frame later the write is early again and everything is back. This also explains why every earlier remedy worked: a wait, a sleep, one translating thread, the frame recorder or the order rule of #43 all push translation past the title's late write. ## What is changed When the title writes a buffer view into a table slot that a draw of the frame under way has already read, the view is made at once instead of being left for a draw that will not come. - `descriptor/host.rs`: a per-slot mark, set only when a draw reads the slot directly through the title's table. A write of a buffer view into a slot marked for this frame is made on the spot. The existing `tabled` stamp and the texture path are untouched. - `draw.rs`: the mark is set before the slot's record is read, so a write and a read of the same slot cannot both miss each other. - `tablewrite.rs` (new): the few slots made this way are noted, and the submissions of the frame bring what those views show up to date. - `shadow.rs`, `host.rs`: a small split of `Shadow::refresh` and the hand-over at the top of `Host::submit`. It is cheap because it is rare: in the run above the rule acted about once every three frames, 1,928 times in four and a half minutes. ## How the cause was found The blink was measured rather than guessed at, one step at a time, each step a run of a few minutes. 1. **A score that does not depend on the eye.** The pop watch compares each frame's picture with its neighbours and counts the blocks that change for exactly one frame. With `VICTORY_AB` flipping a switch every 8 seconds, each run compares two arms in the same scene. 2. **What the card did in a blink frame.** The card's own counters per pipeline showed that the prop and foliage mesh draws were issued in full and produced the same primitives as in the frames around them, but nearly all of them were clipped away. So no draw was lost: they ran with wrong data. 3. **What exactly those draws read.** For those draws, every view they read was logged twice, when the draw was translated and when its list was submitted. One slot stood out: in every one of the 40 blink frames, draws had been translated before the title's write to it and were left with an empty or unfinished slot. None of 144 clean frames examined the same way showed that. 4. **The fix as a live switch.** First on the test build, then as this commit on main, each scored the same way. ## Measured Radeon RX 9070 XT, Ryzen 9850X3D, Windows 11, 4K output with FSR 4 performance, ray tracing and frame generation, standing still in front of a treeline. The fix was scored in two separate A/B runs after about ten diagnostic runs of the same scene on the way there. | Run | Arm | Frames judged | Blink frames | prep + thin | |---|---|---|---|---| | This commit on main (ca49e25), 4.5 min | off | 4,418 | 36 | 10.3 ms | | | on | 4,337 | 0 | 10.0 ms | | Earlier, broader form of the rule, 3 min | off | 2,678 | 62 | 10.5 ms | | | on | 2,603 | 0 | 10.5 ms | In the run on main one small frame of 5 to 6 blocks, in another part of the picture, was counted in each arm. Checked for Windows in the diagnostics and release profiles with warnings as errors, and with clippy at `-D warnings`. ## Switch and log line - `VICTORY_TABLE_WRITES` (on; `0` gives the behaviour before this change). In a diagnostics build it can be flipped live with `VICTORY_AB='8,VICTORY_TABLE_WRITES'`. - With `VICTORY_STATS_LOG=1`, every 5 seconds: `table writes (VICTORY_TABLE_WRITES), since the start: N buffer views made as the title wrote them into slots draws of the frame had read, ...` --- Claude Fable 5.2
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 21:32:40 +00:00
Author
Owner

@⁠SovietBearz0r on GitHub · 2026-12-05 22:48 UTC · original

Independent reproduction on a second RX 9070 XT, with a different scene than the author's treeline: the fix does what it says. Posting the method and numbers since the PR had no test reports yet.

Build: PR head d772beec on main at ca49e259, diag profile with --features diagnostics (cargo build --locked --profile diag -p victory --features diagnostics), Windows 11, RX 9070 XT, 4K output, FSR 4 performance, ray tracing + frame generation.

Method: the repo's own popwatch (VICTORY_POP_WATCH=0-100000, every frame's presented picture compared with its neighbours; a blip is a 16x16 block changed for exactly one frame) plus the benchmark's built-in cruise route (three measured spots: spawn_idle 10 s standing at spawn, cruise_out and cruise_back 15 s at 67 mph). Two runs in a row of the same route: one with VICTORY_TABLE_WRITES=0, one with the default (on). Blips counted only inside the BENCH_SPOT_START..BENCH_SPOT_END windows, using the same "26 to 80 blocks hit" definition of a blink frame as the PR body. Run-to-run frame counts in the windows were nearly identical (136 vs 137 frames had any blip logged).

arm blink frames in the spots (26-80 blocks) blinking 16x16 blocks in them
VICTORY_TABLE_WRITES=0 (as before) 28 (3 in cruise_out, 25 in cruise_back, 0 in spawn_idle) 1,705
default (on) 5 (0, 5, 0) 213
  • The fix was active: table writes (VICTORY_TABLE_WRITES), since the start: 433 buffer views made as the title wrote them into slots draws of the frame had read, 0 of them not noted, 213 ranges brought up to date with submissions.
  • No frame-rate cost in this scene: 45.4 / 41.8 / 39.9 fps with it off vs 45.4 / 39.7 / 39.6 fps with it on (print/bench noise; diagnostics build with popwatch on in both arms).
  • It is not zero in a moving cruise — the 5 remaining blinks look like other, rarer causes/streaming rather than this slot; the author's standing-treeline scene was the clean 36 -> 0 case. I did not try to drive the residual ones down.
  • My first attempt used VICTORY_AB='8,VICTORY_TABLE_WRITES' in a single run; that was noisy and not usable (loading/world-entry blips dominate and the arms got unequal popwatch time). The two-run, spot-window-only numbers above are the reliable measurement.

Nothing to change in the code from my side; cargo xtask policy and the PR's CI are green, and this is the fix for the remaining one-frame tree/prop blink that #43 could only hide. One nit: the switch has no user-facing documentation (README/play.ps1 do not mention VICTORY_TABLE_WRITES); a one-line entry would make the A/B switch discoverable, but that shouldn't block the fix.

Tested on the fork's copy of the branch; happy to re-run a standing-treeline A/B (with the author's spot/coordinates) or on an NVIDIA card if someone has one.

**@⁠SovietBearz0r** on GitHub · 2026-12-05 22:48 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/178#issuecomment-7447071177) Independent reproduction on a second RX 9070 XT, with a different scene than the author's treeline: **the fix does what it says.** Posting the method and numbers since the PR had no test reports yet. **Build:** PR head `d772beec` on `main` at `ca49e259`, `diag` profile with `--features diagnostics` (`cargo build --locked --profile diag -p victory --features diagnostics`), Windows 11, RX 9070 XT, 4K output, FSR 4 performance, ray tracing + frame generation. **Method:** the repo's own popwatch (`VICTORY_POP_WATCH=0-100000`, every frame's presented picture compared with its neighbours; a *blip* is a 16x16 block changed for exactly one frame) plus the benchmark's built-in cruise route (three measured spots: `spawn_idle` 10 s standing at spawn, `cruise_out` and `cruise_back` 15 s at 67 mph). Two runs in a row of the same route: one with `VICTORY_TABLE_WRITES=0`, one with the default (on). Blips counted only inside the `BENCH_SPOT_START`..`BENCH_SPOT_END` windows, using the same "26 to 80 blocks hit" definition of a blink frame as the PR body. Run-to-run frame counts in the windows were nearly identical (136 vs 137 frames had any blip logged). | arm | blink frames in the spots (26-80 blocks) | blinking 16x16 blocks in them | |---|---|---| | `VICTORY_TABLE_WRITES=0` (as before) | 28 (3 in `cruise_out`, 25 in `cruise_back`, 0 in `spawn_idle`) | 1,705 | | default (on) | **5** (0, 5, 0) | **213** | - The fix was active: `table writes (VICTORY_TABLE_WRITES), since the start: 433 buffer views made as the title wrote them into slots draws of the frame had read, 0 of them not noted, 213 ranges brought up to date with submissions`. - No frame-rate cost in this scene: 45.4 / 41.8 / 39.9 fps with it off vs 45.4 / 39.7 / 39.6 fps with it on (print/bench noise; diagnostics build with popwatch on in both arms). - It is not zero in a *moving* cruise — the 5 remaining blinks look like other, rarer causes/streaming rather than this slot; the author's standing-treeline scene was the clean 36 -> 0 case. I did not try to drive the residual ones down. - My first attempt used `VICTORY_AB='8,VICTORY_TABLE_WRITES'` in a single run; that was noisy and not usable (loading/world-entry blips dominate and the arms got unequal popwatch time). The two-run, spot-window-only numbers above are the reliable measurement. **Nothing to change in the code from my side; `cargo xtask policy` and the PR's CI are green, and this is the fix for the remaining one-frame tree/prop blink that #43 could only hide.** One nit: the switch has no user-facing documentation (`README`/`play.ps1` do not mention `VICTORY_TABLE_WRITES`); a one-line entry would make the A/B switch discoverable, but that shouldn't block the fix. Tested on the fork's copy of the branch; happy to re-run a standing-treeline A/B (with the author's spot/coordinates) or on an NVIDIA card if someone has one.
Author
Owner

@⁠Mbappinho on GitHub · 2026-12-05 22:53 UTC · original

One more reproduction, in a setting the two reports above do not cover: native 4K with no upscaler and no frame generation, and the hardware RT path of #81 too (with it this blink was more frequent here). Ryzen 7 9800X3D, RX 9070 XT, Windows 11, -RayTracing -NoPcQuality, a still scene with a large plant that blinked often.

One exe: main at ca49e259 with #81, #87 and this PR merged, plus a local switch for the hot-block rules from before 627da774 (see #81). VICTORY_HW_RT=1. Each run recorded 60 s of the window at 60 fps; a blink is a frame where more than 2% of the plant's region differs from both its neighbours while they agree.

run VICTORY_TABLE_WRITES blink frames in 60 s fps (recorded)
1 0 10 29.2
2 on 0 29.7
3 on 0 29.3
4 0 10 29.8

The same test over the whole window, cut in a 10x6 grid: 10 frames with a blink somewhere in each run with it off, all in the plant's area, and none anywhere with it on.

Same frame rate with it on and off (recording costs a few fps in both), and no device removal in any run. The log line said about 1,900 buffer views made as written over each run. Two unrecorded runs of the same exe with it on: 33.5 fps hardware RT, 32.4 software.

Made with Claude Code.

**@⁠Mbappinho** on GitHub · 2026-12-05 22:53 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/178#issuecomment-7447142371) One more reproduction, in a setting the two reports above do not cover: native 4K with no upscaler and no frame generation, and the hardware RT path of #81 too (with it this blink was more frequent here). Ryzen 7 9800X3D, RX 9070 XT, Windows 11, `-RayTracing -NoPcQuality`, a still scene with a large plant that blinked often. One exe: `main` at ca49e259 with #81, #87 and this PR merged, plus a local switch for the hot-block rules from before 627da774 (see #81). `VICTORY_HW_RT=1`. Each run recorded 60 s of the window at 60 fps; a blink is a frame where more than 2% of the plant's region differs from both its neighbours while they agree. | run | `VICTORY_TABLE_WRITES` | blink frames in 60 s | fps (recorded) | |---|---|---|---| | 1 | 0 | 10 | 29.2 | | 2 | on | 0 | 29.7 | | 3 | on | 0 | 29.3 | | 4 | 0 | 10 | 29.8 | The same test over the whole window, cut in a 10x6 grid: 10 frames with a blink somewhere in each run with it off, all in the plant's area, and none anywhere with it on. Same frame rate with it on and off (recording costs a few fps in both), and no device removal in any run. The log line said about 1,900 buffer views made as written over each run. Two unrecorded runs of the same exe with it on: 33.5 fps hardware RT, 32.4 software. Made with Claude Code.
Author
Owner

@⁠randomuser1 on GitHub · 2026-12-05 23:05 UTC · original

old fashion test
~15mins real gameplay, seems to work, a single flicker, single tree after map close, probably different issue.
9070xt

**@⁠randomuser1** on GitHub · 2026-12-05 23:05 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/178#issuecomment-7447295311) old fashion test ~15mins real gameplay, seems to work, a single flicker, single tree after map close, probably different issue. 9070xt
github-bot changed target branch from main to gh-pr/178/base 2026-12-06 00:44:48 +00:00
github manually merged commit d772beec8e into gh-pr/178/base 2026-12-06 01:29:05 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.