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/linux_proton.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/linux_proton.md')
| -rw-r--r-- | docs/linux_proton.md | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/docs/linux_proton.md b/docs/linux_proton.md new file mode 100644 index 000000000..30107cfeb --- /dev/null +++ b/docs/linux_proton.md | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | # Linux (Proton/Wine) and second-machine test report | ||
| 2 | |||
| 3 | This page describes how the runtime is built and booted on Linux through Proton's Wine, what a healthy boot looks | ||
| 4 | like there, and what was observed on the machines that tested this branch (one Linux, two native Windows). It holds | ||
| 5 | counts, timings and settings only: no game data, no traces. | ||
| 6 | |||
| 7 | Status in one line: on Linux/Proton and on native Windows the retail 1.0.2.1 package launches, shows its launch | ||
| 8 | movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its | ||
| 9 | artwork, and enters the world phase. A first world frame has not been verified yet on any of the three machines; what | ||
| 10 | stops it is listed under [Where it stops](#where-it-stops). | ||
| 11 | |||
| 12 | ## Test machines | ||
| 13 | |||
| 14 | | | Linux | Windows A | Windows B | | ||
| 15 | |---|---|---|---| | ||
| 16 | | OS | CachyOS (Arch), kernel 7.3 | Windows 11 | Windows 11 | | ||
| 17 | | Run through | Proton Experimental (Wine 11) | native | native | | ||
| 18 | | CPU | Ryzen 5 5600X | Core i9-13900K | Ryzen 7 9800X3D | | ||
| 19 | | GPU, driver | RTX 4070 12 GB, NVIDIA 620.73 | RTX 4070 Ti 12 GB, NVIDIA 630.20 | RTX 5070 | | ||
| 20 | | RAM | 16 GB (+32 GB swap file) | 64 GB | not reported yet | | ||
| 21 | | Toolchain | clang-cl 23 + xwin SDK, Ninja, ccache | MSVC 2022, SDK 26100 | - | | ||
| 22 | | Results here | yes, ~80 boots on 2026-11-24 | yes | joining; none yet | | ||
| 23 | |||
| 24 | Windows A reaches every stage three to five times faster than the Linux machine (initialisation ~70 s against | ||
| 25 | ~180 s, story load from ~110 s against ~240-300 s), so it is the better machine for iterating on the world phase; | ||
| 26 | the Linux machine is the one that shows what 16 GB of RAM allows. | ||
| 27 | |||
| 28 | ## Building on Linux | ||
| 29 | |||
| 30 | The runtime is a Windows executable. On Linux it is cross-built with clang-cl against an [xwin](https://github.com/Jake-Shadle/xwin) | ||
| 31 | copy of the Windows SDK: | ||
| 32 | |||
| 33 | ```sh | ||
| 34 | scripts/linux-boot/configure-worktree.sh <checkout> # XWIN_DIR=<sdk>, SDL3_SRC=<SDL3 tree> for an offline configure | ||
| 35 | cmake --build <checkout>/runtime/build/boot --target gta6rt -j6 | ||
| 36 | ``` | ||
| 37 | |||
| 38 | `gta6rt_tls_host.dll` is built with the `gta6rt` target and must stay next to the executable. Unit tests are Windows | ||
| 39 | executables too and run under Wine (`scripts/run_wine_tests.py`, or directly with the same `wine` binary and a | ||
| 40 | prefix of their own: sharing the game's prefix with tests breaks its window). | ||
| 41 | |||
| 42 | ## Booting on Linux | ||
| 43 | |||
| 44 | `scripts/linux-boot/boot.sh` is the plain launcher and `run-boot.sh` wraps it as a `systemd --user` unit with a | ||
| 45 | memory sampler, a GPU lock, a build lock (no compile while the game runs) and a digest after the boot. They assume | ||
| 46 | the layout the comments at their top describe (`/opt/leonida` for traces, overlay and caches; the package under | ||
| 47 | `/opt/gta6`); adjust the paths at the top to yours. What matters: | ||
| 48 | |||
| 49 | - **Wine:** Proton Experimental's `files/bin/wine` with its own prefix (`WINEPREFIX`), `WINEDLLOVERRIDES="mscoree,mshtml="`. | ||
| 50 | - **No network:** the title runs inside `unshare -rn` (new user and network namespace). Nothing is online. | ||
| 51 | - **Backend:** `LEONIDA_D3D12=vulkan`, `LEONIDA_SHADERS=<translated library>`. | ||
| 52 | - **NVIDIA shader cache:** `__GL_SHADER_DISK_CACHE_SIZE` raised (the library is ~19 GB of SPIR-V) and | ||
| 53 | `__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1`. | ||
| 54 | - **Input:** a pad through GameInput/SDL3, or the keyboard pad (`LEONIDA_KEYBOARD_PAD=always`), or a script: | ||
| 55 | `LEONIDA_INPUT_SCRIPT=a@210,a@240` presses A at those seconds (any length since this branch; it was cut at 63 | ||
| 56 | characters before). | ||
| 57 | - **Window:** frames are presented in the title's own window; `LEONIDA_PRESENT_WINDOW=own|hidden` chooses otherwise. | ||
| 58 | |||
| 59 | Three setup mistakes each give a blank or empty picture without an error: the executable's embedded shaders missing | ||
| 60 | from the library (`exe/index.json`), a build without SDL3 (no pad), and a BCPack predictor file that was never | ||
| 61 | generated (`tools/build_dstorage_history.py`; without it the loading art and most BC7 textures stay empty). | ||
| 62 | |||
| 63 | ## What a healthy boot looks like (Linux machine) | ||
| 64 | |||
| 65 | | Time | Stage | | ||
| 66 | |---|---| | ||
| 67 | | 0-10 s | package splash | | ||
| 68 | | ~60-90 s | launch movie, then the landing prompt appears while initialisation finishes | | ||
| 69 | | ~180 s | initialisation done; A is accepted | | ||
| 70 | | ~240-300 s | story load starts: loading slideshow with its artwork | | ||
| 71 | | ~540-630 s | story load ends (about 38,000 streamed images registered), world phase begins | | ||
| 72 | |||
| 73 | On Windows A the same stages are at ~70 s, ~110 s and ~190 s. | ||
| 74 | |||
| 75 | ## What this branch changes to get there | ||
| 76 | |||
| 77 | Each item was a stop on at least one of the machines. Tests named in the pull request cover them. | ||
| 78 | |||
| 79 | - **Presentation:** frames go to the title's own window (they went to a window that was never shown). | ||
| 80 | - **DirectStorage:** reads pin write-watched destination pages, page-list scatter/gather, BCPack and unshuffle, a | ||
| 81 | locally generated predictor file, bounded staging. | ||
| 82 | - **Story-load allocation stall:** one device allocation per streamed texture exhausted the driver's CPU-visible | ||
| 83 | mappings near 16,000 images; small streamed images now share pooled pages. | ||
| 84 | - **Images on plain device-local memory:** host-copy usage excluded it on NVIDIA and 4.8 GB of images spilled into | ||
| 85 | host memory; streamed images are now filled through staging. | ||
| 86 | - **Deferred backing:** placed and streamed images get private memory at their first write or GPU copy. VRAM at the | ||
| 87 | end of the load went from 11.8 GB to ~5 GB on Linux; on Windows A host private memory went from 22-24 GB to 11.9 GB. | ||
| 88 | - **Enhanced barrier into `LAYOUT_UNDEFINED`:** accepted; it failed `Close`, which the title treats as fatal. | ||
| 89 | - **Bindless table:** a table rebuild that cannot allocate no longer refuses the whole submission; larger image | ||
| 90 | arrays; a hash finalizer for the descriptor table (runtime and translator halves, off until a library carries it). | ||
| 91 | - **Translator:** loop bounds on every emitted loop (5,128 compute modules have loops), the eight FidelityFX programs | ||
| 92 | that used an instruction form the disassembler skips (all 29 translate), buffer bounds modes per view kind. | ||
| 93 | - **Directly indexed descriptor heaps:** the heap offset is supplied in the user-data dword after the explicit root | ||
| 94 | arguments for compute and for VS/PS/GS draws. Mesh stages are not covered yet. | ||
| 95 | - **Title buffers at raw addresses:** a window outside the arena when title reservations fragment it; opt-in | ||
| 96 | persistent device-local copies of streamed buffer views. | ||
| 97 | - **Native Windows:** write faults on shared pages retried under the tracker lock, one tracker per run of shared | ||
| 98 | pages, write-watched title memory, a fault-lock that never waits for the process heap. | ||
| 99 | - **Diagnostics:** device-loss report with the last dispatches and NVIDIA checkpoints, a probe for the descriptors a | ||
| 100 | compute dispatch receives, memory probe, press log. All off by default. | ||
| 101 | |||
| 102 | ## Where it stops | ||
| 103 | |||
| 104 | - **Streamed memory that never reaches its destination.** The title calls queue slot 31 (`CopyPageMappingsBatchX`) | ||
| 105 | about 300 times per boot and this branch still ignores it; tens of thousands of streamed views wait for memory | ||
| 106 | that never becomes readable. An open pull request in this repository implements it. | ||
| 107 | - **Culling compute at world start** reads buffers named by descriptors in the directly indexed heap; with the | ||
| 108 | point above unfixed those reads leave mapped memory and the device is lost (NVIDIA Xid 13/109 on Linux). | ||
| 109 | - **Mesh stages** do not get the heap offset yet. | ||
| 110 | - **16 GB of RAM:** at the end of the load the process holds ~14.6 GB (RAM plus swap) on the Linux machine after the | ||
| 111 | cuts above. zram made this worse (compressed pages still occupy RAM); a swap file on disk is the better choice. | ||
| 112 | - **Initialisation takes ~180 s under Proton** against ~70 s natively. Not investigated. | ||
| 113 | - **Under Wine** a thread that takes an access violation while holding the process heap lock can still deadlock | ||
| 114 | with xmem's fault handler; the test for it is skipped there. | ||
| 115 | |||
| 116 | ## Reporting a result | ||
| 117 | |||
| 118 | Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and | ||
| 119 | counts: presents, the last stage reached with its time, the first refusal or device-loss line. Keep logs and traces | ||
| 120 | on the machine that produced them. | ||