shader: thread-0 constant LDS init and empty-wave stall guard (water mosaic fix) #187
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ReTerryDavis--ReVIctory!187
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-186"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SovietBearz0r on GitHub · 2026-12-05 22:36 UTC · original
SovietBearz0r:larp-water→main· +326 −1 · 3 files · 1 commits · openSummary
Port of Darner's water surface mosaic fix (Issue #24), via LARP commit
9a42871for this title. Symptom: dark 8x8 mosaic slabs on the water (most visible next to boat hulls and the horizon).Two parts, both on by default:
crates/victory-shader/src/emit/lower/lds_gs.rs):water_shading:CS_TransmissionVolumetrics_*sets up constant data in LDS under av_cmpx_eq_u32 ... 128(thread 0 of the group) that its own lane may have left early. When that guard matched (thread (0,0) present, all its data constant), the constant stores are now done for thread 0 under aflattenedThreadIdInGroup == 0guard, so the rest of the group does not read uninitialized shared memory.VICTORY_LDS_INIT=0turns this rewrite off for bisecting a water-render difference.without_skips(crates/victory-shader/src/ir.rs): as_cbranch_execzskip whose skipped region contains a loop that provably never ends for a wave with no lane (the console's thread-0 prefix sum over the group's waves) is kept, with the dynamic EXEC/VCC facts and cycle analysis LARP uses. Left out, the console's watchdog aborts the tile and draws the mosaic.Ported from gamingwithhomie/larp
9a42871533c9a9e5968b8291e183c830f7e07cd5(GPL-3.0-or-later), which ported Darner'sfirst_thread_initand empty-EXEC loop stall guard for the same title; comments name the origin.Verification
cargo test --locked -p victory-shader --lib: 323 passed, 2 ignored (includes the existingwithout_skips/structurisation tests and the whole emitted-shader test suite).cargo clippy --locked -p victory-shader --lib -- -D warnings: clean.cargo xtask policy: 442 files ok.VICTORY_LDS_INIT=0is the kill switch for an A/B.Context
One of the items from the LARP borrow review. The sibling ports are #184 (xapu conversion kinds) and #185 (Agility runtime fallback).
121c2ce1c2to3be7b6f613@SovietBearz0r on GitHub · 2026-12-05 22:55 UTC · original
In-game smoke (RX 9070 XT, diag build, run twice with
VICTORY_LDS_INIT=0and default): both runs clean — 0 ERROR, 0 failed/invalid shader lines, 0 device removals, 3 spots, exit 0, indistinguishable pacing (48.1/42.1/40.2 off vs 47.6/41.8/40.2 on).But the first smoke exposed a real gap, now fixed on the branch: the warm cache still served
shader translations of an earlier build of the translator (same version)andhits=3899 misses=0—VICTORY_LDS_INITis not in the shader-cache key andTRANSLATOR_VERSIONwas still 20, so the new thread-0 LDS lowering was never emitted for someone with a warm cache. I bumpedTRANSLATOR_VERSION20→21 in this PR (head now3be7b6f6), which forces the one-time retranslation that this change needs.Consequence for the visual check: the earlier captured frames would still show the old shaders. After the bump (or with
VICTORY_SHADER_FRESH=1/victory shaders), a standing/boat-water capture is needed for the mosaic A/B (VICTORY_LDS_INIT=0vs on). Note the version bump collides with #162 and #169 (both also 20→21 from the same base) — whichever merges first, the next needs 22.Logs:
data\logs\larp-water-off.log,larp-water-on.log.@SovietBearz0r on GitHub · 2026-12-05 23:44 UTC · original
In-game visual A/B done with pre-HUD captures on a warm, per-arm cache (ON = default thread-0 LDS init, OFF =
VICTORY_LDS_INIT=0).Setup: pure
larp-water3be7b6f6(version-21 retranslation), diagnostics capture build; 25,985 shaders precompiled per arm with separate shader packs; pinned harbour route so both arms fly the same 3 spots; 9 pre-HUD frames per arm (spawn + 4 cruise_out + 4 cruise_back), e.g.on/frame-22080 vs off/frame-20954.
Visual result: no dark 8x8 mosaic slabs in either arm — the harbour/boat view (water, islands, buoys, boats) is clean in both; no visible difference attributable to the lowering, and no regression (fps identical, 0 errors, warm-cache evidence: ON pack delta 0 bytes; OFF only grew after the last saved frame). So the fix could not be positively demonstrated on this route/GPU because the artifact did not reproduce with the unfixed lowering here — it is consistent with the change being harmless and with the Darner/LARP report, but a scene that actually shows the mosaic is still the missing proof. Captures and per-arm evidence:
data\ingame-verify\water-visual.md(frames underdata\ingame-verify\water-frames\on|off).Note:
VICTORY_LDS_INITis not part of the shader-cache key, so an A/B needs separate caches (as done here); the default-on fix itself only needs theTRANSLATOR_VERSIONbump already in this PR.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.