Skip to content

gfx-stages-live (2026-11-01, batch r1): the four titles scanned for stage programs, the GLSLC geometry vertex handle fix, real programs through the replay

Branch claude/gfx-stages-live-2026-11-01-r1 (Mac, Metal, base df2f318). Contract: gfx.md section 13 ("Real titles (gfx-stages-live, 2026-11-01-r1)"), gpu-title-scan.

What changed

  1. Translator: GLSLC geometry vertex handles (gfx/src/shader/maxwell_translate.c, TRANSLATOR_VERSION 15 in mtl_shader.m). GLSLC geometry code reads its input vertices as S2R SR_INVOCATION_INFO (0x1d), handle k = (info & 0xff) * ((info >> 16) & 0xff) + k, ISBERD, ALD a[handle][..], with the handle 0x80000000 (no vertex) when k >= the vertex count. The translator answered 0 for SR 0x1d and read ISBERD as an attribute address, so every handle became 0x80000000 and the kernel read another primitive's record (the index wrapped): Super Mario Odyssey's lightning lines (alThunderShader) all collapsed to one point. Now SR 0x1d = vertex count << 16 | invocation (geometry), patch vertices << 16 (tess control / eval); ISBERD in those stages maps the handle back to the ALD vertex operand (geometry: modulo the vertex count, so instanced geometry works too); a geometry ALD with a vertex operand past the primitive reads 0. Vertex / fragment ISBERD keep the attribute-address reading.
  2. Evidence lines (gfx/src/mtl_stages.inc): stage path ran: geometry | tessellation | software tessellation, program <hash> (vs <hash>): ... once per program, then the running count at powers of two.
  3. MultiDraw*IndirectCount with stage programs (stage_draw_indirect_count, mtl_stages.inc): count and argument records read at encode time, every draw through do_draw_indirect (stages, or a native draw when the program is a pass-through). It needs a one-line call at the top of do_draw_indirect_count in mtl_replay.m, which belongs to gfx-msaa-views this batch: not committed (the integrator file has the patch); t_stages 2e runs it with -DNAPPLE_TEST_IND_COUNT_STAGES.
  4. Tests: t_stages 2f (the GLSLC prologue pattern: two handles through ISBERD, the 0x80000000 handle, INVOCATION_INFO in a captured generic; exact words, fails on the old translator), t_xlate_stages.inc (MSL text of SR 0x1d / ISBERD in geometry with lines and points and in tess control, ALD range guard), t_control 6 (two real geometry control sections, SMO and ACNH, word for word), t_stages_dumped (new: NAPPLE_GFX_STAGE_DUMP=<a NAPPLE_GFX_CTL_DUMP dir> runs a title's real geometry programs through the replay with points / lines / triangles input and constant buffers of 1.0, captures their output and checks it; skipped without the variable, game code never committed).
  5. tools/gpu/scan_stages.py: RomFS images (base, the patched update romfs.bin, DLC), SARC archives, Yaz0 (faster slice copies) and zstd (Python 3.14) opened, several inputs per title, distinct counts by content digest, the stage programs listed with their archive path; every compressed file is opened by default (MK8D's model archives carry programs), --quick restricts to shader-looking paths. Tests: synthetic RomFS + SARC + Yaz0 image, Yaz0 back-references.

Scan of the four titles (base + update + DLC, every archive opened)

Title Programs (distinct vs / fs / cs) gs tcs / tes xfb
Link's Awakening (v0) 6429 (2881 / 2858 / 26) 0 0 0
Super Mario Odyssey (v0) 13910 (5045 / 8107 / 68) 2 (ShaderData/alThunderShader.szs) 0 0
Mario Kart 8 Deluxe (v1376256 + Booster DLC) 36275 (10402 / 13239 / 24) 1 (Common/Gfx/gsys_resource) 0 0
Animal Crossing (3.0.3 + 3 DLC) 9720 (2533 / 3505 / 56) 8 (Swkbd/shader/*OceanShader*) 0 0

No title has a tessellation program or a transform feedback layout: those stay tested (synthetic, t_stages 3-4, t_control), and the GLSLC_XFB_* / GLSLC_TESS_MODE_OFF candidate offsets stay unproven.

Verified vs not

See the integrator file integrators/claude-gfx-stages-live-2026-11-01-r1.md ("Built and tested here") for the commands and results. In short: make -C gfx test ALL TESTS PASSED (tested); real SMO / ACNH geometry programs through the replay (t_stages_dumped, tested with real code and synthetic input); no geometry program was drawn by a title in this session's scripted runs (SMO Cap Kingdom save and fresh-save airship intro, ACNH fresh-save name keyboard): not verified in game.