A commit's first line is now `area/component: summary`, at most 72 characters, with the full account after a blank line (docs/agents/06-dev-loop.md, Commit messages; AGENTS.md's commit line links it). The whole message used to be one line: since 1 October, 952 of 1,405 subjects ran past 72 characters and the latest ones past 600, so `git log --oneline` and GitHub's commit list showed paragraphs. The form is the one Linux, Git, Go, QEMU, FreeBSD, Wine and the emulators RPCS3, Cemu, PCSX2 and PPSSPP use; kind prefixes (ADD:/FIX:, Conventional Commits' feat:/fix:) were considered and left out: nxnative has no releases to build notes from, one commit here usually fixes, adds a test and adds a reference entry at once, and a fix's kind that matters (cause or workaround) is in the body. The area is fixed and is where the change lands: the labels pr_areas.py gives pull requests, with the shader chain as `chain`, plus `game` for one profile (pr_areas.COMMIT_AREAS; test_pr_areas checks the guide's table names exactly those), since free names drift (NVN:/nvn:, docs:/Docs: in this history). The component is open and comes from the code (hle_movie.c: host/movie, tools/regress), as in Go and Wine. Checked: test_pr_areas (the new case fails when an area is missing from the table), test_docs, test_triage_report, test_issue_areas, lint_python.py (0 new). Not run: a game (docs and a tool constant).
18 KiB
06 — The developer loop: which tool when, and before a pull request
One page for people and agents: the tools this repository has for building, running, debugging, measuring and checking a change, when to use which, and what a pull request needs. It links to where each tool is described instead of repeating it. Game files, keys, builds and runs stay outside the repository (AGENTS.md).
1. Build and run on the Mac
| Step | Tool | Details |
|---|---|---|
| Pack a game for the Mac | scripts/build_ipa_from_nsp.py <NSP folder> -k <prod.keys> --platform mac |
Extraction, rewriter, shader split and chain, the Mac host; prints the command that runs the game. A Mac-only build |
| A double-clickable app | the same with --platform mac-app (adds the offline pipeline archive) |
A Mac app |
| An iPhone build | the same without --platform (an unsigned IPA the user sideloads) |
The packing script in detail |
| Rebuild only the host | make -C dm/host GAME=<id> |
Build by hand (Mac) |
| Rebuild only the shaders | DM_GAME=<id> dm/gfx/tools/dmsh_build.py (after a chain change: dmsh_chain.py --header first) |
the chain procedure in AGENTS.md; 04 |
| Run with scripted input | DM_KEYS (button presses at fixed seconds or frames), DM_CTL (presses, screenshots and dumps while it runs), DM_REC (records what the player does as DM_KEYS steps, to replay a bug report's path or make a route) |
05, Scripted input |
Start Mac runs with the Metal performance HUD (DM_METAL_HUD=1). A new title starts from the checklist and 03.
2. When something is wrong
- Search the symptom index for the
[RED]line, abort text or what you see; it leads to the reference entry and the games it was found on. - Crashes: the host's
CRASH sig=…report, the macOS crash report, lldb scripts, Ghidra / objdump on the rewritten modules: 05. - Hangs and threads:
DM_WATCH=<s>/DM_WATCH_STALL=<s>dump every thread (03, Reading the log);DM_THR=1,DM_SVC=1,DM_FS=1log thread SVCs, memory SVCs and file opens;sample/xctracename the guest threads during a hitch (05);DM_HLECOUNT=<file>counts every HLE function and SVC the game called. - Guest state without a debugger:
DM_PROBEand its watch and heap variants (05). - Wrong picture:
DM_NVN_SHOTscreenshots,DM_NVN_PASSDUMP(every pass, its attachments, bindings and draw state),DM_NVN_TEXDUMP/DM_NVN_TEXSNAP(render targets as PNG),DM_NVN_CBDUMP(uniform buffers, vertex streams),DM_NVN_HILITE/DM_NVN_DEPTHOVR/DM_NVN_SKIP_FS(isolate a draw),DM_NVN_KEYDUMPandDM_NVN_MAGSCANon the phone: 04, Diagnostic switches and 05, Intermittent rendering glitches. - Slow frames: the
[longframe]lines and the hitch dump (DM_HITCH_DUMP), pipeline compile waits (05), GPU time per pass (DM_NVN_GPUPROF,DM_ABA/B phases,DM_GPU_CAPTUREfor Xcode; read withdm/tools/gpuprof.py): 05, GPU time on the device. Attachment traffic:dm/gfx/tools/tbdr_*.pyover a pass dump. - Memory: the host's memory line,
footprint,vmmap,DM_NVN_ALLOCPROF=1: 05, Memory growth. - Shaders:
dm/gfx/tools/shader_regressions.py(shaders that built in the previous chain and fail now), the build log's[RED] lost without failingline,DM_NVN_SHDUMP(programs missing from the map), the offline link check (05). - On the iPhone: switches in
Documents/env.txt, results inDocuments/log.txt(05, On-device diagnostics). - Game updates and fixed addresses:
dm/tools/nso_fnmap.py,nso_syms.py,insn_census.py,sdis.py,nso2elf.py(Tools).
3. Measuring
scripts/bench.py <id>_build --route <name> runs a route of the profile's bench.tsv from a fixed save and gives frame-time percentiles, GPU time and screenshots; variants (--variant) compare two hosts, shader libraries or sets of switches in one invocation, which is the only comparison it supports (A benchmark on the Mac). Power and energy per frame: Power. Pass --lock <file> when other agents or people measure on the same Mac: the lock is held only while a game runs, and heavy builds should wait for it.
4. Checking a change on every game: scripts/regress.py
One chain and one host serve every profile, and each contributor owns only some games (GitHub issue #272). scripts/regress.py compares a baseline revision (by default the merge base with main) with a candidate (by default this checkout, uncommitted files included) on every game the Mac has a --platform mac build of. Its shader count uses the rule of shader_regressions.py, which the NSP script applies to a game you rebuild; the harness adds the other games, the MSL, the pipeline interface and a run. Full description: The regression harness.
| Command | What runs | Cost |
|---|---|---|
regress.py chain |
Static: each revision's shader build, compared shader by shader (built or failed, MSL / reflection / variant hashes), and the vertex / pixel interface of the pipeline archive's bases (issue #283) | nothing when the chain did not change; a changed chain translates every shader again (14 min for Breath of the Wild's 19,592 on an M2 Max) |
regress.py check --quick |
The above plus a short boot per game: the route's quick seconds, no pipeline prebuild |
about a minute per game and run |
regress.py check |
The whole route with the pipeline prebuild first (DM_PSO_PREBUILD=tool) under a watchdog |
Breath of the Wild about 5 min, Tears of the Kingdom about 7 |
regress.py replay |
Each game's current frame capture replayed by both revisions' nvn_replay with their own shader libraries, compared with the live frame within twice the capture's noise; regress.py capture --rev main records the capture (the route's capture frame) and measures its noise (Frame capture and replay) |
seconds per game once the replayers and chains are built; checks the replay layer only (nvn_mtl.m and below) |
regress.py baseline --rev main --runs 2 |
Records a baseline (a missing one is recorded by check itself); two runs give the noise |
as check, per run |
The routes are dm/games/<id>/smoke.tsv; a game without one takes part in the chain checks only. Add one when you own a game: a fixed save, the presses that load it (written by hand, or played once with DM_REC and joined to one line), screenshots only while the player stands (where a walk ends moves from run to run), and the frame it must reach.
Add --record to the check on your games (check --record, or baseline --record) and commit the dm/games/<id>/validated.tsv it writes with the pull request: it shows which chain each game was last green on (regress.py list prints it). A record needs PASS or CHANGED and successful boot runs, even when the baseline has the same boot failure. Derived build profiles do not validate repository profiles. The report is saved before the metadata is written. Without --record the harness changes nothing in dm/games.
NVN smoke runs also compare the observed depth mode with the profile's depth_mode, even without an archive in quick mode, and detect a bundled archive rejected for a stamp mismatch. See archive/profile depth mismatches. Missing runtime observations remain unknown.
Reading the report (report.md beside report.json in <root>/reports/): one row per game, then the details. PASS and CHANGED (MSL or numbers moved, nothing worse) exit 0; NEW-FAIL (a shader, the interface check, a crash, a hang or the frame that worked in the baseline fails, or a shader lost more without failing) and REGRESSION (new [RED] lines, a screenshot, frame time, memory or prepare time beyond the tolerances) exit 1; ERROR (the harness could not check a game) exits 2. Failures the baseline has too are listed as known and do not fail the check. Changed MSL is expected after a chain change: say in the pull request why it changed. A screenshot difference may be a fix: look at the run's screenshots in <NSP folder>/<id>-work/regress/runs/ before calling it either. The report holds only numbers, hashes, shader keys and normalized [RED] texts, so it can be pasted as it is.
5. Which games a change can reach: usage manifests and regress.py impact
regress.py checks only the games on your Mac. For the others, each profile can carry a usage manifest, dm/games/<id>/usage.tsv, written by someone who owns the game with python3 scripts/regress.py usage --games <id> --write: the features of its translated shaders (stages, binding kinds, image and buffer atomics, transform feedback, layer and integer outputs, translator notes, texture types), and from one run of its smoke route the NVN functions, HLE functions and SVCs it called, its present path and its profile keys. It holds names and counts only.
python3 scripts/regress.py impact <base>..<head> (or one commit) maps a change to those names: the functions around its changed lines, followed through the host's callers to the NVN entry points and HLE functions they serve, and the rules of dm/tools/impact_map.tsv (a file, or functions in it, to manifest rows: dmsh_atomic.py to the image atomic features, the prepare-step functions of nvn_mtl.m to the games that run it). It lists the games that use what the change touches, those reached only through a broad rule (every game of the API), and the profiles without a manifest as unknown. It reads only git and the committed manifests, so it needs neither game files nor a harness root: the report is printed, and written as impact.md and impact.json to --out or, when there is one, <root>/reports/. Run it before a change to the chain or host, and run regress.py check on the games it names that you have; ask their owners for the others. A changed file no rule maps is listed: add a rule for it.
6. Continuous integration
.github/workflows/tests.yml runs on every pull request: the host's unit tests and ThreadSanitizer targets, the host and CPU texture tests again under ASan, UBSan and TSan (a ratchet over the findings listed in dm/sanitizers/: make -C dm/host/tests GAME=<id> asan tsan-threads and make -C dm/gfx/tex/tests asan locally), line coverage of those tests and the tool tests with the diff coverage of the pull request in the job summary (report only; make coverage in both folders and dm/tools/coverage_report.py locally), the CPU-only graphics tests, the Python tool tests (dm/tools/tests, dm/ios/tests, dm/gfx/tests) including the translator's synthetic-shader tests, Mac host builds for an NVN, a Vulkan and an OpenGL profile, and the iOS source compile and smoke project (Continuous integration). .github/workflows/fuzz.yml fuzzes the file parsers nightly from synthetic seeds; a change to a parser in romfs.py, nacp.py, shader_split.py or uepak.py can run its harness locally (dm/tools/fuzz/fuzz_<parser>.py --time 300). GitHub's Macs have no Metal 4 and no game files, so these stay local: make -C dm/gfx/tests GAME=<id> run (the Metal graphics tests), the translator tests with DMSH_TEST_METAL=1 / DMSH_TEST_GPU=1, profile_guess.py --check, and everything regress.py does.
7. Before you open a pull request
By what the change touches (the largest that applies):
- Docs only:
python3 -m unittest dm/tools/tests/test_docs.py; after a change todocs/reference,python3 dm/tools/docs_symptoms.py. - A Python tool or script (
scripts/, the tools underdm/): the ratchetlint-python.ymlruns, ruff and pyright with no new finding:<venv>/bin/python3 dm/tools/lint_python.py, from a venv with.github/requirements/lint.txtinstalled, kept on the drive of the NSP folders, not in the home folder (Continuous integration). The system Python has neither tool, and the check stops at a[RED]line there: that is not a pass. A generated page (docs_*.py) is compared in CI on a clean checkout, so it must not read untracked or git-ignored files such asdm/host/gen. - One game's profile or note (
dm/games/<id>/): the Python tool tests; a full shader build of that game after a change to its shader inputs; the game on the Mac (or the iPhone) along its route, withscripts/bench.pynumbers when the change is about speed; the finding in the game's note (AGENTS.md). - The host, the chain or the tools (
dm/host,dm/gfx,dm/tools,dm/gfx/tools,dm/ios,scripts): everything above,make -C dm/gfx/tests GAME=<id> run,dmsh_chain.py --headerafter a chain change,python3 scripts/regress.py impact main..HEADto see which games it reaches, thenpython3 scripts/regress.py check --games <ids>(--quickwhile iterating, the full run before the pull request), and itsreport.mdpasted into the pull request with a word on everyCHANGED,NEW-FAILorREGRESSION. Choose the games, not every local one: the five the change is most likely to reach or break (thoseimpactnames, then games that cover the APIs, engines and paths it touches). Take more than five only when the change truly needs them (a broad chain or host change no five games cover), and fewer when its reach is narrow and clear (a fix on one game's path, a tool only some games use). Name the games the report covers and why you chose them: the others are unchecked. After a change to C or Objective-C indm/hostordm/gfx,dm/tools/lint_c.py compdbandtidywith LLVM's release run what thelint-cworkflow runs: no new finding (fix it, or// NOLINT(<check>)with a reason on a false positive), andtidy --updateafter fixing one (Continuous integration).
8. Commit messages
A commit on main is read as one line in git log --oneline and GitHub's commit list, so that line says where the change lands and what it does, in the form most systems projects use (Linux, Git, Go, QEMU, Wine), and the full account goes below it:
host/movie: keep inputs sent after end of stream unread (PR #1938)
A movie decoder keeps input buffers sent after end of stream instead of decoding them, as ACodec does: … (the symptom, the cause, the change, what was checked and what was not)
Co-authored-by: …
-
The first line is
area/component: summary(the component is optional), at most 72 characters, without a full stop; the summary starts lowercase unless its first word is a name. A pull request's title takes the same form. -
The area is one name from the table: where the change lands, that is where the cause was fixed. The tests, reference entries and regenerated files that go with it do not count, and a commit that holds two independent changes is two commits. The names are the labels
dm/tools/pr_areas.pygives pull requests (COMMIT_AREAS), so a commit and its pull request share one vocabulary; a new part of nxnative gets its row inAREASand here (test_pr_areascompares the two).Area What changed hostThe Horizon host: SVCs, services, threads, memory, input ( dm/host)nvnNVN on Metal and the graphics tests ( dm/gfx/nvn,dm/gfx/tests)vulkanVulkan on Metal ( dm/gfx/vk)openglNVIDIA's desktop OpenGL on Metal ( dm/gfx/gl)texturesTexture layouts and formats ( dm/gfx/tex)chainThe shader chain ( DMSH_CHAIN's files; theshader chainlabel): every game's shaders are rebuiltrewriterThe NSO rewriter and per-build patches ( patch_nso.py,sdk_patches.py, a profile'spatches.py)packingThe NSP script, extraction, the shader split, the packers iosThe iPhone and iPad app ( dm/ios)macThe Mac front end and app ( dm/mac,front_mac.m)toolsTools and scripts ( dm/tools,scripts)docsDocumentation, when the commit is nothing else ciContinuous integration and repository settings ( .github)gameOne game's profile or note ( dm/games/<id>/); the summary opens with the game's name from the games table, a long one without its series (game: Tears of the Kingdom …) -
The component comes from the code, never from a list: the service's file in the host (
hle_movie.c:host/movie), the tool (tools/regress), the NVN object or step (nvn/present). When unsure, use whatgit log --no-merges -- <files>already shows. -
A general fix found on one game takes the area where it lands and names the game in the body;
gameis for a change only that game sees. -
No kind prefix (
fix:,feat:,ADD:): the summary's verb says what kind of change it is, and the body says whether it fixes the cause or works around it. -
The body, after a blank line, is as long as it needs. Lines of their own at the end:
Front-ends:(Following main),Fixes #Nonly when the push should close the issue,Co-authored-by:. A pull request taken in is named asPR #Nin the first line or the body, wheredm/tools/triage_report.pyfinds it.