The links between the game files and the GPU fail quietly: an llvm-mc whose gfx1013 decoder rejects words leaves pipeline library programs untranslated, a translation from older translator sources keeps loading after the module contract changed, and the runtime's slot-67 refusals sit in a large log. tools/chain_check.py reads a make_game.py work folder (and optionally one run's log) and prints one block per link with OK/WARN/FAIL and the most likely cause: llvm-mc and spirv-val versions and the translator digest against this checkout; unpacked, listed and translated programs per family with up to 5 refusal reasons; tagged/plain modules and runtime folders; loaded modules, failed slot and D3D12 calls, builds, gate waits, faults and the exit code. The last line names the weakest link. Counts and fixed words only: refusal reasons are matched against the messages rdna2spirv.py raises, anything else counts as "other", and paths appear only with --show-paths. Exit 0 by default, 1 with --strict on FAIL. Standard library only; documented in docs/dev-tools.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.2 KiB
Development tools
From the Leonida checkout root, use Python 3 to list the development tools:
python -I scripts/dev.py --help
python -I scripts/dev.py discover
python -I scripts/dev.py discover --json
From another directory, pass the path to scripts/dev.py, quoting it if needed.
The inventory always describes the checkout containing that script.
boot-trace points to the analyzer for startup JSONL and D3D12 stderr logs.
guest-scene points to the headless synthetic guest runner. Run a listed help
command from the checkout root to see the producer's options. The text
inventory displays commands for PowerShell on Windows and POSIX shells
on other platforms. The inventory
checks for each producer script and lists its prerequisites without checking
those prerequisites or running the producer. Live attach, pause, step, input,
and screenshots are unavailable through this entry point.
JSON output
discover --json writes one object to stdout:
schema_versionidentifies the format. The current version is1.toolslists entries byid. Eachpathuses forward slashes and is relative to the checkout root.presentindicates whether the script is a file.help_argvis a list of arguments for a command run from the checkout root. Its first argument is the Python executable running discovery. It isnullwhen the script is missing.requirementslists prerequisites for using the producer.live_controlscontains anavailableboolean and areason.
Exit code 0 indicates that the inventory was emitted, including when a
producer script is missing. Invalid CLI arguments exit with code 2.
Analyze a boot trace
Use the existing analyzer through the development CLI:
python -I scripts/dev.py boot-trace --help
python -I scripts/dev.py boot-trace "logs/startup trace.jsonl"
python -I scripts/dev.py boot-trace "logs/startup trace.jsonl" --d3d12 "logs/d3d12 stderr.log" --json
Pass a startup JSONL from gta6rt --trace, a D3D12 stderr log from
gta6rt --trace-d3d12, or both. Relative input paths are interpreted from
the directory where you run the CLI. From outside the checkout, give the
path to scripts/dev.py and keep the trace paths relative to your directory.
The analyzer supplies the help, output, diagnostics and exit status. If one
input fails but the other can be read, --json can still emit a partial
summary on stdout with a diagnostic on stderr and exit code 2. If neither
input can be analyzed, there is no JSON summary. The summary describes the
recorded events, and the exit status reports the analysis result.
You can also run python -I tools/boot_trace.py with the same arguments.
Check the shader chain of a work folder
tools/chain_check.py prints one page of counts for each link between the game files and the GPU. It reads the
work folder that make_game.py built and, if you pass one, the log of one run:
python -I tools/chain_check.py <work>
python -I tools/chain_check.py <work> --log <OutDir>\<Name>.log --json
The page has one block per link, and each block gets a verdict (OK, WARN or FAIL) and its most likely cause:
- tools: the llvm-mc each family was disassembled with and its AMDGPU target, spirv-val, and whether the translator sources recorded in the folder still match this checkout's;
- one block per family (game programs, pipeline library, FSPX, BVH, executable): programs unpacked, listings,
listings with rejected words, programs translated, and up to 5 refusal reasons from
logs/shaders.log; - contract: tagged and plain modules, and the runtime folders that are present or absent (
fspx_computeand the others); - runtime, from
--log(scripts/windows-boot/boot.ps1's<Name>.log): modules loaded, failed device slot calls, failed D3D12 calls, compute pipeline builds, waits at the compile gate, device faults and the exit code.
The last line names the weakest link: the first block, in chain order, with the worst verdict.
A family is FAIL when more than 1% of its programs have no module. An llvm-mc older than 23 is a WARN (#1923). The
--help text lists every threshold. The report prints counts and fixed words only: no program names, no log lines
and no paths. A refusal reason is printed only when it matches a message from tools/rdna2spirv.py; any other
reason is counted as other. Add --show-paths to name the folder and the log, but not in a report you publish.
The exit code is 0 whatever the verdicts. With --strict it is 1 when a block is FAIL, and bad arguments exit
2. Probing asks llvm-mc, spirv-val and git for their versions; --no-probe runs nothing.
Run a synthetic guest scene
Use the existing headless runner with a loader and guest built on Windows
with Vulkan, static SDL3 and LEONIDA_GUEST_SCENE=ON. Supply the synthetic
M1.5 shader fixture root containing spirv/. See the
runtime instructions
for the build, fixture and Wine setup.
python -I scripts/dev.py guest-scene --help
python -I scripts/dev.py guest-scene --loader "build/gta6rt.exe" --guest "build/tiny_guest_draw.exe" --shaders "m15 shaders" --out "scene run" --negative-controls
Pass --out PATH or --out=PATH with a new or empty directory. Relative
paths are interpreted from the directory where you run the CLI, including
when you invoke scripts/dev.py by its full path from another directory.
The CLI forwards the runner's exit code and diagnostics. Exit code 0
means the scene checks passed. Exit code 1 can indicate a scene check
failure or a failure before the runner can write a report, such as an
output directory it cannot create. Exit code 2 indicates a usage or
prerequisite error.
When the runner writes report.json, it prints the path. Open that file
for the scene result and per-run details. For example, if the full run
starts and the loader exits with an error, runs.full.returncode records
the loader's exit code while the CLI returns the runner's exit code.
The output directory also holds any logs, frame records and PPM images
the runner produced. If the runner rejects an occupied directory, any
report already there belongs to an earlier run.
You can also invoke python -I scripts/run_guest_scene.py directly.