Skip to content

first_light: test NaN rejection across checked UV-mode channels - #3606

Open
Desamodeth wants to merge 1 commit into
ItsNotRexed:mainfrom
Desamodeth:fix/first-light-nan-probes
Open

Desamodeth wants to merge 1 commit into
ItsNotRexed:mainfrom
Desamodeth:fix/first-light-nan-probes

Conversation

@Desamodeth

@Desamodeth Desamodeth commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

BUILD-1048 · Coordination claim

Current main already checks finiteness through _close. This PR adds regression coverage for the UV-mode readback. It injects NaN into each of four channels at three distinct locations including the clear pixel, the centre UV pixel, and an additional UV probe. Coverage remains within bounds in all 12 cases, so each failure must identify the affected pixel.

The oracle on f847748c accepted all 12 invalid images. The test passes on 3faac557 with the existing implementation. On Windows, 38 of 46 first-light tests ran and passed and eight were skipped. Also tested together with #3751, with 40 passed, eight skipped. Synthetic CPU readbacks. AI-assisted with Codex Astra 6.2 High.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Second check on Windows at 5e2d9a2b. All five CPU oracle tests passed. On an independently constructed 4×4 readback, the base accepted a NaN in each of the four channels at the clear pixel, centre, and additional UV probe. This head rejected all 12 cases with the corresponding pixel diagnostic. Coverage stayed within bounds even when a covered pixel lost alpha.

Both revisions accepted the finite control, a finite value within tolerance, and an RGB NaN outside the probed pixels. Both rejected infinity and a finite error outside tolerance at the centre. My checks covered the Python oracle with synthetic bytes. The GPU draws are from the author's run.

AI-assisted.

@tylerstraub

Copy link
Copy Markdown
Contributor

Replying to @Vonsek.

The 12 checked-channel NaN cases are also useful as a merge check for @Koro4e’s #3771. Against main f847748c, a three-way file merge of #3606 (5e2d9a2b) and #3771 (151aae29) conflicts at all three comparisons in check_image: clear pixel, centre and UV probe.

I tried each head and a scratch resolution on Linux with the same synthetic 4×4 RGBA32F frame. #3771 alone accepted all 12 NaNs. Keeping its float memoryview and applying #3606’s within-tolerance predicates to that view rejected all 12 with the appropriate pixel diagnostic, as #3606 alone did. On the finite control, all three returned four covered pixels and wrote byte-identical PPMs. The combined result returned a memoryview.

Whichever change lands second can use those three predicates and the checked-channel fixture to verify the rebase. No GPU draw was needed for this CPU readback check. AI-assisted review (Codex).

AI-assisted.

AI-assisted-by: Codex Astra 6.2 High
@Desamodeth
Desamodeth force-pushed the fix/first-light-nan-probes branch from 5e2d9a2 to d2120f4 Compare November 23, 2026 07:37
@Desamodeth Desamodeth changed the title first_light: reject NaN at checked pixels first_light: test NaN rejection across checked UV-mode channels Nov 23, 2026
@KkelebekK

Copy link
Copy Markdown

Reviewed and tested d2120f41 (force-pushed over 5e2d9a2b), CPU only, on Linux with synthetic 4×4 readbacks. The oracle change from the earlier head reached main through #2806 (06f9151d, _close), so this PR now adds only the regression test. That matches the description.

I found no problems.

AI-assisted.

@MichaelL401

Copy link
Copy Markdown
Contributor

Tested d2120f41 on Linux, CPU only (no GPU), Python 3.12.16: pass.

  • python -I tests/test_first_light.py: OK, including the new test_rejects_nan_at_each_checked_pixel (4 skipped: they need a first-light build in LEONIDA_FIRST_LIGHT_DIR).
  • The branch is based on current main 3faac557; the change is test-only.

AI-assisted (Claude).

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.

5 participants