Killflash, Pt.2: Deals with the remaining rarer tree and scene flickering #42

Open
staticman256 wants to merge 1 commit from upstream-pr/42 into main
staticman256 commented 2026-12-04 10:06:06 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by staticman256 on 2026-12-04T10:06:06Z.


Thin lists: lists recorded after a tree culling list wait for it (a row of trees vanishing for one frame)

Human preamble:
The previous PR cleaned up the tree epilepsy simulator. There was another source of flashing caused by what I understand to basically be a race condition in how lists are processed. I tried a global wait, it worked but ended up being a performance disaster. This one ported over from another upstream seems to be both performant and effective, but I really welcome testing feedback for this from others.

AI word salad:
With thin lists on (VICTORY_THIN=1, what play.ps1 and the launcher set), a whole row of
trees could go missing for a single frame every few seconds. It is what was left of the
tree flicker after PR 36. With this change a list the title records after it closed a tree
culling list is not translated before that list, and the row no longer blinks.

Based on main at 01852c0. One commit, 2 files (crates/victory-gpu/src/list/thin.rs,
crates/victory-gpu/src/pipeline.rs). It replaces the earlier form of this PR.

What was wrong

The blink was narrowed down by runs on one PC (RX 9070 XT):

  • With VICTORY_THIN=0 the row was quiet, for 3 to 4 fps less.
  • With VICTORY_THIN_THREADS=1 it was quiet too, at half the frame rate.
  • VICTORY_THIN_URGENT=0 and forced queue waits changed nothing.

So two lists translated at the same time are the cause. Translated in the call, a list the
title recorded after it had closed another one is never translated before that one. With
thin lists it could be, and what the translation of the culling programs' list leaves
behind for the others was then read before its time.

What is changed

  • The tree culling programs are known by the hashes the log names shaders with
    (55679a0547649d0b, 89d08e561897d4e5, f8f50ab85e7b10bb; found by
    kroeeee-eeee/RDNA-proton-line 606ff7d). A recording in which a dispatch, DispatchX or
    ExecuteIndirect is made while one of them is bound is noted when the title closes it.
  • A recording the title begins after that is not begun to be translated before the noted
    one is translated to its end. Every other recording is translated side by side as
    before, and nothing waits for it.
  • How: a counter under one small lock stamps each recording's beginning, and the closing
    of a noted one (Order). In Recording::run, a recording whose first piece is next and
    that began after the earliest noted closing still open is put aside (Order::hold) and
    stays scheduled. When a noted recording is translated to its end, those that may run now
    go back to the front of URGENT (if submitted) or READY (order_finished).
  • Nothing waits for words not recorded yet, so nothing waits for the title: of the noted
    recordings left, the one closed first began before it was closed and can always run.
  • pipeline::has_shader, a unit test for the rule
    (a_list_waits_for_those_closed_before_it_began) and one more line with the per-second
    statistics.

Two other forms that were tried and are not in this PR

  • Every recording waiting for every recording closed before it began (the first form of
    this PR): the row was quiet too and a part of the flickering of shadows on the ground
    went with it, but So-AFK-So/AFK-VI 77a07e1 measured it on an 8-core processor (Windows,
    30 fps cap, frame generation): the thin lists' part of the frame went from 5.6 to
    35.4 ms at 8,000 draws and more, the average from 29.3 to 24.1 fps.
  • Only the culling calls waiting for every stream handed over before them (606ff7d's
    form): the row still blinked on the RX 9070 XT.

Switch

  • VICTORY_THIN_ORDER (on unless 0; 0: lists are translated as their words come, as
    before).

What to look for in a log

a list is not translated before a tree culling list the title closed before it began it (VICTORY_THIN_ORDER=0: as their words come) on=true

Tested

  • RX 9070 XT, Windows 11, diag build merged into a play branch, started from play.ps1
    (FSR 4 performance with frame generation, thin lists on). The build that was run held
    this rule together with the culling calls' own wait (the second form above, which alone
    had left the row blinking): the row did not blink and no slowdown was seen.
  • Clippy for Windows, whole workspace, --all-targets -D warnings: default, diagnostics
    and release, on 01852c0: no warnings.
  • The rule's unit test and a model of the scheduler (5 recording threads, 8 translating
    threads, 2,000 recordings a run) were run for the first form, whose Order code is
    unchanged: the order held and every recording was translated.

Not tested

  • This exact commit (the rule without the culling calls' own wait) was not run in the game
    before this text was written.
  • The frame rate was judged by eye, not measured; processors with 8 cores or fewer.
  • Whether the flickering of shadows on the ground changes with this form.
  • NVIDIA cards, and long sessions.

Claude Fable 5.2

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:issue:5644430131 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T10:06:06Z. --- ## Thin lists: lists recorded after a tree culling list wait for it (a row of trees vanishing for one frame) Human preamble: The previous PR cleaned up the tree epilepsy simulator. There was another source of flashing caused by what I understand to basically be a race condition in how lists are processed. I tried a global wait, it worked but ended up being a performance disaster. This one ported over from another upstream seems to be both performant and effective, but I really welcome testing feedback for this from others. AI word salad: With thin lists on (`VICTORY_THIN=1`, what `play.ps1` and the launcher set), a whole row of trees could go missing for a single frame every few seconds. It is what was left of the tree flicker after PR 36. With this change a list the title records after it closed a tree culling list is not translated before that list, and the row no longer blinks. Based on `main` at 01852c0. One commit, 2 files (`crates/victory-gpu/src/list/thin.rs`, `crates/victory-gpu/src/pipeline.rs`). It replaces the earlier form of this PR. ### What was wrong The blink was narrowed down by runs on one PC (RX 9070 XT): - With `VICTORY_THIN=0` the row was quiet, for 3 to 4 fps less. - With `VICTORY_THIN_THREADS=1` it was quiet too, at half the frame rate. - `VICTORY_THIN_URGENT=0` and forced queue waits changed nothing. So two lists translated at the same time are the cause. Translated in the call, a list the title recorded after it had closed another one is never translated before that one. With thin lists it could be, and what the translation of the culling programs' list leaves behind for the others was then read before its time. ### What is changed - The tree culling programs are known by the hashes the log names shaders with (`55679a0547649d0b`, `89d08e561897d4e5`, `f8f50ab85e7b10bb`; found by kroeeee-eeee/RDNA-proton-line 606ff7d). A recording in which a dispatch, `DispatchX` or `ExecuteIndirect` is made while one of them is bound is noted when the title closes it. - A recording the title begins after that is not begun to be translated before the noted one is translated to its end. Every other recording is translated side by side as before, and nothing waits for it. - How: a counter under one small lock stamps each recording's beginning, and the closing of a noted one (`Order`). In `Recording::run`, a recording whose first piece is next and that began after the earliest noted closing still open is put aside (`Order::hold`) and stays scheduled. When a noted recording is translated to its end, those that may run now go back to the front of `URGENT` (if submitted) or `READY` (`order_finished`). - Nothing waits for words not recorded yet, so nothing waits for the title: of the noted recordings left, the one closed first began before it was closed and can always run. - `pipeline::has_shader`, a unit test for the rule (`a_list_waits_for_those_closed_before_it_began`) and one more line with the per-second statistics. ### Two other forms that were tried and are not in this PR - Every recording waiting for every recording closed before it began (the first form of this PR): the row was quiet too and a part of the flickering of shadows on the ground went with it, but So-AFK-So/AFK-VI 77a07e1 measured it on an 8-core processor (Windows, 30 fps cap, frame generation): the thin lists' part of the frame went from 5.6 to 35.4 ms at 8,000 draws and more, the average from 29.3 to 24.1 fps. - Only the culling calls waiting for every stream handed over before them (606ff7d's form): the row still blinked on the RX 9070 XT. ### Switch - `VICTORY_THIN_ORDER` (on unless `0`; `0`: lists are translated as their words come, as before). ### What to look for in a log ``` a list is not translated before a tree culling list the title closed before it began it (VICTORY_THIN_ORDER=0: as their words come) on=true ``` ### Tested - RX 9070 XT, Windows 11, diag build merged into a play branch, started from `play.ps1` (FSR 4 performance with frame generation, thin lists on). The build that was run held this rule together with the culling calls' own wait (the second form above, which alone had left the row blinking): the row did not blink and no slowdown was seen. - Clippy for Windows, whole workspace, `--all-targets -D warnings`: default, diagnostics and release, on 01852c0: no warnings. - The rule's unit test and a model of the scheduler (5 recording threads, 8 translating threads, 2,000 recordings a run) were run for the first form, whose `Order` code is unchanged: the order held and every recording was translated. ### Not tested - This exact commit (the rule without the culling calls' own wait) was not run in the game before this text was written. - The frame rate was judged by eye, not measured; processors with 8 cores or fewer. - Whether the flickering of shadows on the ground changes with this form. - NVIDIA cards, and long sessions. --- Claude Fable 5.2
Ace-Zer0x77 commented 2026-12-04 11:20:11 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by Ace-Zer0x77 on 2026-12-04T11:20:11Z.


Tested on previctory-v0.5.0-next (81bafbf, based on 249f2aa) with an RX 9070 XT across city, dense tree-lined road, and bridge scenes (Series X @ 1440p and Series S @ 1080p):

  • Result: Trees and surrounding foliage stayed steady without noticeable flicker once output resolution was properly matched; Late lists stayed low (~2.1) on the properly configured 1080p Series S / 30 FPS cap run.
  • Note: When I accidentally misconfigured output/upscaler scaling to 640×360 → 1280×720 during one test, Late lists jumped back up (~182.4), so that spike looked tied to the scaling mismatch rather than this PR.
<!-- greyfinch-sync:ReTerryDavis/ReVIctory:comment:7409955889 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42#issuecomment-7409955889). Originally posted by [Ace-Zer0x77](https://github.com/Ace-Zer0x77) on 2026-12-04T11:20:11Z. --- Tested on `previctory-v0.5.0-next` (`81bafbf`, based on `249f2aa`) with an **RX 9070 XT** across city, dense tree-lined road, and bridge scenes (Series X @ 1440p and Series S @ 1080p): * **Result:** Trees and surrounding foliage stayed steady without noticeable flicker once output resolution was properly matched; `Late lists` stayed low (~2.1) on the properly configured 1080p Series S / 30 FPS cap run. * **Note:** When I accidentally misconfigured output/upscaler scaling to `640×360 → 1280×720` during one test, `Late lists` jumped back up (~182.4), so that spike looked tied to the scaling mismatch rather than this PR.
staticman256 commented 2026-12-04 14:47:49 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by staticman256 on 2026-12-04T14:47:49Z.


According to my own testing and the PRs above this may be slowing perfomance. Suggest holding off while I investigate.

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:comment:7414872460 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42#issuecomment-7414872460). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T14:47:49Z. --- According to my own testing and the PRs above this may be slowing perfomance. Suggest holding off while I investigate.
staticman256 commented 2026-12-04 15:41:04 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by staticman256 on 2026-12-04T15:41:04Z.


The old commit killed performance by half and was overly broad. The nice people who scanned my PR and put references to it in their AI blobs pointed me at a smaller fix. @thiagohille if you want to test this branch you're much better off testing this one. Once I'm done with my own tests I'll make a minimal version of this commit, squash the tree and update the PR OP.

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:comment:7416237444 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42#issuecomment-7416237444). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T15:41:04Z. --- The old commit killed performance by half and was overly broad. The nice people who scanned my PR and put references to it in their AI blobs pointed me at a smaller fix. @thiagohille if you want to test this branch you're much better off testing this one. Once I'm done with my own tests I'll make a minimal version of this commit, squash the tree and update the PR OP.
staticman256 commented 2026-12-04 16:19:41 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by staticman256 on 2026-12-04T16:19:41Z.


@Ace-Zer0x77 @thiagohille Pushed a lightweight version of the fix graciously taken from another upstream. I really would love a second set of eyes on this though. I don't really have a benchmark set up to have repeatable testing runs to measure performance impact so any data point is very welcome.

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:comment:7417240821 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42#issuecomment-7417240821). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T16:19:41Z. --- @Ace-Zer0x77 @thiagohille Pushed a lightweight version of the fix graciously taken from another upstream. I really would love a second set of eyes on this though. I don't really have a benchmark set up to have repeatable testing runs to measure performance impact so any data point is very welcome.
thiagohille commented 2026-12-04 16:36:30 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by thiagohille on 2026-12-04T16:36:30Z.


@staticman256 Yes, I saw an impact of about 10 fps with the initial commit #42. I’m going to do another run right now—driving around on the roads—and I’ll provide you with full feedback, along with my hardware specs, shortly.

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:comment:7417682856 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/42#issuecomment-7417682856). Originally posted by [thiagohille](https://github.com/thiagohille) on 2026-12-04T16:36:30Z. --- @staticman256 Yes, I saw an impact of about 10 fps with the initial commit #42. I’m going to do another run right now—driving around on the roads—and I’ll provide you with full feedback, along with my hardware specs, shortly.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/42:upstream-pr/42'
git switch 'upstream-pr/42'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'main'
git merge --squash 'upstream-pr/42'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'main'
git merge 'upstream-pr/42'
git push origin 'main'
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
ReTerryDavis/ReVIctory!42
No description provided.