upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNotRexed <therealnothingfn@gmail.com>2026-11-30 17:11:06 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-11-30 17:11:06 -0500
commitb1f91c2f938fa9f4e082d612f412a0c57a8e3b87 (patch)
treea11f74f14cb748725dab211a358da053428d6309 /docs
parent2c4f423ee565c73a3f9eb3f88870ba774ccb289a (diff)
parent407f71a237de5293d1d373620d2173943ee1a499 (diff)
Merge remote-tracking branch 'origin/main' into push/main-1130
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md1
-rw-r--r--docs/game_gate.md100
-rw-r--r--docs/lua-modding.md33
-rw-r--r--docs/measuring_fps.md8
4 files changed, 141 insertions, 1 deletions
diff --git a/docs/README.md b/docs/README.md
index 435291599..1bc9ffcbb 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -125,6 +125,7 @@ method, scope and caveats. No game data is included.
125 125
126| Document | What it covers | 126| Document | What it covers |
127|---|---| 127|---|---|
128| [game_gate.md](game_gate.md) | The in-game gate for the D3D12 runtime: one command runs the game a set time in the world, stops it cleanly and writes `summary.json` (PASS/FAIL/ERROR, time to the world, warm cache, fps, crashes), the same on every machine. |
128| [measuring_fps.md](measuring_fps.md) | How to measure frame rates of the D3D12 runtime (`d3d12/`): look in the findings first, turn a switch inside one run with `LEONIDA_AB`, separate runs, which log number means what, what to write before reporting a cause. | 129| [measuring_fps.md](measuring_fps.md) | How to measure frame rates of the D3D12 runtime (`d3d12/`): look in the findings first, turn a switch inside one run with `LEONIDA_AB`, separate runs, which log number means what, what to write before reporting a cause. |
129| [d3d12/docs/findings.md](../d3d12/docs/findings.md) | What was measured of the D3D12 runtime's frame on several PCs: where a frame goes, switches by turns with their spread, what was not worth it, picture faults and what they were. | 130| [d3d12/docs/findings.md](../d3d12/docs/findings.md) | What was measured of the D3D12 runtime's frame on several PCs: where a frame goes, switches by turns with their spread, what was not worth it, picture faults and what they were. |
130| [d3d12/docs/switches.md](../d3d12/docs/switches.md) | The `LEONIDA_*` variables the D3D12 runtime names, made from its sources (`tools/d3d12_switches.py`): how each is read, whether `LEONIDA_AB` can turn it, the sentence of the code's comment. | 131| [d3d12/docs/switches.md](../d3d12/docs/switches.md) | The `LEONIDA_*` variables the D3D12 runtime names, made from its sources (`tools/d3d12_switches.py`): how each is read, whether `LEONIDA_AB` can turn it, the sentence of the code's comment. |
diff --git a/docs/game_gate.md b/docs/game_gate.md
new file mode 100644
index 000000000..4bb6c372d
--- /dev/null
+++ b/docs/game_gate.md
@@ -0,0 +1,100 @@
1# The in-game gate
2
3One command runs the D3D12 runtime (`leonida.exe`) in the game for a set time in the world and says PASS, FAIL or ERROR. The same way on every machine. It is what a change to the render path needs before merge ("300 s in the world, no device loss"). It also gives the numbers an A/B compares: one `summary.json` per run, in one format.
4
5The script is `scripts/game-gate.ps1` (Windows, PowerShell 7). The parser is `tools/game_gate.py` (standard library only). The tests are in `tests/test_game_gate.py`.
6
7## Running it
8
9Build the runtime first (`d3d12\scripts\build-nvidia.ps1`). The gate refuses to start without `d3d12\target\diag\leonida.exe`, because the play script would build it inside the timed run.
10
11Make a data template once:
121. Play to the place the runs should start from.
132. Let the title save, and close the game cleanly.
143. Copy `<Data>\data\<title id>` (its `saves` and `storage`) into a folder outside the checkout.
15
16Each run gets a copy of it, so your own saves are never touched. A save is game data: never share or commit it.
17
18```powershell
19pwsh -NoProfile -File scripts\game-gate.ps1 run -Game <game folder> -Data <data folder> -DataTemplate <template> `
20 -Name base [-PlayArgs '<play-d3d12.ps1 switches>'] [-More 'LEONIDA_X=1;LEONIDA_KEYS=40:Enter,60:Enter'] [-WorldSeconds 300]
21pwsh -NoProfile -File scripts\game-gate.ps1 start <same options> # detached: returns at once, prints the run folder
22pwsh -NoProfile -File scripts\game-gate.ps1 stop -RunDir <run folder>
23```
24
25- **The play script's switches.** `-PlayArgs` passes them on as they are, for example `-SeriesS -NoFrameGen`.
26- **Reaching the world.** The gate does not drive the menus. Pass key presses with `LEONIDA_KEYS`; they are timed from the start of the process, so allow for the precompile.
27- **The caches.** `-Data` keeps its caches (`cache-2`); only the saves are copied. The first start after a translator change translates every shader again: run once before measuring.
28- **Ending the run.** It stops when the time in the world reaches `-WorldSeconds`, when a `STOP` file appears in the run folder (`stop`), or after `-MaxMinutes` (45).
29- **How it stops.** With `WM_SYSCOMMAND`/`SC_CLOSE`, the runtime's own end: the title is suspended and the pipeline cache saved. It kills the game only if it has not ended 60 s later.
30- **Exit code.** 0 PASS, 1 FAIL, 2 ERROR. `start` exits when the detached run is created.
31
32The run folder (under `-RunRoot`, by default `<Data>\gate-runs`, refused inside a checkout) holds:
33
34| File | What |
35| --- | --- |
36| `run.json` | Name, start time, commit, exe hash, build features, card, driver, options |
37| `launch.ps1` | How the game was started |
38| `settings.txt` | The play script's `-DryRun` |
39| `leonida-settings.txt` | The F1 menu file, when there was one (it changes every run, so the summary warns) |
40| `launcher.txt` | The play script's output, with the precompile lines |
41| `leonida.log` | The runtime's log, with `LEONIDA_LOG=info,leonida_gpu::frame=debug` (one line per present) |
42| `events.jsonl` | What the gate did and saw: the game found, the stop asked for and why, a kill, the exit code |
43| `data\` | The run's copy of the template, and the runtime's `crashes.log` |
44| `summary.json` | The result, below |
45
46## summary.json (`leonida-gate-summary/1`)
47
48Times are seconds since the run started. The summary holds numbers, switch names and verdicts only. It never holds a path, a user or machine name, or text the title printed. A fault is told by the kind of module it was in, not by its name or address.
49
50| Field | Meaning |
51| --- | --- |
52| `run` | Name, start time, commit, `dirty` (a tracked file changed), `untracked` (how many files git does not track), exe hash (16 hex), build features, card, driver, play arguments, `world_seconds` |
53| `settings` | The `LEONIDA_*` settings from the runtime's `settings` line, as it shows them (folders hidden). Empty, with a warning, from a runtime without that line |
54| `precompile` | From the launcher: shaders in the cache and the seconds that took, pipelines known, made before, to make, made, their seconds and median ms |
55| `times.world_at_s` | The world: the first of two frame lines in a row with 500 draws a frame or more. Cutscenes count: a save that opens on one is in the world. Like every time here, it counts from the gate's start, so the precompile is in it (its seconds are `precompile.shaders_s` and `precompile.made_s`) |
56| `times.warm_at_s` | From then on, 60 s in the world with no pipeline being made and no wait for one that ran out. Draws dropped for a pipeline the host never has go on all run long and do not count |
57| `times.world_s` | Seconds from `world_at_s` to the stop request |
58| `fps` | From the presents, after the first 60 s in the world: frames, median, p5, frame p95 (ms), median of the last 60 s (`end_median`), the first second with fewer than 2 frames, from 60 s in the world on too (`under_2_at_s`), the longest gap with no frame presented from the world on (`longest_present_gap_s`, `longest_gap_at_s`; on purpose from the world on: a freeze on pipeline compiles comes right after arrival, and 10 s with no frame is what a player sees), draws a frame. Without the present lines (a build without diagnostics), the median and p5 come from the frame lines, with a warning |
59| `pipelines` | Waits that ran out (`missed_waits`), the most pipelines being made at once |
60| `crash` | `kind` is `none`, `device_lost`, `panic` or `fault`. It also gives the time, the code, the module kind (`runtime`, `title`, `driver`, `system`, `unknown`) and the access (read/write). `title_watchdog` marks a write at address 0 in the title more than 25 s after the last frame line. `count` is the number of crashes |
61| `exit` | The game's exit code, and its kind: `clean`, `device_lost` (0x887A0005), `killed` or `other` |
62| `stop` | Why it was stopped (`target`, `stop_file`, `timeout`, `relaunched`), whether it was killed, whether the cache was saved, whether the suspend was in time |
63| `verdict` | `result`, `reasons`, `warnings`, `min_world_s` |
64
65## The verdict
66
67**PASS** needs all of these:
68- at least `-WorldSeconds` (300) in the world;
69- no device loss and no panic;
70- no fault before the stop request;
71- no gap over 10 s with no frame presented once in the world, so a run frozen on a pipeline compile does not pass;
72- the game alive at the stop request: a frame line less than 30 s old.
73
74**FAIL** comes with one or more reasons:
75- `device_lost`: a host GPU failure, an out-of-memory command list that did not close, or exit 0x887A0005;
76- `panic`;
77- `fault_before_stop`;
78- `exited_before_stop`;
79- `present_gap`;
80- `world_time_short`: the time limit came first;
81- `not_alive_at_stop`;
82- `world_not_reached`, when the game ended before reaching the world.
83
84**ERROR** means the gate could not judge the build:
85- `not_started`;
86- `relaunched`: the title restarted itself;
87- `stopped_early`: a STOP file before the time;
88- `world_not_reached`, when the game was still in the menus at the time limit.
89
90A crash after the stop request is a warning, except a device loss or a panic, which stay FAIL. A kill, a cache not saved and a late suspend are warnings too.
91
92## Not in this version
93
94- A driver for the menus and a fixed route (a Lua mod).
95- An ABBA runner over several runs.
96- A time series beside the summary (memory, census, reaping queue).
97- A "memory rising" warning.
98- VRAM and RAM peaks.
99- The distance walked.
100- The Vulkan runtime (`gta6rt`).
diff --git a/docs/lua-modding.md b/docs/lua-modding.md
index 3231797ed..6dbfc92bb 100644
--- a/docs/lua-modding.md
+++ b/docs/lua-modding.md
@@ -188,6 +188,39 @@ go on. A syntax error or a missing script is the same at load. A Rust panic in t
188`"name"` (shown in logs). A folder without `"script"` (an asset mod, `docs/modding.md`) is not a Lua mod and is left 188`"name"` (shown in logs). A folder without `"script"` (an asset mod, `docs/modding.md`) is not a Lua mod and is left
189alone; a mod can have both. Load order is the folder names', sorted. 189alone; a mod can have both. Load order is the folder names', sorted.
190 190
191## The gate's driver mod
192
193`mods/gate_driver` takes a run from the title's menus into the world with no person, for in-game gates and A/Bs. It
194ships disabled: a run enables a copy of it in a mods folder of its own (`LEONIDA_MODS`). It needs
195`LEONIDA_GAME_ACTIONS=1`, for `leonida.player_position()`.
196
197- **The menus.** It presses Enter only once frames have moved on since the last press, every 25 s, until the player's
198 position is known. A start that takes minutes to compile pipelines does not throw its presses away.
199- **Control.** Holding W for 3 s must move the player at least 1 m and at most 30 m. More is the title placing the
200 player itself (a load, a cutscene), not a walk: it tries again (`GATE PROBE ... placed`). Less is a screen that
201 still waits (`GATE PROBE ... still`): it presses once more, at the menus' pace, and tries again.
202- **Limits.** In `idle`, a mark at 0.0 m does not tell a player standing still from one the title holds (a cutscene
203 can start after control and hold the player); `roam` shows it. With a cold pipeline cache the world can take
204 minutes, and the player can stay held: `GATE CONTROL` then comes late, or `GATE FAIL no control` at 900 s.
205- **Then.** `idle` (the default) stands still, for measuring. `roam` walks a fixed loop: W, with short J and L turns
206 (the stand-in pad's right stick turns the camera).
207- **Its log lines.** Through `leonida.log`, the log is also its heartbeat:
208 - `GATE PRESS`, and `GATE PROBE ... placed` or `still` when holding W showed no control;
209 - `GATE CONTROL t=... frame=... moved=... mode=...`;
210 - `GATE MARK t=... frame=... <mode> from_control_m=...`, every 10 s. A cutscene can still follow control: the
211 title moves the player for it, kilometres away, and puts them back after, to 0.0 again in `idle`;
212 - `GATE SHOT`, two screenshots at 10 s and 120 s after control (diagnostics builds), in `LEONIDA_SCREENSHOTS`
213 when set, else beside the runtime;
214 - `GATE FAIL no position` or `GATE FAIL no control`, after 900 s.
215
216 Distances only: never a position.
217- **Its settings.** A `gate.txt` beside the copy sets `mode = roam` and any number of `driver.lua`'s defaults
218 (`give_up = 600`, ...), one a line.
219
220The logic is in `driver.lua`, which takes the calls it uses as an argument. `crates/leonida-lua` tests it on a stub
221with a simulated clock. A route of your own, a saved place to start from and the run's screenshots are game data:
222keep them on your machine.
223
191## What is not here, and why 224## What is not here, and why
192 225
193- `leonida.teleport(x, y, z [, hold_seconds])` (true line, or nil and why) and `leonida.player_position()` (x, y, z) move 226- `leonida.teleport(x, y, z [, hold_seconds])` (true line, or nil and why) and `leonida.player_position()` (x, y, z) move
diff --git a/docs/measuring_fps.md b/docs/measuring_fps.md
index 1a8f902ef..c12087226 100644
--- a/docs/measuring_fps.md
+++ b/docs/measuring_fps.md
@@ -41,7 +41,9 @@ there goes round views of about 24 s with different draw counts, so phases of 15
41Standing, `findings.md` cuts the phases into stretches where the draw count jumps, leaves out the first phase of a 41Standing, `findings.md` cuts the phases into stretches where the draw count jumps, leaves out the first phase of a
42stretch and fits a level for each stretch; walking, the switch of bit *b* has runs of 2^*b* phases off and 2^*b* on: 42stretch and fits a level for each stretch; walking, the switch of bit *b* has runs of 2^*b* phases off and 2^*b* on:
43each pair of neighbouring runs gives one difference, and their mean is the effect. Give the effect **with its standard 43each pair of neighbouring runs gives one difference, and their mean is the effect. Give the effect **with its standard
44error**. The scripts it names for this (`ab_pair.py`, `ab_eff.py`) are not in the repository. 44error**. `python -I tools/d3d12_ab_compare.py phases <log>` does the walking way for every switch of the run (pairs of
45blocks, a pair whose draws a frame differ by more than a tenth left out), for the median frame time and for each
46counter of the `A/B counters` line the runtime writes after a phase line (with `diagnostics`).
45 47
46The standard errors in `findings.md` are mostly 0.2 to 0.6 ms for a standing run of some minutes (up to 0.94) and 1 to 48The standard errors in `findings.md` are mostly 0.2 to 0.6 ms for a standing run of some minutes (up to 0.94) and 1 to
472 ms for a walking one (up to 2.24). Two separate 492 ms for a walking one (up to 2.24). Two separate
@@ -61,6 +63,10 @@ A change of code, or a switch that cannot be turned in play, needs separate runs
61- Check every run for the state you think it was in: it reached the world, it did not stay in the menu, it did not end early. One that 63- Check every run for the state you think it was in: it reached the world, it did not stay in the menu, it did not end early. One that
62 stayed in the menu showed 60 throughout (seen once, 2026-11-30). 64 stayed in the menu showed 60 throughout (seen once, 2026-11-30).
63- With two runs a side, do not claim a difference smaller than the spread between runs of the same side. 65- With two runs a side, do not claim a difference smaller than the spread between runs of the same side.
66- `python -I tools/d3d12_ab_compare.py plan --pairs 4` prints such an order; `abba A:<run> B:<run> B:<run> A:<run> ...`
67 reads the runs in that order (logs, or the game gate's run folders with their `summary.json`): one value a run (its
68 world median frame time), neighbouring pairs, the effect with its standard error and 95 % interval from at least
69 4 balanced pairs, and "B faster" or "B slower" only when the interval leaves 0 out and all pairs but one agree.
64 70
65## 4. Which number means what 71## 4. Which number means what
66 72