gpu: drop neon green and blue garbage from the probe resolve on request #2904

Manually merged
github merged 1 commit from github-bot/gh-2904 into gh-pr/2904/base 2026-12-01 17:18:10 +00:00 AGit
Owner

@⁠ubiquitarianism on GitHub · 2026-12-01 16:55 UTC · original
ProjectLeonida:fix/ambient-green-blue-probes → main · +44 −11 · 2 files · 1 commits · merged 2026-12-01 17:14 UTC

Item: D3D12-AMBIENT-GREEN-BLUE-FILTER (claimed in #2570).

The light pass already drops magenta from what the title's probe resolve left (LEONIDA_AMBIENT_MAGENTA, on by default; d3d12/crates/leonida-gpu/src/ambient.rs). This adds two more colours:

  • LEONIDA_AMBIENT_GREEN=1 drops a green far above red and blue (g > 1.8 * max(r, b) and g > 0.05).
  • LEONIDA_AMBIENT_BLUE=1 drops a blue far above green and above red (b > 2.5 * g, b > r and b > 0.02).

The thresholds are those of lobomfz/VIctory-xmem 5a60834 (from coastingVI via dfmbrollins/victory-linux-nvidia, GPL-3.0).

Both are off by default. The garbage was seen on Linux with RADV, not yet on a Windows driver, and a strongly green or blue light that is real would be dropped too. The pass source is now built by one source() function, so a test can compile it.

Tested

  • cargo test -p leonida-gpu --lib ambient: 4 pass. The new the_colour_drops_compile compiles the part with every drop on and with every drop off, with the system's compiler and no device. It fails when a define the shader reads is missing, which I checked by renaming GREEN_DROP in source().
  • RX 6800, Windows 11, driver 32.0.21030.2001, with both switches on and a save loaded into the world: the light passes were made with the drops compiled in, and the picture showed nothing wrong over about 4 minutes. No frame was compared with the switches off, so whether they remove anything on a Windows driver is still open.
**@⁠ubiquitarianism** on GitHub · 2026-12-01 16:55 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2904) `ProjectLeonida:fix/ambient-green-blue-probes` → `main` · +44 −11 · 2 files · 1 commits · merged 2026-12-01 17:14 UTC Item: `D3D12-AMBIENT-GREEN-BLUE-FILTER` (claimed in #2570). The light pass already drops magenta from what the title's probe resolve left (`LEONIDA_AMBIENT_MAGENTA`, on by default; `d3d12/crates/leonida-gpu/src/ambient.rs`). This adds two more colours: - `LEONIDA_AMBIENT_GREEN=1` drops a green far above red and blue (`g > 1.8 * max(r, b)` and `g > 0.05`). - `LEONIDA_AMBIENT_BLUE=1` drops a blue far above green and above red (`b > 2.5 * g`, `b > r` and `b > 0.02`). The thresholds are those of lobomfz/VIctory-xmem `5a60834` (from coastingVI via dfmbrollins/victory-linux-nvidia, GPL-3.0). **Both are off by default.** The garbage was seen on Linux with RADV, not yet on a Windows driver, and a strongly green or blue light that is real would be dropped too. The pass source is now built by one `source()` function, so a test can compile it. ## Tested - `cargo test -p leonida-gpu --lib ambient`: 4 pass. The new `the_colour_drops_compile` compiles the part with every drop on and with every drop off, with the system's compiler and no device. It fails when a define the shader reads is missing, which I checked by renaming `GREEN_DROP` in `source()`. - RX 6800, Windows 11, driver 32.0.21030.2001, with both switches on and a save loaded into the world: the light passes were made with the drops compiled in, and the picture showed nothing wrong over about 4 minutes. **No frame was compared with the switches off**, so whether they remove anything on a Windows driver is still open.
The light pass already drops magenta from what the title's probe resolve
left (LEONIDA_AMBIENT_MAGENTA, on). LEONIDA_AMBIENT_GREEN=1 drops a green
far above red and blue, LEONIDA_AMBIENT_BLUE=1 a blue far above green and
above red, with the thresholds of lobomfz/VIctory-xmem 5a60834 (from
coastingVI via dfmbrollins/victory-linux-nvidia, GPL-3.0).

Both are off by default: the garbage was seen on Linux with RADV, not yet
on a Windows driver, and a strongly green or blue light that is real would
be dropped too. A new test compiles the part with every drop on and off;
it fails when a define the shader reads is missing.

On an RX 6800 (Windows 11, driver 32.0.21030.2001) with both on, a
save loaded into the world: the light passes were made with the drops
compiled in, and the picture showed nothing wrong over about 4 minutes.
No frame was compared with them off.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:56:11 +00:00
github-bot force-pushed github-bot/gh-2904 from b563b6de3a to fe612066ac 2026-12-01 17:05:46 +00:00 Compare
github-bot changed target branch from main to gh-pr/2904/base 2026-12-01 17:18:08 +00:00
github manually merged commit fe612066ac into gh-pr/2904/base 2026-12-01 17:18:10 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-12-01 17:18 UTC · original · reviewed

The port is faithful — the thresholds match lobomfz/VIctory-xmem 5a60834 exactly (g > 1.8*max(r,b), b > 2.5*g && b > r, floors 0.05/0.02; upstream ships green+blue on by default, this makes all three opt-in) — and it is on the right path: the drops act on was only, inside raise, which is dispatched only for Role::Resolve (ambient.rs:847-852); constant mode returns before reading was (:569-573), so no clear or present is touched and the fallback is the floored found, not black. The worst case is a genuinely strong green/blue probe being replaced by the 64×36 estimate, so default-off is the right call.

Two things to fix before merge:

  1. The new test is compile-only, and the guard has no behavioural coverage. 1.8 → 0.8 (drops ordinary green light) leaves all 4 ambient tests green, and so does if (GREEN_DROP) was = 0.0; (drops all leftover light whenever the switch is on). That is the case AGENTS.md asks to prove red before green. #2893's new test already dispatches gather on WARP and reads back — a raise dispatch with one packed green pixel would test this for real without a game or a device.
  2. The MAGENTA docs row is now wrong. switches.md regenerates bit-for-bit, but the magenta row carries the colour_drops sentence ("which other colours…") truncated at LEONIDA_AMBIENT_BL…, so magenta's own row describes green/blue instead. Split the doc comment per switch.

Everything else checks out here: the exact HLSL compiles through D3DCompile in both define combinations, all pipelines build on the hardware adapter, the full crate suite is 633/0/59, clippy is clean in ambient.rs, check_no_game_data passes, and merge-tree against current main is clean (2 commits behind, neither touching these files). With #2893 it conflicts only on the test appended at the end of mod tests — trivial. Note switches.md is shared with 17 open PRs, so regenerate it at merge time.

No visual claim is made in the body, so this is opt-in plumbing with logic-level support only — which is fine, given it stays off by default.

**@⁠KelboLive** on GitHub · 2026-12-01 17:18 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2904#pullrequestreview-6136308696) · **reviewed** The port is faithful — the thresholds match lobomfz/VIctory-xmem `5a60834` exactly (`g > 1.8*max(r,b)`, `b > 2.5*g && b > r`, floors 0.05/0.02; upstream ships green+blue on by default, this makes all three opt-in) — and it is on the right path: the drops act on `was` only, inside `raise`, which is dispatched only for `Role::Resolve` (`ambient.rs:847-852`); `constant` mode returns before reading `was` (`:569-573`), so no clear or present is touched and the fallback is the floored `found`, not black. The worst case is a genuinely strong green/blue probe being replaced by the 64×36 estimate, so default-off is the right call. Two things to fix before merge: 1. **The new test is compile-only, and the guard has no behavioural coverage.** `1.8 → 0.8` (drops ordinary green light) leaves all 4 ambient tests green, and so does `if (GREEN_DROP) was = 0.0;` (drops *all* leftover light whenever the switch is on). That is the case AGENTS.md asks to prove red before green. #2893's new test already dispatches `gather` on WARP and reads back — a `raise` dispatch with one packed green pixel would test this for real without a game or a device. 2. **The MAGENTA docs row is now wrong.** `switches.md` regenerates bit-for-bit, but the magenta row carries the `colour_drops` sentence ("which *other* colours…") truncated at `LEONIDA_AMBIENT_BL…`, so magenta's own row describes green/blue instead. Split the doc comment per switch. Everything else checks out here: the exact HLSL compiles through `D3DCompile` in both define combinations, all pipelines build on the hardware adapter, the full crate suite is 633/0/59, clippy is clean in `ambient.rs`, `check_no_game_data` passes, and `merge-tree` against current main is clean (2 commits behind, neither touching these files). With #2893 it conflicts only on the test appended at the end of `mod tests` — trivial. Note `switches.md` is shared with 17 open PRs, so regenerate it at merge time. No visual claim is made in the body, so this is opt-in plumbing with logic-level support only — which is fine, given it stays off by default.
Author
Owner

@⁠OreoFR on GitHub · 2026-12-01 17:19 UTC · original

Heads-up: this was merged at 17:14 UTC while main's CI was still running on #2874's merge (3d8ea1031, merged 17:12). The maintaining guide in #2797 (draft) asks for one merge at a time, then waiting for main's CI, and for a merge by someone other than the author, so that a red main points at one PR. No harm seen so far; main's CI now covers both. Could we keep to that order from here on?

(Posted by oreofr-agent, Claude Code, on OreoFR's request.)

**@⁠OreoFR** on GitHub · 2026-12-01 17:19 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2904#issuecomment-7319115436) Heads-up: this was merged at 17:14 UTC while main's CI was still running on #2874's merge (3d8ea1031, merged 17:12). The maintaining guide in #2797 (draft) asks for one merge at a time, then waiting for main's CI, and for a merge by someone other than the author, so that a red main points at one PR. No harm seen so far; main's CI now covers both. Could we keep to that order from here on? (Posted by oreofr-agent, Claude Code, on OreoFR's request.)
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2904
No description provided.