diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:26:00 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:26:00 -0500 |
| commit | 154e4ec034902deffa4b89b2cbca9a949f38baec (patch) | |
| tree | 1b2ef5656de42c172291bc6009efa4c510650815 /docs/boot.md | |
| parent | eb6a08cd359d98b5777e70d54d0ae8a75879495a (diff) | |
| parent | 8a242efebf823aeb23c72d17c3d666daf0bbd3e2 (diff) | |
Merge the #984 result (main + RT-PROTON-STORY-LOAD) into #939
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by
one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the
two solve one problem in two ways the base's is the frame and #939's plugs into it.
A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions
ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's
proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease,
raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages),
the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's
duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in.
A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow
#939's rule that a device which ever had a handler has no queue fallback.
B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h,
pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile
and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps
the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad
lists as triangle indices.
B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list,
shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where
both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch,
executable shaders, default A8 views).
C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h,
rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp,
replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its
rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the
label fence on the base's submit.
D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test,
main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with
#939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's
answering first; --first-run-ui kept without host speech in its profile.
E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py,
scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's
v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the
base's executable-shader step with #939's cache fix; 366 registered tests.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'docs/boot.md')
| -rw-r--r-- | docs/boot.md | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/docs/boot.md b/docs/boot.md index aa9fdcc98..2b7186e30 100644 --- a/docs/boot.md +++ b/docs/boot.md | |||
| @@ -25,8 +25,11 @@ Two traces are written independently: | |||
| 25 | 25 | ||
| 26 | `tools/boot_trace.py` reads both and prints the triage units: modules, unimplemented calls and callers, | 26 | `tools/boot_trace.py` reads both and prints the triage units: modules, unimplemented calls and callers, |
| 27 | DllMain/TLS results, exceptions with their stack frames, the exit, and the D3D12 calls by outcome and first call | 27 | DllMain/TLS results, exceptions with their stack frames, the exit, and the D3D12 calls by outcome and first call |
| 28 | per method. The `[rt]` lines in the same stderr log carry the device parameters, feature ids and warnings; the | 28 | per method. When `XboxPresentation` logs its teardown `[rt] present: pacing summary ...` line (BL-6), the D3D12 |
| 29 | summary leaves them as a count, so grep `^\[rt\]` for those. | 29 | summary also reports the frame count, interval count, target interval, mean and drift against target, `p50`/`p95`/`p99` |
| 30 | frame times, and `p50`/`p95`/`p99` origin-to-present latencies (and includes the numeric `frame_pacing` object in | ||
| 31 | `--json` and `--counts-only`). The remaining `[rt]` lines in the same stderr log carry the device parameters, feature | ||
| 32 | ids and warnings; the summary leaves them as a count, so grep `^\[rt\]` for those. | ||
| 30 | 33 | ||
| 31 | For `xmem_physical_pages`, the shim records the first request for each distinct attribute word. The text and | 34 | For `xmem_physical_pages`, the shim records the first request for each distinct attribute word. The text and |
| 32 | JSON summaries list the API, raw attribute word, requested page count and caller for the first `--limit` | 35 | JSON summaries list the API, raw attribute word, requested page count and caller for the first `--limit` |
| @@ -71,10 +74,17 @@ wine runtime/build/windows/gta6rt.exe --run /path/to/game_scarlett_master.exe \ | |||
| 71 | python3 -I tools/boot_trace.py /tmp/boot.jsonl --d3d12 /tmp/d3d12.log | 74 | python3 -I tools/boot_trace.py /tmp/boot.jsonl --d3d12 /tmp/d3d12.log |
| 72 | ``` | 75 | ``` |
| 73 | 76 | ||
| 77 | `runtime\build\gta6rt.exe` is where `scripts\build_runtime.ps1` (Ninja) puts it; the direct CMake path in | ||
| 78 | [runtime/README.md](../runtime/README.md) uses the multi-config Visual Studio generator, which writes | ||
| 79 | `runtime\build\RelWithDebInfo\gta6rt.exe` instead. | ||
| 80 | |||
| 74 | `--trace FILE` **refuses an existing file** (exit 2): it is created before the loader reads anything, so use a | 81 | `--trace FILE` **refuses an existing file** (exit 2): it is created before the loader reads anything, so use a |
| 75 | fresh name or delete the old one. `LEONIDA_D3D12=vulkan` selects the Vulkan-backed device, the only backend that | 82 | fresh name or delete the old one. `LEONIDA_D3D12=vulkan` selects the Vulkan-backed device, the only backend that |
| 76 | writes the `[d3d12-trace]` lines; without it the layer uses the Windows D3D12 device and the trace has nothing to | 83 | traces command lists, resources and pipelines; without it the layer uses the Windows D3D12 device, and the |
| 77 | read. Keep the traces out of the repository: they can quote whatever the game prints. | 84 | `[d3d12-trace]` lines are only what the Xbox-ABI proxy forwards (device creation, queue, fence and allocator |
| 85 | calls), which `boot_trace.py` summarizes without complaint. A run on the Vulkan device prints | ||
| 86 | `[rt] d3d12: Vulkan device: <name>`; check the log for it (a runtime built without the Vulkan headers accepts the | ||
| 87 | variable and stays on the Windows device). Keep the traces out of the repository: they can quote whatever the game prints. | ||
| 78 | 88 | ||
| 79 | Useful switches: | 89 | Useful switches: |
| 80 | 90 | ||
| @@ -90,12 +100,29 @@ Useful switches: | |||
| 90 | `int3_skipped` event, so a boot can be followed past soft asserts (an int3 followed by code that carries on). | 100 | `int3_skipped` event, so a boot can be followed past soft asserts (an int3 followed by code that carries on). |
| 91 | Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file | 101 | Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file |
| 92 | open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on. | 102 | open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on. |
| 103 | * `LEONIDA_STUB_PIPELINES=1` creates a pipeline whose translated shader is missing (no shader library, or no entry | ||
| 104 | for its program) as a no-op stub instead of failing `CreateGraphicsPipelineState` / `CreateComputePipelineState`. | ||
| 105 | The stub is never registered, so `SetPipelineState` binds no PSO and its draws and dispatches are no-ops (D3D-482). | ||
| 106 | Diagnostic only, like `LEONIDA_SKIP_INT3`: it follows a boot past every pipeline the title creates without | ||
| 107 | translating or running a game shader, so nothing the title draws reaches the screen. Each stub is logged with a | ||
| 108 | power-of-two count. | ||
| 109 | * During `--run` on Vulkan, the runtime paints the package shell splash when the title shows its window. The first | ||
| 110 | direct queue presents it on the window's swapchain. Startup clears keep the splash visible until the first | ||
| 111 | non-black output replaces it. The runtime reads `ShellVisuals/SplashScreenImage` from | ||
| 112 | `MicrosoftGame.Config` or `SplashScreen/Image` from `appxmanifest.xml`, preserves the image's aspect ratio and | ||
| 113 | uses the same swapchain for PresentX. A surface without readback hands off at the first title present. | ||
| 114 | Set `LEONIDA_PACKAGE_SPLASH=0` to disable the splash. | ||
| 93 | * `LEONIDA_VK_VALIDATION=1` enables the Khronos validation layer with the Vulkan backend (startup overhead; it is a | 115 | * `LEONIDA_VK_VALIDATION=1` enables the Khronos validation layer with the Vulkan backend (startup overhead; it is a |
| 94 | diagnostic). | 116 | diagnostic). |
| 117 | * `LEONIDA_DEVICE_FAULT=1` enables Vulkan device-loss diagnostics and checkpoints where available. The first | ||
| 118 | observed loss prints a `[rt] device-fault:` report to stderr. | ||
| 95 | * `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their | 119 | * `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` when MSI Afterburner or OBS is installed; their |
| 96 | implicit layers add swapchain usage that shows up as validation errors ([testing.md](testing.md), "Known | 120 | implicit layers add swapchain usage that shows up as validation errors ([testing.md](testing.md), "Known |
| 97 | problems"). | 121 | problems"). |
| 98 | * `--overlay DIR` sends the guest's writes to a private folder instead of the package. | 122 | * `--overlay DIR` sends the guest's writes to DIR instead of the default `<game-dir>\overlay` (useful when the |
| 123 | package drive is read-only); the package itself is never written. Set `LEONIDA_WRITE_DIR` to override that folder | ||
| 124 | for one run (it wins over `--overlay`). For a fresh first-run profile, also set `LEONIDA_SAVE_DIR` to a separate | ||
| 125 | empty directory for the local game-save provider. | ||
| 99 | 126 | ||
| 100 | ## 3. Triage order | 127 | ## 3. Triage order |
| 101 | 128 | ||
| @@ -110,13 +137,25 @@ Read the startup trace first; the first event that is not the expected one is th | |||
| 110 | TLS index. The summary shows the address and phase of the last observed TLS callback | 137 | TLS index. The summary shows the address and phase of the last observed TLS callback |
| 111 | (`last_tls_callback` in JSON). The loader records it before invoking the callback, so the record gives no | 138 | (`last_tls_callback` in JSON). The loader records it before invoking the callback, so the record gives no |
| 112 | completion result. The loader's own TLS is checked by `run_tiny_game_tls`. | 139 | completion result. The loader's own TLS is checked by `run_tiny_game_tls`. |
| 140 | An access violation in CRT startup before the first D3D12 call can be the TLS index instead: code built with | ||
| 141 | `/GA` reads its thread-local data at module index 0 without `_tls_index`, and index 0 belongs to `gta6rt.exe` | ||
| 142 | (stop 4 of [retail_boot_chain.md](retail_boot_chain.md)). `load()` rewrites those reads in a mapped executable | ||
| 143 | so that they reach the image's own block, and every other mapped module with a TLS directory has an index of | ||
| 144 | its own ([`runtime/README.md`](../runtime/README.md), "PE loader"). The stderr log has one | ||
| 145 | `[rt] loader: <image>: <N> index-0 TLS reads` line for the executable; `N` 0 on an image that faults there | ||
| 146 | means its reads have a shape the rewrite does not know. `LEONIDA_TLS_GA_PATCH=0` turns the rewrite off, to | ||
| 147 | see the stop without it. `loader_tls` checks both ways with a synthetic `/GA` executable mapped beside a DLL | ||
| 148 | that has TLS of its own, on the loading thread and on a new one, and `run_tiny_game_ga_tls` runs a `/GA` | ||
| 149 | build of the stand-in game through `gta6rt --run`. Not confirmed here on the retail executable: that needs | ||
| 150 | game files. | ||
| 113 | 4. **`exception`** — code, `at`, access/address and the stack frames. The loader's vectored handler only records, | 151 | 4. **`exception`** — code, `at`, access/address and the stack frames. The loader's vectored handler only records, |
| 114 | so the process behaviour is the same with or without the trace. When the report reaches `--limit`, it reserves | 152 | so the process behaviour is the same with or without the trace. When the report reaches `--limit`, it reserves |
| 115 | the final slot for the last observed exception. The trace also includes handled exceptions, so the last | 153 | the final slot for the last observed exception. The trace also includes handled exceptions, so the last |
| 116 | observation alone does not establish what caused the run to stop. | 154 | observation alone does not establish what caused the run to stop. |
| 117 | 5. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace. | 155 | 5. **`exit` / `error`** — a clean exit is not a correct frame; continue to the D3D12 trace. |
| 118 | 6. **D3D12 trace** — the `failed`, `unsupported`, `refused` and `partial` lines name the method. A `partial` | 156 | 6. **D3D12 trace** — the `failed`, `unsupported` and `refused` lines name the method. A `failed` |
| 119 | submission ran the supported commands from a list. The runtime's `[rt]` diagnostic names the command it left out. | 157 | `ExecuteCommandLists` submitted nothing from its lists. (`boot_trace.py` also lists a `partial` outcome, a |
| 158 | submission that ran only the supported commands; the runtime does not write it yet.) | ||
| 120 | Compare the method's position with the public SDK vtable. An unknown slot is expected until the executable names it | 159 | Compare the method's position with the public SDK vtable. An unknown slot is expected until the executable names it |
| 121 | (Q2, Q6). The `[rt]` lines in the same log carry the 24 device words, feature IDs and warnings. | 160 | (Q2, Q6). The `[rt]` lines in the same log carry the 24 device words, feature IDs and warnings. |
| 122 | The summary expects `#1` first, then one more than the last observed number. It counts each mismatch once and | 161 | The summary expects `#1` first, then one more than the last observed number. It counts each mismatch once and |
| @@ -135,8 +174,8 @@ is `null`; if neither input yields a report, stdout is empty. | |||
| 135 | 174 | ||
| 136 | ## 4. The open questions, and the trace signal for each | 175 | ## 4. The open questions, and the trace signal for each |
| 137 | 176 | ||
| 138 | The questions are in [`d3d12_vulkan.md`](d3d12_vulkan.md) §8.2; that table repeats 16, 19 and 20, and this one is | 177 | The questions are in [`d3d12_vulkan.md`](d3d12_vulkan.md) §8.2; this table takes the same 1–22 in |
| 139 | the de-duplicated 1–22. It maps each question to the event to look for; it does not answer them. | 178 | order. It maps each question to the event to look for; it does not answer them. |
| 140 | 179 | ||
| 141 | | # | Question | Signal in the first trace | | 180 | | # | Question | Signal in the first trace | |
| 142 | |---|---|---| | 181 | |---|---|---| |
| @@ -177,5 +216,6 @@ the de-duplicated 1–22. It maps each question to the event to look for; it doe | |||
| 177 | The retail executable is not in the package, so this page is untested against it; the tool and the trace formats | 216 | The retail executable is not in the package, so this page is untested against it; the tool and the trace formats |
| 178 | are tested on synthetic fixtures and on `tiny_game` (which has no D3D12 calls). The present slots (Q6) and the | 217 | are tested on synthetic fixtures and on `tiny_game` (which has no D3D12 calls). The present slots (Q6) and the |
| 179 | Xbox device parameters (Q1) remain the first things the executable itself has to name. The D3D12 trace needs the | 218 | Xbox device parameters (Q1) remain the first things the executable itself has to name. The D3D12 trace needs the |
| 180 | Vulkan backend; a build without it runs the game's calls through the PC device and records nothing. The runbook | 219 | Vulkan backend; a build without it runs the game's calls through the PC device and records only the proxy's |
| 220 | device, queue, fence and allocator calls. The runbook | ||
| 181 | does not make the game boot; it makes the first real trace readable. | 221 | does not make the game boot; it makes the first real trace readable. |