[PR #984] [MERGED] [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD) #1024

Closed
opened 2026-11-26 20:19:50 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/984
Author: @Moriz82
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: integration/proton-story-load


📝 Commits (10+)

  • 273b3bd [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
  • 39879ce Merge main into RT-PROTON-STORY-LOAD (#984)
  • 424a605 dxgi_swapchain_count_test: pass the diagnostics argument in the failed-resize case
  • e011e10 CMake: build pso_stream_test only with the Windows runtime
  • 432dae1 test_control_flow_branches: model OpPhi in the structured interpreter
  • 4902178 test_ds_swizzle_b32: run the emulated wave64 swizzles instead of expecting a rejection
  • a713b30 test_valu_permlane16: run the emulated wave64 permlanes instead of expecting a rejection
  • a0d90b7 CMake: one target owns the translated vs_m15/ps_m15 files
  • 48ba269 d3d12_xs: device slot 81 with no presenter answers as the measured boot did
  • c334e0a docs: name the 32 environment variables #984's code reads

📊 Changes

301 files changed (+37997 additions, -2599 deletions)

View changed files

📝 .github/workflows/runtime.yml (+12 -0)
📝 .gitignore (+4 -0)
📝 README.md (+1 -1)
📝 docs/README.md (+2 -0)
📝 docs/boot.md (+17 -1)
📝 docs/buffer_bounds.md (+4 -0)
📝 docs/cpu_features.md (+7 -0)
📝 docs/d3d12_command_objects.md (+11 -4)
📝 docs/d3d12_vulkan.md (+233 -18)
➕ docs/d3d12_xs_console_abi.md (+279 -0)
📝 docs/design.md (+40 -19)
📝 docs/directstorage.md (+75 -30)
📝 docs/embedded_shaders.md (+57 -8)
📝 docs/fspx.md (+68 -1)
➕ docs/linux_proton.md (+120 -0)
📝 docs/movies.md (+16 -15)
📝 docs/pipeline_check.md (+2 -0)
📝 docs/retail_boot_chain.md (+1 -1)
📝 docs/runtime_imports.md (+71 -21)
📝 docs/shader_library.md (+23 -0)

...and 80 more files

📄 Description

Claimed in the coordination issue as: RT-PROTON-STORY-LOAD (claim).

Depends on: none. Conflicts with / overlaps: #968 (queue slot 31, which this branch does not implement and needs), #974 (graphics root arguments and mesh user data), #976 (runtime BCPack decoder), #969 (DirectStorage destination pages), #939 (Windows first-run integration), #980 (device-loss log). Where they overlap, theirs take precedence; this branch will be rebased onto them.

Draft. It is one squashed commit on ece4ba5b3 (2026-11-23) and conflicts with main in 21 files. It is opened now so the Linux support and the test results are visible and so pieces can be claimed and split out; see "How this can land" below.

What and why

A fork of this project was developed on a Linux machine under Proton/Wine and tested on native Windows by a second contributor. On both, the retail 1.0.2.1 package now:

  1. launches and shows the package splash and the launch movie,
  2. goes through the first-run pages, legal pages and the landing prompt with a pad or the keyboard pad,
  3. runs the story load to its end, with the loading slideshow drawing its artwork,
  4. enters the world phase.

A first world frame is not verified yet on any machine. docs/linux_proton.md (new) has the Linux setup, the timeline of a healthy boot, the machines and where it stops.

Every item below was a stop on at least one machine:

Area Change
Presentation Frames are presented in the title's own window; they went to a window that was never shown.
Input Press log, right-stick keys, input scripts of any length (they were silently cut at 63 characters).
DirectStorage Reads pin write-watched destination pages; page-list scatter/gather; BCPack with unshuffle; a predictor file generated locally by tools/build_dstorage_history.py; bounded staging.
Story-load stall One device allocation per streamed texture exhausted the driver's CPU-visible mappings near 16,000 images. Small streamed images share pooled pages (LEONIDA_TITLE_IMAGE_POOL).
Image memory Host-copy usage excluded plain device-local memory on NVIDIA, so 4.8 GB of images spilled into host memory; streamed images are filled through staging. Private backing of placed and streamed images is deferred to their first write or GPU copy: VRAM at the end of the load 11.8 GB → ~5 GB on Linux; host private memory 22-24 GB → 11.9 GB on Windows.
Barriers An enhanced texture barrier into LAYOUT_UNDEFINED is accepted; it failed Close, which the title treats as fatal.
Bindless set A table rebuild that cannot allocate degrades instead of refusing the submission; larger 2D-array/3D/1D arrays; a fnv1a_fmix32 descriptor hash (runtime and translator halves, off until a library carries the marker), because the table had clustered to 8.4 M slots for 42 k keys.
Directly indexed heaps The heap offset is supplied in the user-data dword after the explicit root arguments, for compute dispatches and VS/PS/GS draws. The culling programs read their descriptors from offset zero before. Mesh stages are not covered.
Title buffers A window outside the arena when title reservations fragment it; opt-in persistent device-local copies of streamed buffer views.
Translator Loop bounds at structured exits (5,128 compute modules have loops); the eight FidelityFX programs that use a packed-dot form the disassembler skips, so all 29 translate (credit to the encoding found in #281); bounds modes per buffer view kind; no backing read for channel-less formats; a compaction option.
Native Windows A write fault on a shared page is retried under the tracker lock (a race ended the process in the story load); one tracker per run of shared pages (refresh 59 ms → under 1 ms); write-watched title memory; xmem's fault lock never waits for the process heap; root-layout fixes in the graphics test shaders.
Diagnostics, all off by default Device-loss report with the last dispatches and NVIDIA checkpoints, a probe of the descriptors a compute dispatch receives, a memory probe, LEONIDA_SKIP_COMPUTE and LEONIDA_STUB_PIPELINES. The last two are for finding a stop, not for shipping around one: every program they were used on has a fix in this branch or an open item below.

Where it stops now, on both platforms: the title's ~300 calls per boot to queue slot 31 are ignored here (#968 addresses that), so streamed pages never reach their destinations and the culling compute at world start reads outside mapped memory; mesh stages do not get the heap offset.

Tested

Linux: CachyOS (kernel 7.3), Proton Experimental (Wine 11), Ryzen 5 5600X, 16 GB RAM, RTX 4070 12 GB, NVIDIA 620.73. Cross-built with clang-cl 23 and an xwin SDK. About 80 boots of the retail package on 2026-11-24; the last ones run the story load to its end in 540-630 s with ~14,000-26,000 presents and no refused submission, then lose the device in the world phase's first compute work.

Windows A (second contributor, Plaaasma): Windows 11, Core i9-13900K, 64 GB RAM, RTX 4070 Ti 12 GB, NVIDIA 630.20, MSVC 2022. Same stages at ~70 s (initialisation), ~110 s (story load) and the same stop at ~120-190 s. Each fix in the table was confirmed there or found there. ctest -R d3d12_: 126 of 127 pass with 5 skipped on that machine.

Windows B: Windows 11, Ryzen 7 9800X3D, RTX 5070. Joining; no results to report yet.

Unit tests run under Wine on the Linux machine against this tree: d3d12_existing_heap_test, d3d12_compute_test, d3d12_graphics_direct_heaps_test, xg_xs_test (88 checks), vk_bindless_grow_test, bindless_sizing_test, descriptor_table_test, shader_library_test, title_write_watch_test (18), command_list_test, replay_texture_barrier_test, d3d12_close_parity_test (117 cases), startup_trace_test (27), vulkan_title_image_pool_test. Known red there: three checks of xmem_test on physical-page views under Wine, and one stress test skipped under Wine (a heap-lock deadlock in the fault path that is fixed natively and still open under Wine). Translator: the suites for loop bounds, buffer bounds, the descriptor hash (eight shared vectors, interpreter and GPU) and the recovered FidelityFX forms pass; all 2,680 paired compute programs and 29 of 29 FidelityFX programs translate.

GPUs tested: NVIDIA RTX 4070 (620.73, Linux/Proton); NVIDIA RTX 4070 Ti (630.20, Windows 11). No AMD or Intel GPU was available: RADV and the Intel paths are untested by us.

AI-assisted: yes (Claude Code and Codex agents wrote most of it; every result above comes from boots and test runs on the machines named, not from the agents' say-so).

How this can land

I do not expect this to merge as one pull request. Suggested order, each as its own claimed ID and small PR on current main, and I am glad to hand any of them to whoever wants it:

  1. docs/linux_proton.md and scripts/linux-boot/ (no code).
  2. The LAYOUT_UNDEFINED barrier and the bindless flush (each with its test).
  3. Image pooling, device-local placement and deferred backing.
  4. Directly indexed heap offsets (after #974, since it changes where graphics root arguments live).
  5. Translator loop bounds and the FidelityFX forms.
  6. The native Windows write-fault and tracker fixes.

Checklist

  • Based on current main and merges cleanly: no, see above.
  • One topic: no, an integration branch.
  • No game data, keys or decryption, including in logs or reports quoted here. scripts/check_no_game_data.py passes on the tree; the text above has counts, timings and settings only.
  • New translator rules are in the contract table of docs/design.md, with how they were confirmed.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/984 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `integration/proton-story-load` --- ### 📝 Commits (10+) - [`273b3bd`](https://github.com/ubiquitarianism/leonida/commit/273b3bdf9d6e736442ad584ad464df6e86ee928b) [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD) - [`39879ce`](https://github.com/ubiquitarianism/leonida/commit/39879ce0fdcaea23ce3919c1e845dd360b17b0f8) Merge main into RT-PROTON-STORY-LOAD (#984) - [`424a605`](https://github.com/ubiquitarianism/leonida/commit/424a605b355b243e806d2222d313fd2a12f8bb5e) dxgi_swapchain_count_test: pass the diagnostics argument in the failed-resize case - [`e011e10`](https://github.com/ubiquitarianism/leonida/commit/e011e10a7115da8318404ff57417f72adf08cb3a) CMake: build pso_stream_test only with the Windows runtime - [`432dae1`](https://github.com/ubiquitarianism/leonida/commit/432dae12f0213bd5b8dfd185eca7cdd30e857794) test_control_flow_branches: model OpPhi in the structured interpreter - [`4902178`](https://github.com/ubiquitarianism/leonida/commit/49021780679e70e60b387b9ae09a12d7c9ac8d80) test_ds_swizzle_b32: run the emulated wave64 swizzles instead of expecting a rejection - [`a713b30`](https://github.com/ubiquitarianism/leonida/commit/a713b3002ae0b2a2f74ec234f1127f0f83deb2e0) test_valu_permlane16: run the emulated wave64 permlanes instead of expecting a rejection - [`a0d90b7`](https://github.com/ubiquitarianism/leonida/commit/a0d90b79a99fd36a19c03041f99d518e42bb0154) CMake: one target owns the translated vs_m15/ps_m15 files - [`48ba269`](https://github.com/ubiquitarianism/leonida/commit/48ba269139113bc18f4583da8660eff56e1bbeb7) d3d12_xs: device slot 81 with no presenter answers as the measured boot did - [`c334e0a`](https://github.com/ubiquitarianism/leonida/commit/c334e0a1a5fa9956ea598a20cec4a1034ab5b664) docs: name the 32 environment variables #984's code reads ### 📊 Changes **301 files changed** (+37997 additions, -2599 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/runtime.yml` (+12 -0) 📝 `.gitignore` (+4 -0) 📝 `README.md` (+1 -1) 📝 `docs/README.md` (+2 -0) 📝 `docs/boot.md` (+17 -1) 📝 `docs/buffer_bounds.md` (+4 -0) 📝 `docs/cpu_features.md` (+7 -0) 📝 `docs/d3d12_command_objects.md` (+11 -4) 📝 `docs/d3d12_vulkan.md` (+233 -18) ➕ `docs/d3d12_xs_console_abi.md` (+279 -0) 📝 `docs/design.md` (+40 -19) 📝 `docs/directstorage.md` (+75 -30) 📝 `docs/embedded_shaders.md` (+57 -8) 📝 `docs/fspx.md` (+68 -1) ➕ `docs/linux_proton.md` (+120 -0) 📝 `docs/movies.md` (+16 -15) 📝 `docs/pipeline_check.md` (+2 -0) 📝 `docs/retail_boot_chain.md` (+1 -1) 📝 `docs/runtime_imports.md` (+71 -21) 📝 `docs/shader_library.md` (+23 -0) _...and 80 more files_ </details> ### 📄 Description Claimed in the coordination issue as: RT-PROTON-STORY-LOAD ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137594295)). Depends on: none. Conflicts with / overlaps: #968 (queue slot 31, which this branch does **not** implement and needs), #974 (graphics root arguments and mesh user data), #976 (runtime BCPack decoder), #969 (DirectStorage destination pages), #939 (Windows first-run integration), #980 (device-loss log). Where they overlap, theirs take precedence; this branch will be rebased onto them. **Draft.** It is one squashed commit on `ece4ba5b3` (2026-11-23) and conflicts with `main` in 21 files. It is opened now so the Linux support and the test results are visible and so pieces can be claimed and split out; see "How this can land" below. ### What and why A fork of this project was developed on a **Linux machine under Proton/Wine** and tested on **native Windows** by a second contributor. On both, the retail 1.0.2.1 package now: 1. launches and shows the package splash and the launch movie, 2. goes through the first-run pages, legal pages and the landing prompt with a pad or the keyboard pad, 3. runs the **story load to its end**, with the loading slideshow drawing its artwork, 4. enters the world phase. A first world frame is **not** verified yet on any machine. `docs/linux_proton.md` (new) has the Linux setup, the timeline of a healthy boot, the machines and where it stops. Every item below was a stop on at least one machine: | Area | Change | |---|---| | Presentation | Frames are presented in the title's own window; they went to a window that was never shown. | | Input | Press log, right-stick keys, input scripts of any length (they were silently cut at 63 characters). | | DirectStorage | Reads pin write-watched destination pages; page-list scatter/gather; BCPack with unshuffle; a predictor file generated locally by `tools/build_dstorage_history.py`; bounded staging. | | Story-load stall | One device allocation per streamed texture exhausted the driver's CPU-visible mappings near 16,000 images. Small streamed images share pooled pages (`LEONIDA_TITLE_IMAGE_POOL`). | | Image memory | Host-copy usage excluded plain device-local memory on NVIDIA, so 4.8 GB of images spilled into host memory; streamed images are filled through staging. Private backing of placed and streamed images is deferred to their first write or GPU copy: VRAM at the end of the load 11.8 GB → ~5 GB on Linux; host private memory 22-24 GB → 11.9 GB on Windows. | | Barriers | An enhanced texture barrier into `LAYOUT_UNDEFINED` is accepted; it failed `Close`, which the title treats as fatal. | | Bindless set | A table rebuild that cannot allocate degrades instead of refusing the submission; larger 2D-array/3D/1D arrays; a `fnv1a_fmix32` descriptor hash (runtime and translator halves, off until a library carries the marker), because the table had clustered to 8.4 M slots for 42 k keys. | | Directly indexed heaps | The heap offset is supplied in the user-data dword after the explicit root arguments, for compute dispatches and VS/PS/GS draws. The culling programs read their descriptors from offset zero before. Mesh stages are not covered. | | Title buffers | A window outside the arena when title reservations fragment it; opt-in persistent device-local copies of streamed buffer views. | | Translator | Loop bounds at structured exits (5,128 compute modules have loops); the eight FidelityFX programs that use a packed-dot form the disassembler skips, so all 29 translate (credit to the encoding found in #281); bounds modes per buffer view kind; no backing read for channel-less formats; a compaction option. | | Native Windows | A write fault on a shared page is retried under the tracker lock (a race ended the process in the story load); one tracker per run of shared pages (refresh 59 ms → under 1 ms); write-watched title memory; xmem's fault lock never waits for the process heap; root-layout fixes in the graphics test shaders. | | Diagnostics, all off by default | Device-loss report with the last dispatches and NVIDIA checkpoints, a probe of the descriptors a compute dispatch receives, a memory probe, `LEONIDA_SKIP_COMPUTE` and `LEONIDA_STUB_PIPELINES`. The last two are for finding a stop, not for shipping around one: every program they were used on has a fix in this branch or an open item below. | Where it stops now, on both platforms: the title's ~300 calls per boot to queue slot 31 are ignored here (#968 addresses that), so streamed pages never reach their destinations and the culling compute at world start reads outside mapped memory; mesh stages do not get the heap offset. ### Tested **Linux:** CachyOS (kernel 7.3), Proton Experimental (Wine 11), Ryzen 5 5600X, 16 GB RAM, RTX 4070 12 GB, NVIDIA 620.73. Cross-built with clang-cl 23 and an xwin SDK. About 80 boots of the retail package on 2026-11-24; the last ones run the story load to its end in 540-630 s with ~14,000-26,000 presents and no refused submission, then lose the device in the world phase's first compute work. **Windows A (second contributor, `Plaaasma`):** Windows 11, Core i9-13900K, 64 GB RAM, RTX 4070 Ti 12 GB, NVIDIA 630.20, MSVC 2022. Same stages at ~70 s (initialisation), ~110 s (story load) and the same stop at ~120-190 s. Each fix in the table was confirmed there or found there. `ctest -R d3d12_`: 126 of 127 pass with 5 skipped on that machine. **Windows B:** Windows 11, Ryzen 7 9800X3D, RTX 5070. Joining; no results to report yet. Unit tests run under Wine on the Linux machine against this tree: `d3d12_existing_heap_test`, `d3d12_compute_test`, `d3d12_graphics_direct_heaps_test`, `xg_xs_test` (88 checks), `vk_bindless_grow_test`, `bindless_sizing_test`, `descriptor_table_test`, `shader_library_test`, `title_write_watch_test` (18), `command_list_test`, `replay_texture_barrier_test`, `d3d12_close_parity_test` (117 cases), `startup_trace_test` (27), `vulkan_title_image_pool_test`. Known red there: three checks of `xmem_test` on physical-page views under Wine, and one stress test skipped under Wine (a heap-lock deadlock in the fault path that is fixed natively and still open under Wine). Translator: the suites for loop bounds, buffer bounds, the descriptor hash (eight shared vectors, interpreter and GPU) and the recovered FidelityFX forms pass; all 2,680 paired compute programs and 29 of 29 FidelityFX programs translate. GPUs tested: NVIDIA RTX 4070 (620.73, Linux/Proton); NVIDIA RTX 4070 Ti (630.20, Windows 11). No AMD or Intel GPU was available: RADV and the Intel paths are untested by us. AI-assisted: yes (Claude Code and Codex agents wrote most of it; every result above comes from boots and test runs on the machines named, not from the agents' say-so). ### How this can land I do not expect this to merge as one pull request. Suggested order, each as its own claimed ID and small PR on current `main`, and I am glad to hand any of them to whoever wants it: 1. `docs/linux_proton.md` and `scripts/linux-boot/` (no code). 2. The `LAYOUT_UNDEFINED` barrier and the bindless flush (each with its test). 3. Image pooling, device-local placement and deferred backing. 4. Directly indexed heap offsets (after #974, since it changes where graphics root arguments live). 5. Translator loop bounds and the FidelityFX forms. 6. The native Windows write-fault and tracker fixes. ### Checklist - [ ] Based on current `main` and merges cleanly: **no**, see above. - [ ] One topic: **no**, an integration branch. - [x] No game data, keys or decryption, including in logs or reports quoted here. `scripts/check_no_game_data.py` passes on the tree; the text above has counts, timings and settings only. - [x] New translator rules are in the contract table of `docs/design.md`, with how they were confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:50 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1024
No description provided.