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

Merged
ubiquitarianism merged 1 commit from upstream-pr/2904 into main 2026-12-01 17:14:37 +00:00
ubiquitarianism commented 2026-12-01 16:55:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-12-01T16:55:21Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5590371683 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2904). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-12-01T16:55:21Z. --- 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.
KelboLive commented 2026-12-01 17:18:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:18:34Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136308696 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2904#pullrequestreview-6136308696). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:18:34Z. **Review:** COMMENTED --- 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.
OreoFR commented 2026-12-01 17:19:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T17:19:25Z.


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.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319115436 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2904#issuecomment-7319115436). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T17:19:25Z. --- 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.)
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
ProjectLeonida/mandy!2904
No description provided.