Addresses @Kam471's review on #2806:
- Fix uint32 wraparound in VKH_TSHARP_VA bounds check (tsharp_va > heap_bytes - 32) so 0xFFFFFFE0 is rejected with exit 2 instead of writing OOB; add regression test in tests/test_first_light.py.
- Clarify exact test counts in docs/first_light.md (14 tests: 11 pass, 3 skip without LEONIDA_FIRST_LIGHT_DIR; 14/14 pass with LEONIDA_FIRST_LIGHT_DIR).
- Require --obj when --dds is passed so textured probes are always populated, include all texture env vars in the non---run preview command, and pass VKH_SUBGROUP_SIZE from manifest['ps']['subgroup_size'].
Implements TEST-524:
- runtime/test/vk_harness.cpp: adds optional VKH_TEX_RGBA, VKH_TSHARP_VA, and VKH_SSHARP (inert when unset) to upload an RGBA8 texture to set 0 image index 1 (with 1x1 magenta fallback at index 0), write the 8-dword T# at VKH_TSHARP_VA in the 64 KiB heap, decode S# via gfx10_descriptors.h into sampler index 1, and bind DescriptorTable at binding 2.
- tools/first_light.py: adds --dds <path.dds> (decoding via tools/dds_png.py to texture.rgba), defaults --ps to PS_Copy_3ea4b38a_Wrapped (wave32, single image_sample_lz, compatible with DEFAULT_VS), reads ptr32_lo SGPR and literal_samplers from index.json, and adds a bilinear clamp-to-edge CPU texture oracle (centre_rgba + rgba_probes) in check_image.
- tests/test_first_light.py: shares fl.harness_env() so package-gated tests cover both untextured and textured runs, and adds 6 synthetic TexturedOracleTests (no GPU or game files).
- docs/first_light.md: documents the textured path and RTX 3060 verification (counts and hashes only; no game data).
- docs: one row per topic again in design.md (59 topics merged sentence by sentence, keeping every
number) and README.md (the current models/character rows); one Other languages line.
- docs/i18n: the two Spanish quickstarts had been concatenated; keep #1912's, drop #2277's row.
- make_game: the shader fingerprint covers spirv_asm.py and its tables; LF settings write.
- tools: pe_shader_containers, gamedata_maps and anim_rigs use report_paths.same_report_path (BUILD-589);
stdout guard on five tools; LF text writes in three; user_sgpr_census tolerates an unreachable --json.
- tests: fspx stage fakes write real carve/unpack indexes (c7408a1f); typed f16 stores round toward zero
(SHADER-358); test_ci_registration's helper is no longer collected as a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A truncated manifest.json (--check) or carve index.json (--list) died with a json.decoder traceback, a
non-UTF-8 file with a UnicodeDecodeError, and a well-formed file of the wrong shape with a TypeError or
KeyError, though the tool's other failures are single SystemExit lines. The new load_json guards only the
two reads main opens, naming the file and the reason on one line, and checks index entries just on the keys
--list prints; choose() and translate() keep their plain reads, which #2419 rewrites.
tests/test_first_light_bad_json.py drives the CLI over hand-written temp folders, with no package or
harness; 8 of its 9 tests fail without the change. The tests sit in their own file (moved there in review)
so they don't collide with the open pull requests that extend tests/test_first_light.py.
AI-assisted: written by Qwen (model qwen3.8-gx10-claude-compatible).
Co-Authored-By: Qwen qwen3.8-gx10-claude-compatible <noreply@qwen.ai>
tools/first_light.py read_obj() computed vi = int(parts[0]) - 1, which shifted negative relative OBJ indices off by one, turned invalid index 0 silently into positions[-1], crashed on inline # comments or line continuations, and failed with raw IndexError/ValueError on short or out-of-range lines. Resolve negative indices relative to current list length, strip # comments, join trailing-backslash continuations, validate vertex indices cleanly with SystemExit, and add synthetic ReadObjTests.
Vertex and pixel shaders can share a display name while having distinct carved files. Carry the selected stage and exact file through translation lookup and publication.
- test_translate: #1904 caps structured depth at 16, so the #1993 dispatch-loop test lowers MAX_STRUCTURED_DEPTH.
- test_ctest_registration: skip-code scan ignores conditional returns.
- test_d3d12_stubs_generation: INCLUDE uses os.pathsep.
- docs/README.md: one Other languages line.
- first_light.py, make_game.py: LF text writes; stdout guard on three tools.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
find_harness/harness() check runtime/build/windows and add .exe on Windows; the
skip/error text names LEONIDA_VK_HARNESS. The tool and the test use fixed
image.raw / image_first_light.raw paths, unlinked before each run, so no random
raw files pile up. manifest.json records the OBJ SHA-256 and docs/first_light.md
names the 4,213/7,968 model and its hash.
--check now loads an existing manifest, writes a fresh raw path, and calls the
same check_image the test imports. The oracle adds four UV probes whose U and V
differ by more than 0.15, because a symmetric centre alone cannot catch a swapped
UV. Fake harnesses that exit 0 without writing, write a solid image or swap UV
all exit 1; the real draw exits 0. The test has seven cases, including the CLI.
The draw writes a fresh raw path (a harness that writes nothing cannot pass on a
stale file); the check adds a coverage maximum, a corner that must keep the clear
value and the centre UV the mesh's last covering triangle predicts on the CPU.
OracleTests cover the accepted fixture plus all-opaque, swapped-UV and short
negatives without a GPU or a package.
tools/first_light.py carves the game's shaders, translates one real VS/PS pair,
converts an exported OBJ to a mesh, writes a manifest and runs vk_harness. The
harness gains VKH_DRAW_MESH/VKH_VERTEX_LAYOUT (indexed mesh, vertex input), inert
when unset. The package-gated test draws the model and checks coverage and the
centre pixel; docs/first_light.md records the measured result.