Commit Graph

15 Commits

Author SHA1 Message Date
938616af6b Merge pull request #2979 from Vonsek 2026-11-22 15:13:46 -05:00
7e1aecf0cb first_light: fix VKH_TSHARP_VA overflow guard, subgroup size, preview env, and test docs
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'].
2026-11-22 21:06:15 +01:00
3763517741 First light: add textured draw path with T#/S# bindless set and CPU oracle (TEST-524)
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).
2026-11-22 21:06:14 +01:00
de123384a4 Merge upstream main into codex/first-light-ppm-nonfinite 2026-11-22 21:04:11 +01:00
084b87be74 fix(tools): preserve previews with nonfinite readback channels
Converting a nonfinite channel to an integer raises before the display clamp, leaving a partial PPM.
2026-11-22 20:00:37 +01:00
2b13467423 Merge pull request #2588 from Vonsek 2026-11-22 13:16:22 -05:00
d685e4b26f Merge pull request #2489 from Narek Shaghoyan 2026-11-22 13:15:40 -05:00
46a196cde9 Merge upstream main into first-light shader identity 2026-11-22 19:07:53 +01:00
0c4353f55b fix(tools): center retained mesh depth in first light
Fitting a translated mesh with keep-z used its original Z origin and put otherwise visible vertices outside clip depth.
2026-11-22 18:35:12 +01:00
e2c9ba7661 first_light: support negative OBJ indices, comments, continuations, and bounds checks in read_obj
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.
2026-11-22 17:13:37 +00:00
d3fab00a78 fix(build): preserve first-light shader identities
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.
2026-11-22 17:59:18 +01:00
e590a591cd first_light: Windows defaults, one raw path, OBJ hash (rafaelpssz's review)
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.
2026-11-22 12:28:20 -03:00
f7edafaa2e first_light: --check shares the test's oracle (Vonsek follow-up)
--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.
2026-11-22 12:28:20 -03:00
3556ab9141 first_light: harden the readback oracle (Vonsek's review)
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.
2026-11-22 12:28:20 -03:00
07cc6efb20 first_light: a real game model with its own translated VS/PS
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.
2026-11-22 12:28:20 -03:00