Commit Graph

4 Commits

Author SHA1 Message Date
006af9d9d3 d3d12_first_light: bound the adjacent-half pixel count
From @Flyander's review of #2001: one_f16_step pixels were counted but not limited, so a regression that
moved every covered pixel by one half step would pass (only differ == 0 was checked). An adjacent half only
appears where the f32 interpolant is a few ulps from an f16 truncation boundary (1 pixel of 12,804 covered on
the RTX 3060), so at most one covered pixel in a thousand may be one step apart.

Checked both ways: the real image passes (1 pixel); a reference with all 12,804 covered pixels moved one half
step fails at the new bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:49:24 -03:00
9420e70bb2 d3d12_first_light: pin the stage separation of the FSSM lookup
From @SuarezPM's review of #2001: the description promised that a container swapped for the other stage's
fails, but nothing asserted it. The shader library must not find the PS hash as a vs program or the VS hash
as a ps program, and CreateGraphicsPipelineState with the pixel shader's container as the VS must fail and
return no PSO. Both hold on the RTX 3060; the draw and the 16,383 + 1 comparison are unchanged, 0 validation
messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:39:21 -03:00
2f9b2a76a2 d3d12_first_light: exact f16 adjacency, required reference image, UV probes
From @Vonsek's review of #2001:
- The one-f16-step tolerance compared |a - b| with a step taken from the larger value's exponent, so it
  accepted two steps across an exponent boundary (0x3bfe vs 0x3c00) and refused one step in the subnormal
  range (0 vs 0x0001). Both values must now be exact halves whose ordered half index differs by at most
  one; the test checks those four controls itself before comparing.
- A missing or empty image.raw skipped the whole-image comparison silently. It is now required, with a
  message to run first_light.py --run.
- The UV probes first_light.py writes (pixels where U and V differ) are checked as well as the centre.

RTX 3060: 4 UV probes match; 16,383 of 16,384 pixels bit-exact, 1 one f16 step apart; 0 validation messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:36:51 -03:00
6c73872cad first_light: draw the real model through the D3D12 layer
d3d12_first_light (package-gated by LEONIDA_FIRST_LIGHT_DIR, exit 77 when
unset) draws the mesh and translated VS/PS that tools/first_light.py wrote
through the Xbox-ABI device proxy: CreateGraphicsPipelineState gets the
game's own containers and finds both stages by FSSM hash, the input layout
feeds POSITION/TEXCOORD, DEFAULT vertex/index buffers, one
DrawIndexedInstanced, CopyTextureRegion readback. It checks vk_harness's
oracle (coverage window, clear corner, centre UV) with the rows flipped
for the y-up viewport, and compares every pixel with vk_harness's
image.raw.

first_light.py now also writes vs.dxbc, ps.dxbc and index.json (the
translator entries keyed vs/ps) to the output folder.

RTX 3060, driver 616.64: 12,804/16,384 covered, centre
(0.49756, 0.49634, 0, 1), as vk_harness; 16,383 pixels bit-exact and one
one f16 step apart (the PS exports with v_cvt_pkrtz_f16_f32; vk_harness
with the mesh mirrored in y matches the D3D12 image bit for bit).
Clean under LEONIDA_VK_VALIDATION=1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:36:51 -03:00