Skip to content

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

Merged
ubiquitarianism merged 1 commit into
mainfrom
fix/ambient-green-blue-probes
Dec 1, 2026
Merged

ubiquitarianism merged 1 commit into
mainfrom
fix/ambient-green-blue-probes

Conversation

@ubiquitarianism

Copy link
Copy Markdown
Collaborator

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.
@ubiquitarianism
ubiquitarianism force-pushed the fix/ambient-green-blue-probes branch from b563b6d to fe61206 Compare December 1, 2026 17:02
@ubiquitarianism
ubiquitarianism merged commit 3dd1bf4 into main Dec 1, 2026
6 checks passed

@KelboLive KelboLive left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

OreoFR commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Heads-up: this was merged at 17:14 UTC while main's CI was still running on #2874's merge (3d8ea10, 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants