draw: clamp only the ray-traced shadow dispatches alone (fixes 3–4 frame shadow flicker) #445

Open
github-bot wants to merge 3 commits from github-bot/gh-445 into main AGit
Owner

@⁠Spel0 on GitHub · 2026-12-04 06:03 UTC · original
Spel0:fix/vegetation-flicker → main · +176 −18 · 5 files · 3 commits · draft

What this fixes

Tree and vegetation shadows could flicker for a single frame every 3–4 frames, most visibly in the background; looking directly at them made fewer of them flicker. The same symptom is tracked in #287 as background areas behind foreground objects dropping to near-black for one frame every 3–4 frames.

The existing workaround, VICTORY_IN_PLACE_ALONE=dispatch, stops it, but it clamps every in-place indirect dispatch alone and costs about 30% of the frame rate on this GPU. This PR keeps that fix only for the ray-traced shadow and trace dispatches that actually show the flicker, so the cost is effectively gone.

What was wrong

A batched indirect clamp is recorded where the batch opens, before the commands between it and the execution that reads the record. That is fine for a host copy, whose bytes are the title's at submission, but an in-place argument buffer is read from title memory. A culling or shadow pass recorded after the batch then writes the records the execution should read, and the execution gets an earlier frame's record or none. With the title's triple-buffered argument buffers this repeats every third or fourth frame.

That is the mechanism described in upstream #121 and #204. Clamping every in-place dispatch alone fixes it, but the title issues thousands of in-place indirect executions a frame.

VICTORY_IN_PLACE_ALONE=changed was also tried: it reopens the clamp when a shader is declared to write the argument copy. It did not fix the shadow flicker, because the records of the ray-traced shadow/trace dispatches are not the copies whose writes that path tracks.

Change

  • Add VICTORY_IN_PLACE_ALONE=shadow, now the default. It clamps only the title's ray-traced shadow and trace dispatches alone, by shader hash:
    • 0873f80dd84a3c5c
    • e8c962358d862e3f
    • afeea48bbb9913ad
    • a1b20bc47e3c9597
    • 17829ac71aab4e8d
  • Everything else keeps batching. The selected dispatches run only every third or fourth frame, so clamping them alone adds very little work.
  • Keep the other modes available: changed, dispatch, all, and 0 (batch everything).
  • The hashes are for title build 1.0.2.1. On another build, VICTORY_IN_PLACE_ALONE=dispatch remains the full fallback.

Files

  • crates/victory-gpu/src/draw.rs — mode selection, the RT trace hash set, and the batch/write tracking used by changed
  • crates/victory-gpu/src/indirect.rs — pass the write count and wait through the batch open
  • crates/victory-gpu/src/shadow.rs — shader-write counter on copies
  • run.conf.default, docs/SETTINGS.md — the setting and its modes

Benchmark

RX 6800 XT, Ryzen 5 7600, 32 GB RAM, CachyOS, patched RADV / vkd3d-proton, Series X profile. Built-in VICTORY_BENCH=rt preset: 3840×2160 output, FSR 4 Quality, ray tracing on, frame generation off. 3-minute runs, first 60 s excluded, 120 s measured per run.

VICTORY_IN_PLACE_ALONE Average FPS 1% low Frame time Result
0 16.7 7.9 60.0 ms flickers
changed 15.4 7.0 65.2 ms still flickers
dispatch 11.7 5.7 85.3 ms fixed, costly
all 9.7 4.7 102.8 ms fixed, costliest
shadow 17.5 8.7 ~57 ms fixed

shadow is within run-to-run variance of the batched baseline, so the narrowed clamp costs effectively nothing.

Tested

  • In game, same spot and save, VICTORY_IN_PLACE_ALONE=shadow: the 3–4 frame shadow flicker is gone.
  • VICTORY_IN_PLACE_ALONE=dispatch still fixes it and remains the fallback for other title builds.
  • New unit test in_place_dispatches_are_clamped_alone_unless_asked_otherwise.
  • cargo check -p victory-gpu --lib on the Windows target.

Not tested here: other GPUs, other saves, a long session, or a title build other than 1.0.2.1.

Credits

The in-place indirect batching bug and the “clamp every dispatch alone” fix are from HeroOfOlympus: upstream PR #121 and PR #204, neither merged upstream. The downstream fork by t-jonesy carried #121 and exposed it as VICTORY_IN_PLACE_ALONE (6c1efe6), with the first A/B measurements. The five ray-traced shadow/trace hashes were identified from the hash list in LooperSalty's comment on Marvisak/VIctory PR #1198 and cross-checked against the in-place dispatch profile of title 1.0.2.1. #287, by avishai0258, is the report that described this exact 3–4 frame symptom.


Written with AI assistance (DeepSeek V4.1 Flash via OpenCode).

**@⁠Spel0** on GitHub · 2026-12-04 06:03 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445) `Spel0:fix/vegetation-flicker` → `main` · +176 −18 · 5 files · 3 commits · draft ## What this fixes Tree and vegetation shadows could flicker for a single frame every 3–4 frames, most visibly in the background; looking directly at them made fewer of them flicker. The same symptom is tracked in #287 as background areas behind foreground objects dropping to near-black for one frame every 3–4 frames. The existing workaround, `VICTORY_IN_PLACE_ALONE=dispatch`, stops it, but it clamps **every** in-place indirect dispatch alone and costs about 30% of the frame rate on this GPU. This PR keeps that fix only for the ray-traced shadow and trace dispatches that actually show the flicker, so the cost is effectively gone. ## What was wrong A batched indirect clamp is recorded where the batch opens, before the commands between it and the execution that reads the record. That is fine for a host copy, whose bytes are the title's at submission, but an in-place argument buffer is read from title memory. A culling or shadow pass recorded after the batch then writes the records the execution should read, and the execution gets an earlier frame's record or none. With the title's triple-buffered argument buffers this repeats every third or fourth frame. That is the mechanism described in upstream #121 and #204. Clamping every in-place dispatch alone fixes it, but the title issues thousands of in-place indirect executions a frame. `VICTORY_IN_PLACE_ALONE=changed` was also tried: it reopens the clamp when a shader is declared to write the argument copy. It did not fix the shadow flicker, because the records of the ray-traced shadow/trace dispatches are not the copies whose writes that path tracks. ## Change - Add `VICTORY_IN_PLACE_ALONE=shadow`, now the default. It clamps **only the title's ray-traced shadow and trace dispatches** alone, by shader hash: - `0873f80dd84a3c5c` - `e8c962358d862e3f` - `afeea48bbb9913ad` - `a1b20bc47e3c9597` - `17829ac71aab4e8d` - Everything else keeps batching. The selected dispatches run only every third or fourth frame, so clamping them alone adds very little work. - Keep the other modes available: `changed`, `dispatch`, `all`, and `0` (batch everything). - The hashes are for title build **1.0.2.1**. On another build, `VICTORY_IN_PLACE_ALONE=dispatch` remains the full fallback. ## Files - `crates/victory-gpu/src/draw.rs` — mode selection, the RT trace hash set, and the batch/write tracking used by `changed` - `crates/victory-gpu/src/indirect.rs` — pass the write count and wait through the batch open - `crates/victory-gpu/src/shadow.rs` — shader-write counter on copies - `run.conf.default`, `docs/SETTINGS.md` — the setting and its modes ## Benchmark RX 6800 XT, Ryzen 5 7600, 32 GB RAM, CachyOS, patched RADV / vkd3d-proton, Series X profile. Built-in `VICTORY_BENCH=rt` preset: 3840×2160 output, FSR 4 Quality, ray tracing on, frame generation off. 3-minute runs, first 60 s excluded, 120 s measured per run. | `VICTORY_IN_PLACE_ALONE` | Average FPS | 1% low | Frame time | Result | |---|---:|---:|---:|---| | `0` | 16.7 | 7.9 | 60.0 ms | flickers | | `changed` | 15.4 | 7.0 | 65.2 ms | still flickers | | `dispatch` | 11.7 | 5.7 | 85.3 ms | fixed, costly | | `all` | 9.7 | 4.7 | 102.8 ms | fixed, costliest | | **`shadow`** | **17.5** | **8.7** | **~57 ms** | **fixed** | `shadow` is within run-to-run variance of the batched baseline, so the narrowed clamp costs effectively nothing. ## Tested - In game, same spot and save, `VICTORY_IN_PLACE_ALONE=shadow`: the 3–4 frame shadow flicker is gone. - `VICTORY_IN_PLACE_ALONE=dispatch` still fixes it and remains the fallback for other title builds. - New unit test `in_place_dispatches_are_clamped_alone_unless_asked_otherwise`. - `cargo check -p victory-gpu --lib` on the Windows target. Not tested here: other GPUs, other saves, a long session, or a title build other than 1.0.2.1. ## Credits The in-place indirect batching bug and the “clamp every dispatch alone” fix are from **HeroOfOlympus**: upstream PR #121 and PR #204, neither merged upstream. The downstream fork by **t-jonesy** carried #121 and exposed it as `VICTORY_IN_PLACE_ALONE` (`6c1efe6`), with the first A/B measurements. The five ray-traced shadow/trace hashes were identified from the hash list in **LooperSalty**'s comment on Marvisak/VIctory PR #1198 and cross-checked against the in-place dispatch profile of title 1.0.2.1. #287, by **avishai0258**, is the report that described this exact 3–4 frame symptom. --- Written with AI assistance (DeepSeek V4.1 Flash via OpenCode).
A batch's clamp is recorded where the batch opens, before the commands between it and the execution that reads the record. An in-place argument buffer is read from title memory, so a culling or sun-shadow pass recorded after the batch writes the record the execution should read, and the execution gets an earlier frame's record or none. With triple-buffered argument buffers this repeats every third or fourth frame: the tiled RT sun-shadow dispatches made tree shadows flicker (issue #287).

Clamp in-place indirect dispatches alone, right before they run, after a wait for every earlier shader write. Draws and mesh dispatches keep batching, and VICTORY_IN_PLACE_ALONE=all extends the clamp to them or =0 restores batching.
Clamping every in-place dispatch alone fixed the 3-4 frame shadow flicker (issue #287) but cost about 30% of the frame rate: the title issues thousands of them a frame. Keep batching by default and reopen the clamp only when a shader wrote the argument copy since the clamp was recorded, with the wait that fix needs.

Shadow copies now carry a shader-write count. A batch remembers the counts of its sources; a record from a source written since is clamped in a new batch after the write. VICTORY_IN_PLACE_ALONE=changed is the default; dispatch and all keep the earlier alone modes, 0 batches everything.

RX 6800/6900 XT, 4K FSR 4 Quality, RT on, 120 s measured: 16.7 fps batched, 15.4 fps changed, 11.7 fps every dispatch alone, 9.7 fps all alone.
VICTORY_IN_PLACE_ALONE=changed did not stop the 3-4 frame shadow flicker: the records of the title's ray-traced shadow and trace dispatches are not the copies whose shader writes the batch tracks. Clamp those dispatches alone instead, by shader hash: they run only every third or fourth frame, so the cost is negligible.

The hashes are the title 1.0.2.1's ray-traced shadow and trace passes. dispatch, all, changed and 0 remain available.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 06:07:40 +00:00
github-bot force-pushed github-bot/gh-445 from 741f768081 to d64aa6bcbf 2026-12-04 06:13:06 +00:00 Compare
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-04 06:36 UTC · original

Tested d64aa6b natively on Windows 11 (MSVC) with real D3D12, one NVIDIA desktop card plus WARP. No game run, only the crate tests and one local device test.

The new in_place_dispatches_are_clamped_alone_unless_asked_otherwise passes 10/10. Full cargo test -p victory-gpu --lib gives the same result as current main, which is also the PR's base (340 passed, the same failures on both sides). Those failures are the two indirect::tests::host_list_* tests, two pipeline::host library loads and a flaky watch test, all failing on main here too. The PR only edits the open_batch call in host_list_batches, which passes. clippy shows no new warnings.

I also ran a local device test (not pushed, diagnostics build with VICTORY_D3D12_DEBUG=1). It drives bound and open_batch directly, not execute_indirect with the mode switch. One dispatch record holds 5 groups, a compute shader rewrites it to 9, and the test counts the groups that actually run. 10 runs per adapter, same result every time.

order NVIDIA WARP
batch opened, barrier, write, execute (old batched path) 5 5
write, then bound (the alone path the five hashes now take) 9 9
write, then a batch opened with wait (the changed path) 9 9

So the batched clamp reads the record as it was where the batch opened, and the alone clamp reads the new one, which is the mechanism in the description. With no barrier after the write, open_batch gave 9 with or without wait on both adapters, so the extra wait made no visible difference in this small case. The debug layer reported nothing.

Some notes from reading it

  • In the default mode only dispatches whose compute shader hash is one of the five change. Everything else goes through batched(.., false, false) and open_batch(.., false), which is main's path. An alone dispatch also drops the open batch, so the next batched execution opens a new one, which looks harmless.
  • The hash is the first 16 hex of the BLAKE3 of the title's shader container (pipeline.rs:123), so translator changes or host recompiles won't affect it, only a title update. If the shaders change the fix just stops with no sign. A once! or a count in the in-place line when one of the five is hit would make that visible. I couldn't check that the five values are in this repo's hash form beyond the PR's own test, since nothing else in the tree mentions them.
  • Only single-record dispatches without a count buffer get batched, so the change matters only if the five take that path. I can't check that without the game.
  • alone_mode sends any unknown value to shadow. The startup log says dispatches for mode 1 while the accepted value is dispatch, so copying the word from the log silently gives shadow. Accepting both or warning on unknown values would help.
  • This repo's main has no VICTORY_IN_PLACE_ALONE yet, all modes arrive with this PR. The description reads as if dispatch already existed here.
  • Small formatting slip near the end of execute_indirect, ); unsafe { on one line.

Fine by me for the default path, I'd just add some log when the hashes are hit.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-04 06:36 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7403643710) Tested d64aa6b natively on Windows 11 (MSVC) with real D3D12, one NVIDIA desktop card plus WARP. No game run, only the crate tests and one local device test. The new `in_place_dispatches_are_clamped_alone_unless_asked_otherwise` passes 10/10. Full `cargo test -p victory-gpu --lib` gives the same result as current main, which is also the PR's base (340 passed, the same failures on both sides). Those failures are the two `indirect::tests::host_list_*` tests, two `pipeline::host` library loads and a flaky watch test, all failing on main here too. The PR only edits the `open_batch` call in `host_list_batches`, which passes. clippy shows no new warnings. I also ran a local device test (not pushed, diagnostics build with `VICTORY_D3D12_DEBUG=1`). It drives `bound` and `open_batch` directly, not `execute_indirect` with the mode switch. One dispatch record holds 5 groups, a compute shader rewrites it to 9, and the test counts the groups that actually run. 10 runs per adapter, same result every time. | order | NVIDIA | WARP | |---|---:|---:| | batch opened, barrier, write, execute (old batched path) | 5 | 5 | | write, then `bound` (the alone path the five hashes now take) | 9 | 9 | | write, then a batch opened with `wait` (the `changed` path) | 9 | 9 | So the batched clamp reads the record as it was where the batch opened, and the alone clamp reads the new one, which is the mechanism in the description. With no barrier after the write, `open_batch` gave 9 with or without `wait` on both adapters, so the extra wait made no visible difference in this small case. The debug layer reported nothing. Some notes from reading it - In the default mode only dispatches whose compute shader hash is one of the five change. Everything else goes through `batched(.., false, false)` and `open_batch(.., false)`, which is main's path. An alone dispatch also drops the open batch, so the next batched execution opens a new one, which looks harmless. - The hash is the first 16 hex of the BLAKE3 of the title's shader container (`pipeline.rs:123`), so translator changes or host recompiles won't affect it, only a title update. If the shaders change the fix just stops with no sign. A `once!` or a count in the in-place line when one of the five is hit would make that visible. I couldn't check that the five values are in this repo's hash form beyond the PR's own test, since nothing else in the tree mentions them. - Only single-record dispatches without a count buffer get batched, so the change matters only if the five take that path. I can't check that without the game. - `alone_mode` sends any unknown value to `shadow`. The startup log says `dispatches` for mode 1 while the accepted value is `dispatch`, so copying the word from the log silently gives `shadow`. Accepting both or warning on unknown values would help. - This repo's main has no `VICTORY_IN_PLACE_ALONE` yet, all modes arrive with this PR. The description reads as if `dispatch` already existed here. - Small formatting slip near the end of `execute_indirect`, `); unsafe {` on one line. Fine by me for the default path, I'd just add some log when the hashes are hit. AI-assisted: yes
Author
Owner

@⁠fsrajner on GitHub · 2026-12-04 08:14 UTC · original

Tested on top of main together with the other PRs listed below. The new default (VICTORY_IN_PLACE_ALONE=shadow) cost nothing measurable for us: 46 vs 47 ms/frame. That is good news compared with the ~30% dispatch cost. I did not check the flicker itself, since these runs are headless.

Setup: RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, RADV from this repo's setup.sh. Series X, 3840x2160 output, FSR 4 Quality (4.1.2), RT at defaults, headless gamescope. Same save (the intro); the game stops 120 s after the first press. The figures come from the 5 s stats: frame windows after loading. 2 runs per variant; main = 0fd7614. The PR build is main + #382 + #392 + #393 + #408 + #445 + #369 together. #398 was left out because it conflicts with #369 in the residency planning. The #369 merge conflicted only with local counters.

variant ms/frame (runs) 5 s windows > 40 ms worst 5% worst window long frames (longest)
main 47 (48, 45) 86.5% 59.3 ms 62.8 ms 1184 (275 ms)
PR build, defaults 46 (46, 46) 85.7% 61.3 ms 82.9 ms 1176 (254 ms)
PR build + VICTORY_TEXTURE_BARRIERS=1 46 (46, 46) 88.9% 59.0 ms 61.5 ms 1137 (172 ms)
PR build + VICTORY_CARD_KEPT_MB=9216 45 (44, 46) 83.8% 63.4 ms 65.1 ms 1171 (201 ms)

The first run of main and of the PR build each began by re-preparing shaders after a translator change. That is likely where the 48 ms run and the 82.9 ms worst window come from. Otherwise the spread between runs is about ±1 ms/frame, so all of these are within noise. In this scene the card is the limit (about 21-24 ms of GPU wait per frame).

**@⁠fsrajner** on GitHub · 2026-12-04 08:14 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7405690674) Tested on top of main together with the other PRs listed below. The new default (`VICTORY_IN_PLACE_ALONE=shadow`) cost nothing measurable for us: 46 vs 47 ms/frame. That is good news compared with the ~30% `dispatch` cost. I did not check the flicker itself, since these runs are headless. **Setup:** RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, RADV from this repo's `setup.sh`. Series X, 3840x2160 output, FSR 4 Quality (4.1.2), RT at defaults, headless gamescope. Same save (the intro); the game stops 120 s after the first press. The figures come from the 5 s `stats: frame` windows after loading. 2 runs per variant; main = 0fd7614. The PR build is main + #382 + #392 + #393 + #408 + #445 + #369 together. #398 was left out because it conflicts with #369 in the residency planning. The #369 merge conflicted only with local counters. | variant | ms/frame (runs) | 5 s windows > 40 ms | worst 5% | worst window | long frames (longest) | |---|---|---|---|---|---| | main | 47 (48, 45) | 86.5% | 59.3 ms | 62.8 ms | 1184 (275 ms) | | PR build, defaults | 46 (46, 46) | 85.7% | 61.3 ms | 82.9 ms | 1176 (254 ms) | | PR build + `VICTORY_TEXTURE_BARRIERS=1` | 46 (46, 46) | 88.9% | 59.0 ms | 61.5 ms | 1137 (172 ms) | | PR build + `VICTORY_CARD_KEPT_MB=9216` | 45 (44, 46) | 83.8% | 63.4 ms | 65.1 ms | 1171 (201 ms) | The first run of main and of the PR build each began by re-preparing shaders after a translator change. That is likely where the 48 ms run and the 82.9 ms worst window come from. Otherwise the spread between runs is about ±1 ms/frame, so all of these are within noise. In this scene the card is the limit (about 21-24 ms of GPU wait per frame).
Author
Owner

@⁠Spel0 on GitHub · 2026-12-04 09:13 UTC · original

The five-hash shadow set did not fully fix it: the same 3–4 frame flicker is still visible in game, while VICTORY_IN_PLACE_ALONE=dispatch still removes it.

The five hashes covered only the distant ray-traced shadow traces and one SR raytracing program. Mapping shaders.rpf with shader-info --verbose and intersecting it with the in-place dispatch profile shows that title 1.0.2.1 has 28 shadow/denoise compute programs running as in-place indirect dispatches. The missing ones include the normal tree-shadow path:

  • CS_ShadowRenderTiledCascades* and CS_ShadowRenderTiledMisc*
  • CS_DenoiseShadowMaskLDSPacked
  • CS_TraceShadowRays_Checkerboard
  • CS_IrradianceCache_ShadowTrace_WithFar
  • the paraboloid-shadow meshlet culls

Those are about 4% of the in-place dispatches, so clamping all of them alone should stay far closer to the batched baseline than dispatch.

I have expanded the set to all 28 locally and it passes the Windows-target check and the unit test, but it is not pushed to this PR yet. I will update the branch and the benchmark once it has been rebuilt and tested in game. Marking the PR draft again until then.

**@⁠Spel0** on GitHub · 2026-12-04 09:13 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7407024031) The five-hash `shadow` set did **not** fully fix it: the same 3–4 frame flicker is still visible in game, while `VICTORY_IN_PLACE_ALONE=dispatch` still removes it. The five hashes covered only the distant ray-traced shadow traces and one SR raytracing program. Mapping `shaders.rpf` with `shader-info --verbose` and intersecting it with the in-place dispatch profile shows that title 1.0.2.1 has **28** shadow/denoise compute programs running as in-place indirect dispatches. The missing ones include the normal tree-shadow path: - `CS_ShadowRenderTiledCascades*` and `CS_ShadowRenderTiledMisc*` - `CS_DenoiseShadowMaskLDSPacked` - `CS_TraceShadowRays_Checkerboard` - `CS_IrradianceCache_ShadowTrace_WithFar` - the paraboloid-shadow meshlet culls Those are about 4% of the in-place dispatches, so clamping all of them alone should stay far closer to the batched baseline than `dispatch`. I have expanded the set to all 28 locally and it passes the Windows-target check and the unit test, but it is **not pushed to this PR yet**. I will update the branch and the benchmark once it has been rebuilt and tested in game. Marking the PR draft again until then.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 10:58 UTC · original

The diagnosis is convincing and the A/B table is exactly the kind of evidence a reviewer needs — shadow at 17.5 fps vs dispatch at 11.7 is a clear win, and the mechanism (a clamp recorded at batch open reading records a later pass has rewritten) is explained well enough to check against the code.

One organisational suggestion, because the three commits here are really three different decisions and only one of them is a mechanism:

  1. The write tracking (shadow.rs, indirect.rs, and the changed reopen path in draw.rs). It is neutral for everyone who does not set the variable, and it is the part that needs the most careful reading.
  2. shadow as a new mode, opt-in. New behaviour behind a new value; a reviewer can accept the mechanism and still want to see this land separately.
  3. The default flip (VICTORY_IN_PLACE_ALONE=shadow in run.conf.default plus the docs row). This changes behaviour for every user who never set the variable, and it rests on five shader hashes that only hold for title build 1.0.2.1. That is a policy decision, not a mechanism, and it deserves its own line in the history — and its own revert if 1.0.2.2 shifts the hashes.

Two questions that would make the result hold up on other builds:

  • Can the five dispatches be recognised structurally rather than by hash — an RT shadow/trace pipeline flag, a dispatch shape, a stage — so the list does not have to be re-derived per title build?
  • Is there a targeted version of the same fix at the batch-open site, e.g. record which writes happened between open and execution and reopen only those, instead of an allowlist of dispatches?

On this project specifically: it merged roughly twenty PRs in a day last week, with ~85 open, and most of them touch draw.rs/indirect.rs. A PR that mixes mechanism, a new mode and a default is where rebase churn and review fatigue come from — three small PRs would each be mergeable in hours and each would keep its own rationale. The idea is good; splitting it is what makes it land.

**@⁠Luxuride** on GitHub · 2026-12-04 10:58 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7409442568) The diagnosis is convincing and the A/B table is exactly the kind of evidence a reviewer needs — `shadow` at 17.5 fps vs `dispatch` at 11.7 is a clear win, and the mechanism (a clamp recorded at batch open reading records a later pass has rewritten) is explained well enough to check against the code. One organisational suggestion, because the three commits here are really three different decisions and only one of them is a mechanism: 1. **The write tracking** (`shadow.rs`, `indirect.rs`, and the `changed` reopen path in `draw.rs`). It is neutral for everyone who does not set the variable, and it is the part that needs the most careful reading. 2. **`shadow` as a new mode**, opt-in. New behaviour behind a new value; a reviewer can accept the mechanism and still want to see this land separately. 3. **The default flip** (`VICTORY_IN_PLACE_ALONE=shadow` in `run.conf.default` plus the docs row). This changes behaviour for every user who never set the variable, and it rests on five shader hashes that only hold for title build 1.0.2.1. That is a policy decision, not a mechanism, and it deserves its own line in the history — and its own revert if 1.0.2.2 shifts the hashes. Two questions that would make the result hold up on other builds: - Can the five dispatches be recognised structurally rather than by hash — an RT shadow/trace pipeline flag, a dispatch shape, a stage — so the list does not have to be re-derived per title build? - Is there a targeted version of the same fix at the batch-open site, e.g. record which writes happened between open and execution and reopen only those, instead of an allowlist of dispatches? On this project specifically: it merged roughly twenty PRs in a day last week, with ~85 open, and most of them touch `draw.rs`/`indirect.rs`. A PR that mixes mechanism, a new mode and a default is where rebase churn and review fatigue come from — three small PRs would each be mergeable in hours and each would keep its own rationale. The idea is good; splitting it is what makes it land.
Author
Owner

@⁠joaowtrdev on GitHub · 2026-12-04 18:27 UTC · original

Tried d64aa6b on a Ryzen 7 5700X3D with an RX 9070 XT. The build was main 0fd7614 with #354, #364, #376, #382 and #385 merged in, run at 4K output with FSR 4 Performance, RT on, ML frame generation (mode 4) and VICTORY_PARTS_ONE_CALL=1. I did one run of each mode back to back from the same save: 1 min standing, then 5 to 6 min driving through the city. The log confirms the mode in each run (kinds="none" with VICTORY_IN_PLACE_ALONE=0, kinds="shadow" by default).

There was no cost here:

driving 0 shadow
real fps, median 20.3 20.4
1% low 7.0 7.3
long frame ≥ 100 ms, per min 52.2 45.2
long frame ≥ 250 ms, per min 1.17 0.38
gpu_wait_ms, mean 28.6 26.7

These differences are within my usual run-to-run noise. Neither run lost the device.

That said, I didn't see the tree shadows flicker in either run, 0 included. So on this route and at that time of day I couldn't reproduce #287, and this doesn't confirm the fix. It only shows that the default costs nothing here. I'm keeping shadow on and will report if the flicker shows up with it.

**@⁠joaowtrdev** on GitHub · 2026-12-04 18:27 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7420432101) Tried `d64aa6b` on a Ryzen 7 5700X3D with an RX 9070 XT. The build was main `0fd7614` with #354, #364, #376, #382 and #385 merged in, run at 4K output with FSR 4 Performance, RT on, ML frame generation (mode 4) and `VICTORY_PARTS_ONE_CALL=1`. I did one run of each mode back to back from the same save: 1 min standing, then 5 to 6 min driving through the city. The log confirms the mode in each run (`kinds="none"` with `VICTORY_IN_PLACE_ALONE=0`, `kinds="shadow"` by default). There was no cost here: | driving | `0` | `shadow` | |---|---|---| | real fps, median | 20.3 | 20.4 | | 1% low | 7.0 | 7.3 | | `long frame` ≥ 100 ms, per min | 52.2 | 45.2 | | `long frame` ≥ 250 ms, per min | 1.17 | 0.38 | | `gpu_wait_ms`, mean | 28.6 | 26.7 | These differences are within my usual run-to-run noise. Neither run lost the device. That said, I didn't see the tree shadows flicker in either run, `0` included. So on this route and at that time of day I couldn't reproduce #287, and this doesn't confirm the fix. It only shows that the default costs nothing here. I'm keeping `shadow` on and will report if the flicker shows up with it.
Author
Owner

@⁠MikeSouza1 on GitHub · 2026-12-04 18:57 UTC · original

Tested pr-445 on Linux (Fedora, Ryzen 5 5600G, 16 GB RAM, RX 6750 XT 12 GB RADV NAVI22), CONSOLE=series-s, VICTORY_OUTPUT=1920x1080, VICTORY_FSR_HOST=1, VICTORY_BVH_BUILDER=1, VICTORY_PARTS_ONE_CALL=1 (tested in a local build combining main + #384/#385/#481):

  • VICTORY_IN_PLACE_ALONE=shadow (default): completely stopped the tree/vegetation shadow flicker both standing and driving (Ammu-Nation ↔ Jason's house), even with VICTORY_LATE_MOST=384 and 512 (where tree shadows flickered continuously before). No noticeable frame-time regression (19.0 fps median / 52.6 ms frame time at 384).
  • VICTORY_IN_PLACE_ALONE=changed: tree shadow flicker immediately came back while driving, confirming shadow as the right default.

Great fix!

**@⁠MikeSouza1** on GitHub · 2026-12-04 18:57 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7421171110) Tested `pr-445` on Linux (Fedora, Ryzen 5 5600G, 16 GB RAM, RX 6750 XT 12 GB RADV NAVI22), `CONSOLE=series-s`, `VICTORY_OUTPUT=1920x1080`, `VICTORY_FSR_HOST=1`, `VICTORY_BVH_BUILDER=1`, `VICTORY_PARTS_ONE_CALL=1` (tested in a local build combining `main` + #384/#385/#481): - **`VICTORY_IN_PLACE_ALONE=shadow` (default):** completely stopped the tree/vegetation shadow flicker both standing and driving (Ammu-Nation ↔ Jason's house), even with `VICTORY_LATE_MOST=384` and `512` (where tree shadows flickered continuously before). No noticeable frame-time regression (`19.0 fps` median / `52.6 ms` frame time at `384`). - **`VICTORY_IN_PLACE_ALONE=changed`:** tree shadow flicker immediately came back while driving, confirming `shadow` as the right default. Great fix!
Author
Owner

@⁠Xough on GitHub · 2026-12-04 21:02 UTC · original

Tested this PR on an RX 6700 XT (12 GB, RDNA 2), Ryzen 9 7900X, CachyOS, ray tracing off, preset high, FSR 4.1 performance, no frame generation, 1920x1080 output. Built-in benchmark (VICTORY_BENCH=nort, 3 min each, first 60 s excluded), merged on top of main at 2382b4c.

Build / mode avg fps 1% low
main, before this PR (two runs) 31.3 / 31.4 18.1
this PR, default (shadow), two runs 31.1 / 30.8 18.2 / 17.8
this PR, VICTORY_IN_PLACE_ALONE=dispatch 26.1 15.4

So on this card the default mode costs nothing against main, and the full dispatch fallback costs about 5 fps (-16%), which matches the cost described above.

Not verified: I only measured frame rates, not whether the 3-4 frame shadow flicker is gone on this setup. The shader hashes are for the 1.0.2.1 build.

**@⁠Xough** on GitHub · 2026-12-04 21:02 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/445#issuecomment-7424142211) Tested this PR on an RX 6700 XT (12 GB, RDNA 2), Ryzen 9 7900X, CachyOS, ray tracing off, preset high, FSR 4.1 performance, no frame generation, 1920x1080 output. Built-in benchmark (`VICTORY_BENCH=nort`, 3 min each, first 60 s excluded), merged on top of main at 2382b4c. | Build / mode | avg fps | 1% low | |---|---|---| | main, before this PR (two runs) | 31.3 / 31.4 | 18.1 | | this PR, default (`shadow`), two runs | 31.1 / 30.8 | 18.2 / 17.8 | | this PR, `VICTORY_IN_PLACE_ALONE=dispatch` | 26.1 | 15.4 | So on this card the default mode costs nothing against main, and the full `dispatch` fallback costs about 5 fps (-16%), which matches the cost described above. Not verified: I only measured frame rates, not whether the 3-4 frame shadow flicker is gone on this setup. The shader hashes are for the 1.0.2.1 build.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/445/head:github-bot/gh-445'
git switch 'github-bot/gh-445'

Merge

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