BCH directional fragment lighting validation, 2026-10-24
Baseline commit 102a317c446c294a30f4228acf01fe267ebf9e98.
Environment: Ubuntu 24.04 x86_64 cloud container, cc 13.3.0, Python 3.13,
SDL 2.30.0+dfsg-1ubuntu3.1, SDL dummy video with the software renderer. Not run
on the local WSL host or native Windows. Source was frozen before the final
runs; tested hashes are in validation.json.

1. make -C native clean; make -C native all test test-runtime
   Passed. 16 native C suites (new: test_bch_scene, test_light; extended:
   test_bch_model, test_raster). Python core: container 8, BCH index/GR 12,
   PICA commands 12, BCH model 11. Python runtime: texture viewer 7, BCH
   texture viewer 6, model viewer 10, BCH model viewer 9, BCH textured viewer 5,
   BCH combiner viewer 4, BCH lighting viewer 2 (new), field viewer 9. 95
   Python tests in total.

2. make -C reconstructed test
   Passed.

3. python3 -m unittest discover -s tests
   Passed: 38 tests, 2 optional-dependency skips.

4. Sanitizers: -fsanitize=address,undefined -fno-sanitize-recover=all,
   ASAN_OPTIONS=detect_leaks=1.
   Passed without diagnostics: test_bch_scene, test_bch_model, test_light,
   test_raster; dump_lighting on both environment sections and the field; the
   sanitized viewer under the lighting (2), combiner (4), textured (5),
   BCH-model (9) and model (10) viewer suites; real-input day and night runs
   (3 frames, input self-test, captures identical to the unsanitized build).

5. Checkpoint integrity
   All 539 reconstructed/*/SHA256SUMS entries match. All 78 earlier native
   reproduction/ entries match. From the real archive paths, the stage-0
   capture reproduces sha256 2d905248...0951 and the combiner capture
   bb9e433d...f0c4, the values recorded earlier from wrapper archives.

6. python3 -I -B native/reproduction/bch-lighting/verify_lighting.py
   --field field165.bch (cb131a95...) --environment <a/0/0/3 entry 137 BM
   section 0> (fdd7377e...) --code code.bin (0f6d3e1d...)
   --bridge native/build/dump_lighting --viewer native/build/pokemon_model_viewer
   --romfs <RomFS with a/0/4/1, a/0/1/3, a/0/0/3> --spica <SPICA bd29a78>
   --ohana <Ohana3DS-Rebirth c50635e> --azahar <Azahar 1b5fd009>
   Passed. All reference files hash-checked. 16 lights (every field), 12 light
   sets with 20 entries, the scene name and counts; 12 materials' lighting
   parameters; 7,068 normal components; 44 code.bin words; 65,536 register
   products; 20,000 random and 970 field lighting evaluations (394 invalid
   inputs rejected by both): zero mismatches. The Ohana 8-byte light-reference
   reading is inconsistent with the file's relocations. Float16 truncation of
   the view-space light vector: at most 1 level over 194,000 comparisons.
   Viewer light setups equal the oracle's; captures 960x640, sha256 day
   1dc1e452a7af26ed4b78f76e2a59870921a0370f6a5a24947626f023145a243a, night
   640c936ad1020f50559e6d03eeaf90867db7a770ce68f7f3fe735701594400fe.

Not established: the vertex shader's normal quaternion and primary color,
point/spot lights (bounded), the game's day/night selection and environment
binding, specular and fragment secondary, fog, projected textures, culling,
primitive state, the game camera and depth mapping, and any running-game
visual comparison.
