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

Manually merged
github merged 39 commits from gh-pr/984/head into gh-pr/984/base 2026-11-26 09:31:53 +00:00
Owner

@⁠Moriz82 on GitHub · 2026-11-24 16:24 UTC · original
integration/proton-story-load → main · +37997 −2599 · 301 files · 39 commits · merged 2026-11-25 01:37 UTC

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

**@⁠Moriz82** on GitHub · 2026-11-24 16:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/984) `integration/proton-story-load` → `main` · +37997 −2599 · 301 files · 39 commits · merged 2026-11-25 01:37 UTC Claimed in the coordination issue as: RT-PROTON-STORY-LOAD ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). 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)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.

Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.

Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
  routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
  slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
  console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
  list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
  completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
  attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
  pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
  undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
  list proxy, its null-view slot 70 and its refusing slot 133.

Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
  cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
  the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.

D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
  ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
  origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
  stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
  refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.

Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
  ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.

Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
  restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.

One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
main's failed-resize case (a3090aab2) builds a VulkanSwapchain with eight arguments; #984 gave the constructor a ninth, DeviceFaultDiagnostics*, with no default. Pass nullptr, as #984's own case in this file does.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 adds pso_stream_test under BUILD_TESTING, outside the Windows block. It includes d3d12.h and takes MSVC options, so the portable configure on Linux and macOS failed to compile it (c++: cannot specify -o with -c and multiple files). Define it only when gta6rt is built, like the other proxy tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984's loop guard (tools/spirv_loop_guard.py, the 'Loop guard' row in docs/design.md) puts an iteration counter at every loop header as an OpPhi. The interpreter this test file carries did not model OpPhi, so the four loop cases stopped with 'Opcode not modelled' on the translator's default output. The interpreter now tracks the predecessor block and evaluates OpPhi; the cases and their expected values are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The test expected spirv_mini_interp to refuse the emulated wave64 round loop. #984 taught the interpreter OpSwitch (and OpUMod), so the module now runs and assertRaises failed. The expectation was out of date: the case now executes all 64 lanes for each of the five modes and compares the stored values with the ISA model, which is a stronger check than the refusal was.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Same cause as in test_ds_swizzle_b32: spirv_mini_interp models OpSwitch since #984, so the emulated scheduler runs and the expected UnsupportedConstruct no longer comes. The case now executes v_permlane16_b32 and v_permlanex16_b32 on 64 lanes and compares with ref_permlane.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 lists the generated m15 shader files as sources of two targets, d3d12_translated_draw_test and its new d3d12_rect_list_test. With a Makefile generator each target then runs the translation command itself; under a parallel build both ran at once, each removing the folder the other was writing, and the build stopped with 'Translation did not produce validated SPIR-V for: vs_m15, ps_m15' (seen in the clang-cl build of the merge; it is a race, so #984's head happened to build). d3d12_rect_list_test now depends on d3d12_translated_draw_test for the files, as tiny_guest_draw does.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The merge kept main's form of device slot 81 (GetFrameStatisticsX: an attached presentation answers first) and with it main's answer when nothing is attached, S_FALSE with a zero count. No retail run has been through that answer: it is a reading of the public samples. #984, the tree that was measured to boot through the story load, answers the same call with S_OK and a zero count, and E_POINTER for a null count or for a count above zero with no array (its GetFrameEventsX handler). Nothing attaches a presentation in gta6rt, so this is the answer the title gets.

main's structure stays (the configurable route, the logged name, the handler first); only the answer without a handler is #984's. Both forms write the count through the third argument, so the two do not disagree about the layout. The mock tests (env-slots-invalid, check_presentation_wiring), the header comment and the row in docs/d3d12_vulkan.md say the same.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
tests/test_docs_env_vars.py fails when the runtime reads a LEONIDA_* variable that no document names; #984 brings 32 of them (the test fails on its head too). Each is described in a new table in runtime/README.md, from the code that reads it: the default, what the switch changes, and which ones are diagnostics only. None is removed: every one is behind its own switch already and off, or the default path of the retail boot.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The XUser paragraph #984 adds cites docs/re/takes/other-projects.md, which is not a tracked file, so tests/test_docs_repo_paths.py fails (on #984's head too). The sentence stands without the citation.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984's tool wrote history.json, the generated tables and the signature stamp as text without newline=, so the bytes differed between Windows and the other platforms; tests/test_text_write_line_endings.py fails on that (on #984's head too). All four writes are UTF-8 with LF now.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984's new slot 25 case first checks that the PC device refuses a depth-stencil texture with unordered access. Microsoft's runtime (WARP) does; Wine's vkd3d sizes the texture without validating the flag pair, so under Wine device_proxy and device_proxy_trace failed at that line (on #984's head as well as on the merge; both pass on main, which has no such case). The control now runs only where the host is Microsoft's, the way the other host comparisons do it (host_wine.h). The checks of the proxy itself are unchanged and run everywhere.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 carries the probes its author followed a frame of the retail title with, marked LOCAL DIAGNOSTIC and in places 'not for upstream'. Several wrote to stderr with no switch from paths that run for every draw: record_draw (a mutex, a set lookup and up to a dozen lines per draw), ClearRenderTargetView, the submission's table dump, PresentX (present_diag and the plane dump), the presenter's path line, the heap and CopyDescriptorsSimple lines of the device proxy, the per-view CBV and SRV lines, the per-pipeline description string and the console-heap census.

They stay, for the next person who has to follow a frame, behind one switch: LEONIDA_LOCAL_DIAGNOSTICS=1 (runtime/src/local_diagnostics.h, a row in runtime/README.md). Unset, none of them runs. Not changed: the diagnostics that already had a switch of their own (LEONIDA_CAPTURE_SOURCE, LEONIDA_MEM_PROBE, LEONIDA_XG_TRACE, --trace) and the replay's unresolved/unsupported lines, which report a dropped draw or list at the 1st, 2nd, 4th... occurrence.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 builds compute pipelines lazily and queues every one for a warm-up on a worker thread; a queued job holds its PipelineState, and through it the device, until the worker has run it. A test that releases everything and then reads rt::d3d12_xs::device_proxy_ref_count races with that worker: d3d12_fspx_compute fails at 'device_proxy_ref_count == 1' on #984's head, and on the merge d3d12_compute fails the same way on llvmpipe (main's case there creates pipelines it never dispatches, which only the warm-up ever builds). Both pass on main.

The warm-up stays as it is. device_proxy_ref_count, a helper only the tests call, now lets the layer under the proxy finish such work first: the Vulkan device registers PipelineCompiler::wait_idle through set_reference_settler, and the pool reports itself idle when no job is queued or running. The tests are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The presentation the device proxy builds on the first PresentX (or for the package splash) is meant to go with the proxy: proxy_release destroys it before the device. It could not: create_window_presenter gives the presenter a reference on the device's outer identity, and for a device made by D3D12XboxCreateDevice that is the proxy (set_device_outer). The proxy owned the state, the state the presenter, the presenter a reference to the proxy, so after the first PresentX the proxy's count could not reach zero and the window, the swapchain and the device stayed until the process ended.

#984's presenter has this cycle as the #414 branch had it; the fix is the one made there (rung-414-on-main, ea9228dc0), applied to #984's form of present_state_for. create_window_presenter gets a hold_device argument, true by default so every other caller keeps its reference. The proxy passes false: it owns the presenter and destroys it before it releases the device, which is the order the reference was there to guarantee.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The merge kept main's B4G4R4A4 render target stand-in (an RGBA8 image) and dropped #984's (a BGRA8 image). #984's DeviceState::b4g4r4a4_target_stand_in was left behind: computed at device creation, read by nothing, and printed in the 'console format stand-ins' line as 'B4G4R4A4 target as BGRA8', which is no longer what happens. The flag and its clause of the log line are gone; main's stand-in logs itself when it is used.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
An A8_UNORM render target is a VK_FORMAT_A8_UNORM_KHR image and any other
A8_UNORM texture an R8_UNORM image. CopyResource and CopyTextureRegion
between the two issued vkCmdCopyImage on that pair, which Vulkan does not
count as size-compatible: VUID-vkCmdCopyImage-srcImage-01548, although the
bytes came out right on the drivers tried. moffington reported it in the
review of #428 and Dezmonius confirmed it on native Windows with the
validation layer.

Such a copy now takes the replay's existing image -> transfer scratch ->
image route, the one depth <-> colour copies use, with one byte per texel
on both sides. Same-backing copies still copy image to image. This is the
approach of Dezmonius's proof of concept, which they described on the pull
request but did not publish; written here from that description.

d3d12_a8_copy_test copies A8 render target -> A8 texture and back, whole
(CopyResource) and a 3x3 box from a nonzero source offset to a nonzero
destination offset (CopyTextureRegion), and checks every texel read back:
the source bytes inside the box, the destination's own outside it. It wraps
vkCreateImage and vkCmdCopyImage behind the instance-proc pointer it hands
the layer and fails on any vkCmdCopyImage between VK_FORMAT_A8_UNORM_KHR and
another format, so it fails without this change even where the validation
layer is not installed; with LEONIDA_VK_VALIDATION=1 the layer's errors fail
it too. A8 -> A8 and R8 -> R8 copies are the controls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
From rung-428-on-main (554f0e4ec). The bug that commit fixed, VK_KHR_maintenance5 enabled inside maintenance8's #ifdef, is not in #984's copy of the A8 support: the enable already sits under its own guard here, so only the comment on it comes over. What the commit adds besides still applies:

tests/test_vulkan_extension_guards.py reads the runtime sources and fails on any device extension enabled inside another extension's #ifdef. d3d12_a8_copy_test also forces the fallback (a8_render_target false) on any device: A8_UNORM render targets are refused at creation, in GetResourceAllocationInfo and in the format support, no A8 image is created, and plain A8_UNORM textures still copy.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
d3d12_a8_dimensions_test makes its device without the A8 render-target
path, so it covers 1D and 3D A8_UNORM textures only in the fallback.
d3d12_a8_copy_test now also checks them on a device that has the path:
a 128x1 1D and an 8x8x4 3D A8_UNORM texture are created as R8_UNORM
images (no VK_FORMAT_A8_UNORM_KHR image is made for them), so they are
never one side of a mixed-backing copy, and a 1D A8_UNORM render target is
refused rather than made in either backing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The header credited "TomBox's create_derived_pso_x, GPL-3.0" without saying where that is. The credit now names the repository, the file and the licence: omonkeyz/xbox-emulator, crates/compat/d3d12_xs/src/device_wrap.rs (the continuation of drycheetah84/TomBox), GPL-3.0-or-later. Only layout facts are shared with it (the record stride and the meaning of tags 0 to 3), no code.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The note called TuxBox unlicensed. GitHub reports brcly/TuxBox as Apache-2.0 now. The statement that it was a reference for behaviour only is unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The case that loads fspx/, fspx_gfx/ and bvh/ indexes calls itself synthetic and runs against index files it writes itself, but two of its keys were the SHA-256 digests of two programs of the game's pipeline library (the ones docs/fspx.md cites as programs 842 and 843), with those numbers in the file names. A hash is not content, but a synthetic test has no reason to carry real ones, and nothing in the case depends on the values. They are 3333... and 4444... now, next to the 1111... and 2222... the case already used, with file names _00001 and _00002.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The merged queue proxy recognises PresentX at slot 30 on a queue in the older layout and at slot 32 on a queue detected as the newer one (a fence at slot 16 or 17, or SignalX at 25), which is #984's measured behaviour, with main's LEONIDA_XS_PRESENT_X_SLOT pinning one slot and an attached handler answering first. Only one of the two is PresentX at a time: in the newer layout slot 30 is another method.

docs/d3d12_vulkan.md still had main's row (the queue slots stay refused, gta6rt creates no presentation) and runtime/README.md still said PresentX has an unknown slot. Both describe the merged code now. check_presentation_wiring gains the newer-layout case: before the fence 30 reaches the presenter and 32 does not, after it 32 does and 30 does not.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings the branch up to main at b4b7756e8: #396 (console list slot 139 is Reset) and #403 (queue slot 18 is the frequency getter for a guest caller). The first merge already resolved the proxy to these two forms, so nothing changes in the code:

- runtime/shims/d3d12_xs_device.cpp: one conflict, main's copy of the base list proxy, which #396 edited and the first merge had dropped for #984's list proxy (the Reset rule of #396 is in #984's list_slot). Ours.
- runtime/shims/d3d12_xs_device.h: merged clean, unchanged.
- runtime/test/xs_proxy_mock_test.cpp: git added main's console_to_pc_list_slot(139) check next to the copy the first merge had put two lines lower; one stays, in main's place.

Every line the two pull requests added to these three files is in the result.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984's new test refuses device-local allocations to force the table into host memory, and says itself that the host fallback is not checked on a device with no host memory type outside device-local memory. But it injected the fault there too: llvmpipe has one memory type for everything, so every allocation was refused, the table could not grow and the check right after the frame failed (on #984's head, on Linux and under Wine; the test is in the portable subset, so a Linux CI run with lavapipe would be red). The fault is only injected where a separate host type exists; elsewhere the table grows normally in that step, and the all-memory-refused cases further down still run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The submission path looked up the origin of every bound descriptor table (a lock and a map lookup each) for the LEONIDA_FSDRAW_POKE_CB experiment, whether or not the experiment was on; poke_cb then returned at once. The loop now runs only with the experiment.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Both sides added a row for the same rule. The merge kept main's decoder and translator rule (#957) and dropped #984's narrower ones, but #984's row 'Pipeline-library DPP comparisons' merged in without a conflict and described a decoder that is no longer there. main's row 'DPP on a VOPC compare' covers the forms #984's handled (full-mask f32 compares) and names the refused ones.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
From rung-414-on-main (24a19ae8f), where it found the reference cycle fixed two commits ago, adapted to this tree: PresentX is called at queue slot 30 (a queue is in the older layout until a fence reaches slot 16 or 17), and the runtime's window is destroyed by the thread that owns it, so the last check waits for it to go (up to two seconds) instead of looking once.

It compiles the proxy with LEONIDA_VULKAN_DEVICE, as gta6rt does, and checks: the frame events before the first present are the device's own; nothing is built before the first PresentX and one window after it; WaitFrameEventX stays the device's and counts from the same token source the presenter checks (an unissued token is E_INVALIDARG, an issued one is accepted); a second PresentX builds no second window; and the window goes with the device proxy.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The two SHADER-813 cases put the word pair of the original finding between instructions as 'undecodable' and expect the translation to be refused. #984 taught the translator to recover exactly that v_dot4_i32_i8 form from the program's words (restore_skipped_instructions), so with #984 the pair is no longer a gap and both cases failed (on #984's head too; the test file is the same on both sides). The cases now use the same instruction with another op_sel, which is not recovered and is still skipped, so they test what they were written for.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 adds shims/console_registry.cpp to gta6rt's sources in CMake but not to the cl.exe fallback's list, so the fallback would stop at link time and tests/test_build_runtime_fallback.py fails (on #984's head too).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
tests/test_gfx10_descriptors.py checks every row of the format table against Mesa's names and fails when a row does not have the form it parses. #984's A8 render target row carried a remark after the GFX10 name, so it was counted but not read (94 of 95 rows; fails on #984's head too). The remark is a comment line above the row now, and the row is checked like the others (the test already knows an extension's suffix is not part of the layout).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Three conventions main's tests enforce and #984's new tools missed (all three tests fail on #984's head):

- tests/test_text_encoding.py: tools/build_dstorage_history.py read its stamp and its base history, and tools/dstorage_census.py its trace, in the locale's code page. They name UTF-8 now.
- tests/test_tool_stdout_encoding.py: the __main__ blocks of build_dstorage_history.py, dstorage_census.py, gen_bcpack_runtime_tables.py and scripts/translate_pipeline_compute.py did not set errors='replace' on stdout.
- tests/test_tool_startup.py runs every tool with --help. gen_bcpack_runtime_tables.py took its first argument as the output path whatever it was, so the test passed and left a 61 KiB file named '--help' in the working directory. The tool has an argument parser now (the tables file, or --profile JSON OUT, as before); the generated tables are byte-identical.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The runtime workflow lists the files under tools/ that start it, and tests/test_runtime_paths.py fails when the build reads one that is not listed. #984 makes the runtime build read tools/spirv_loop_guard.py (a translator dependency) and tools/bcpack_history_train.cpp, which the test names (it fails on #984's head too), and the four Python files the bcpack tables are generated from (gen_bcpack_runtime_tables.py, bcpack.py, bcpack_tables.py, bcpack_tables_bptc.py), which CMake names through a variable the test cannot follow. All six are in both path lists now, so a change to any of them runs the Windows and Wine builds.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
#984 changed how a buffer's device address is formed: the low 48 bits of the effective VA are sign-extended before the heap base is added (Gen.host_addr, the 'Heap-relative buffer device addresses' row in docs/design.md), because a V# base is device_address - heap_base in 48 bits and is negative for an import below the heap. The memory differential fuzzer's reference machine still put a base with bit 47 set at the zero-extended address, so every case with such a base read zeros on the translated side: tests/test_mem_diff.py failed in nine families (on #984's head too).

The fuzzer has one function for where a VA is in memory, host_address, used by the reference machine's reads and writes and by the generator's seeding. The cases, the seeds and the interpreter are unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Follow-up to the LEONIDA_LOCAL_DIAGNOSTICS commit: the desc-probe still registered every console descriptor heap and printed a line for each of the first 48 view creations ('... outside the console heaps'), switch or not. A heap probe is only created when LEONIDA_LOCAL_DIAGNOSTICS or the compute probe is on, and the per-view line is behind the switch like the rest.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Three checks of the physical-page views fail under Wine, two of them on main as well (xmem is a known Wine failure there) and one that #984 adds; with #984 registering the test twice more (xmem_write_watch, xmem_no_write_watch) that made three red tests. Measured under Wine 11: a page of a reserved section view that has been written and reads back is still reported by VirtualQuery as MEM_RESERVE with protection 0 (type MEM_MAPPED, allocation protection PAGE_READWRITE), where Windows reports MEM_COMMIT and PAGE_READWRITE.

- 'unmapping one of them afterwards keeps the others' memory' (#984) asked whether the neighbours were still mapped through reserved_only(), which is the reported state. It asks for the view itself now (in_view: the region's type is MEM_MAPPED), which is what the check is about, and also that the unmapped page is no longer in one. Same on both hosts.
- The two checks of the reported state and protection of a written view page print SKIP with the reason when the host is Wine and gives exactly that answer; the first then still checks that the page is a read-write view holding what was written. On Windows both run as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The second half of run_tiny_tls_ga (new in #984) points TMP and TEMP at a missing folder so that the home clone cannot be written and the loader must refuse the image. Under an emulator the override never reaches the loader: Wine gives the process the temporary folder of its prefix whatever the caller's environment says, so the reservation succeeds, --run returns 0 and the script failed with '--run without the reservation returned 0' (on #984's head too).

When the script runs the loader through an emulator it first asks --dry-run, which maps the image and names index 0 in a note when the reservation fails, without running any of its code. If that note is missing the override is not in effect: the script prints 'SKIP the failed-reservation half: TMP and TEMP set for <runner> do not reach the loader's GetTempPathW' and stops there, after the first half (the image gets index 0 and reads its TLS from slot 0) has passed. A native run is unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The retail title runs its own hang watchdog: when the game's main loop has
not reported for 30 seconds, it ends itself. #984 kept that watchdog from
firing by default, because under the runtime the game thread can wait
longer than that, for example while the driver compiles pipelines on the
first boot after a driver update.

By the maintainer's decision the watchdog now stays armed by default, as on
the console, so a real hang still ends the run. LEONIDA_TITLE_WATCHDOG=0
turns on the runtime thread that keeps it from firing; as before, it only
acts in the build the watchdog was measured in. The README's environment
table and the log line say the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:31:50 +00:00
github manually merged commit 71a783e56f into gh-pr/984/base 2026-11-26 09:31:53 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.