upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-30 04:36:05 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-30 04:36:05 -0500
commitb8508a974bbd725c5f6cb2ca200583f12085c3ef (patch)
treef0425be7d73365dcf0ae2f05ce96351c1557377f /docs
parentefc1929908a728d95fa09ffef0a743d2a649b86d (diff)
parent4014af7fe9a479caee2946c1814c11935b24bf60 (diff)
Merge branch 'main' of https://github.com/ProjectLeonida/mandy into fix/rendering-correctness
# Conflicts: # tests/semantic/test_interp_computed_ij_fallback.py
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md23
-rw-r--r--docs/boot.md4
-rw-r--r--docs/boot_leads.md39
-rw-r--r--docs/change_gate.md313
-rw-r--r--docs/d3d12_command_objects.md4
-rw-r--r--docs/d3d12_vulkan.md80
-rw-r--r--docs/d3d12_xs_surface.md4
-rw-r--r--docs/descriptor_lookup_ampere.md68
-rw-r--r--docs/design.md4
-rw-r--r--docs/directstorage.md22
-rw-r--r--docs/gdk_public_reference.md56
-rw-r--r--docs/linux.md4
-rw-r--r--docs/mobile.md2
-rw-r--r--docs/mod-menu.md57
-rw-r--r--docs/port_status.md6
-rw-r--r--docs/prompt_glyphs.md84
-rw-r--r--docs/runtime_ctest_hosts.md105
-rw-r--r--docs/testing.md13
18 files changed, 829 insertions, 59 deletions
diff --git a/docs/README.md b/docs/README.md
index a0eeee400..40e9ad264 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -10,7 +10,7 @@ method, scope and caveats. No game data is included.
10|---|---| 10|---|---|
11| [design.md](design.md) | Overall project design, asset status, translator contract and open blockers. | 11| [design.md](design.md) | Overall project design, asset status, translator contract and open blockers. |
12| [related_projects.md](related_projects.md) | Prior art we may read and the licence boundaries on it. | 12| [related_projects.md](related_projects.md) | Prior art we may read and the licence boundaries on it. |
13| [boot_leads.md](boot_leads.md) | Open leads that may move the retail boot further (TLS at module index 0, feature level at device creation, command-list replay, descriptor words, shader corpus count, frame pacing), each with where it lands, how to implement it and how to test it. Hypotheses, not measurements. | 13| [boot_leads.md](boot_leads.md) | Open leads that may move the retail boot further (TLS at module index 0, feature level at device creation, command-list replay, descriptor words, shader corpus count, frame pacing), each with where it lands, how to implement it and how to test it, and a status table: BL-2, BL-5 and BL-6 are done, BL-3 and BL-4 have open pull requests, BL-1 waits for a retail confirmation. |
14| [rpf.md](rpf.md) | RPF9 archive layout, the carve tools and the unreadable encrypted TOC. | 14| [rpf.md](rpf.md) | RPF9 archive layout, the carve tools and the unreadable encrypted TOC. |
15| [linux.md](linux.md) | Linux in one page: what runs natively and what runs under Wine or Proton, the Ubuntu packages, `Build.sh`, the runtime cross-build, and why there is no native Linux `gta6rt`. | 15| [linux.md](linux.md) | Linux in one page: what runs natively and what runs under Wine or Proton, the Ubuntu packages, `Build.sh`, the runtime cross-build, and why there is no native Linux `gta6rt`. |
16| [running.md](running.md) | Running the game per platform and GPU (Linux/Wine with AMD, Linux/Proton and Windows with NVIDIA, Windows with AMD, Intel, macOS): build, shaders, pipeline pre-compile, driver settings, environment, what to expect; each value measured by us, reported by others (linked) or TBD. | 16| [running.md](running.md) | Running the game per platform and GPU (Linux/Wine with AMD, Linux/Proton and Windows with NVIDIA, Windows with AMD, Intel, macOS): build, shaders, pipeline pre-compile, driver settings, environment, what to expect; each value measured by us, reported by others (linked) or TBD. |
@@ -21,6 +21,8 @@ method, scope and caveats. No game data is included.
21| [dev-tools.md](dev-tools.md) | The development CLI `scripts/dev.py`: `discover` (text or `--json`, schema version 1) lists the boot-trace analyzer and the guest-scene runner with their help commands and prerequisites, without running them; live attach, pause, step and screenshots are not available through it. | 21| [dev-tools.md](dev-tools.md) | The development CLI `scripts/dev.py`: `discover` (text or `--json`, schema version 1) lists the boot-trace analyzer and the guest-scene runner with their help commands and prerequisites, without running them; live attach, pause, step and screenshots are not available through it. |
22| [agent_collaboration.md](agent_collaboration.md) | How contributors' coding agents work together through GitHub: which machine profile takes which work, the `AGENT-MSG`, `RUN` and `TEST-WANTED` blocks, and the evidence tags. A convention, not a measurement. | 22| [agent_collaboration.md](agent_collaboration.md) | How contributors' coding agents work together through GitHub: which machine profile takes which work, the `AGENT-MSG`, `RUN` and `TEST-WANTED` blocks, and the evidence tags. A convention, not a measurement. |
23| [history/README.md](history/README.md) | The original repository's surviving history as portable, hashed text: the 251 `old-pr/*` branch tips and the 135 indexed old issues, with the script that regenerates them ([#563](https://github.com/ubiquitarianism/leonida/issues/563)). | 23| [history/README.md](history/README.md) | The original repository's surviving history as portable, hashed text: the 251 `old-pr/*` branch tips and the 135 indexed old issues, with the script that regenerates them ([#563](https://github.com/ubiquitarianism/leonida/issues/563)). |
24| [port_status.md](port_status.md) | Where the port stands: Leonida's runtime and shader pipeline as the base, what was patched in from VIctory, and what is still open. |
25| [port_plan.md](port_plan.md) | What the title needs that Leonida's runtime does not do yet, taken from VIctory, in the order the title hits it and where each fix lands. |
24 26
25## Archives and assets 27## Archives and assets
26 28
@@ -77,6 +79,7 @@ method, scope and caveats. No game data is included.
77| [modding.md](modding.md) | The mod format: a `mods/<folder>/mod.json` next to `gta6rt.exe` or under `--mods DIR`, swapping a named (or `joaat`) archetype for another; the `tools/leonida_mods.py` manager (`Mods.bat` on Windows, `Mods.sh` on Linux and macOS); load order, the start-up log, and the fact that a swap waits for the executable's archetype lookup address (RT-5). | 79| [modding.md](modding.md) | The mod format: a `mods/<folder>/mod.json` next to `gta6rt.exe` or under `--mods DIR`, swapping a named (or `joaat`) archetype for another; the `tools/leonida_mods.py` manager (`Mods.bat` on Windows, `Mods.sh` on Linux and macOS); load order, the start-up log, and the fact that a swap waits for the executable's archetype lookup address (RT-5). |
78| [descriptor_lookup_apple.md](descriptor_lookup_apple.md) | M3 Max GPU timings for texture and sampler descriptor lookups at 1k, 10k and 100k live entries. | 80| [descriptor_lookup_apple.md](descriptor_lookup_apple.md) | M3 Max GPU timings for texture and sampler descriptor lookups at 1k, 10k and 100k live entries. |
79| [descriptor_lookup_ada.md](descriptor_lookup_ada.md) | RTX 4070 SUPER (Ada, Windows) timings for the same lookups in VRAM, host-visible and ReBAR memory. | 81| [descriptor_lookup_ada.md](descriptor_lookup_ada.md) | RTX 4070 SUPER (Ada, Windows) timings for the same lookups in VRAM, host-visible and ReBAR memory. |
82| [descriptor_lookup_ampere.md](descriptor_lookup_ampere.md) | RTX 3070 (Ampere, Windows, PCIe 3.0 x16, ReBAR off) timings for the same lookups in VRAM, host-visible and 214 MiB BAR1 memory. |
80| [descriptor_lookup_intel.md](descriptor_lookup_intel.md) | Intel UHD Graphics 770 (Xe-LP, Windows, driver 101.6129) timings for the same lookups at 1k–100k live entries; both memory placements within 0.6% of each other. | 83| [descriptor_lookup_intel.md](descriptor_lookup_intel.md) | Intel UHD Graphics 770 (Xe-LP, Windows, driver 101.6129) timings for the same lookups at 1k–100k live entries; both memory placements within 0.6% of each other. |
81| [d3d12_xs_surface.md](d3d12_xs_surface.md) | The 116-slot `d3d12_xs.dll` export surface; 83/83 standard GUIDs match the PC SDK. | 84| [d3d12_xs_surface.md](d3d12_xs_surface.md) | The 116-slot `d3d12_xs.dll` export surface; 83/83 standard GUIDs match the PC SDK. |
82| [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. | 85| [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. |
@@ -84,6 +87,7 @@ method, scope and caveats. No game data is included.
84| [d3d12_command_objects.md](d3d12_command_objects.md) | Measured command queue/list/fence/`PresentX` surface; verified vs prior art vs open. | 87| [d3d12_command_objects.md](d3d12_command_objects.md) | Measured command queue/list/fence/`PresentX` surface; verified vs prior art vs open. |
85| [xbox_d3d12_xs.md](xbox_d3d12_xs.md) | The `d3d12_xs` graphics ABI quoted from Microsoft's public GDK reference: root signatures, state objects, DXIL libraries, hit groups, shader cache sessions; which pages are missing or NDA-gated. | 88| [xbox_d3d12_xs.md](xbox_d3d12_xs.md) | The `d3d12_xs` graphics ABI quoted from Microsoft's public GDK reference: root signatures, state objects, DXIL libraries, hit groups, shader cache sessions; which pages are missing or NDA-gated. |
86| [runtime_imports.md](runtime_imports.md) | The 16 shipped modules' measured imports and shim/host/unimplemented split. | 89| [runtime_imports.md](runtime_imports.md) | The 16 shipped modules' measured imports and shim/host/unimplemented split. |
90| [gdk_public_reference.md](gdk_public_reference.md) | How to use the public PC GDK reference and headers to write shims for the imported console APIs: what it covers (XGameRuntime, XTaskQueue, XUser, XStore, XGameSave, GameInput), what it does not (`d3d12_xs`, NDA), the 4-step method and the lines not to cross. A convention, not a measurement. |
87| [linux_proton.md](linux_proton.md) | Building and booting under Proton/Wine on Linux, one bounded game run with `scripts/run_game_wine.sh`, a healthy boot's timeline, and the test report of one Linux and two Windows machines | 91| [linux_proton.md](linux_proton.md) | Building and booting under Proton/Wine on Linux, one bounded game run with `scripts/run_game_wine.sh`, a healthy boot's timeline, and the test report of one Linux and two Windows machines |
88| [xmem_exe_calls.md](xmem_exe_calls.md) | How the retail executable calls `xmem.dll`: call sites and constant arguments per import (`tools/import_call_sites.py`), the 23 `XMemVirtualAlloc` calls that all pass an attribute word, and the inferred shape of the physical-page family. | 92| [xmem_exe_calls.md](xmem_exe_calls.md) | How the retail executable calls `xmem.dll`: call sites and constant arguments per import (`tools/import_call_sites.py`), the 23 `XMemVirtualAlloc` calls that all pass an attribute word, and the inferred shape of the physical-page family. |
89| [exe_fail_fast.md](exe_fail_fast.md) | Where the retail executable stops itself (`int3`) on an import's result: 78 sites over 27 imports (`tools/import_fail_fast.py`), grouped by how `main` binds each import (all 13 non-host fatal-checked imports now bind to shims; 0 unbound). | 93| [exe_fail_fast.md](exe_fail_fast.md) | Where the retail executable stops itself (`int3`) on an import's result: 78 sites over 27 imports (`tools/import_fail_fast.py`), grouped by how `main` binds each import (all 13 non-host fatal-checked imports now bind to shims; 0 unbound). |
@@ -92,11 +96,14 @@ method, scope and caveats. No game data is included.
92| [cpu_features.md](cpu_features.md) | CPU instructions in the executable a desktop CPU may lack (`tools/cpu_feature_scan.py`): 19 SSE4a, 10 CLZERO and 4 MONITORX/MWAITX sites (AMD only) and 8 CLWB sites (Intel since Ice Lake), all real code; `#UD` on hosts without them. | 96| [cpu_features.md](cpu_features.md) | CPU instructions in the executable a desktop CPU may lack (`tools/cpu_feature_scan.py`): 19 SSE4a, 10 CLZERO and 4 MONITORX/MWAITX sites (AMD only) and 8 CLWB sites (Intel since Ice Lake), all real code; `#UD` on hosts without them. |
93| [xcl_compare.md](xcl_compare.md) | XCL's synthetic test title under `gta6rt --run` and under XCL (`tools/xcl_compare.py`): 5 of 50 checks pass here, both hangs are the documented manual-queue terminate deadlock, and each other difference mapped to an open item or a lead. | 97| [xcl_compare.md](xcl_compare.md) | XCL's synthetic test title under `gta6rt --run` and under XCL (`tools/xcl_compare.py`): 5 of 50 checks pass here, both hangs are the documented manual-queue terminate deadlock, and each other difference mapped to an open item or a lead. |
94| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; without SDL3, one scripted pad for `LEONIDA_INPUT_SCRIPT`; 261 checks on virtual joysticks and a fake haptic backend; by hand on an Xbox Series X pad (Bluetooth) and a DualSense (USB). 261 checks on virtual joysticks and a fake haptic backend, not yet tried on a real pad. | 98| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; without SDL3, one scripted pad for `LEONIDA_INPUT_SCRIPT`; 261 checks on virtual joysticks and a fake haptic backend; by hand on an Xbox Series X pad (Bluetooth) and a DualSense (USB). 261 checks on virtual joysticks and a fake haptic backend, not yet tried on a real pad. |
95| [prompt_glyphs.md](prompt_glyphs.md) | The title's one button-prompt movie (a Scaleform GFX of 38 Xbox glyph sprites, `platform_xbsx.input_icons.Main_Button_<N>`): where it is in `data.rpf`, its tags and canvas sizes, which N is which button, which class of the larger movies asks for a glyph and when, the original PlayStation-style replacement `tools/ps_prompt_glyphs.py` builds, the keyboard-and-mouse set `tools/pc_prompt_glyphs.py` traces from the player's pictures, how the runtime serves the one for the device in use, and why the glyphs cannot follow a switch of device during play. | 99| [prompt_glyphs.md](prompt_glyphs.md) | The title's one button-prompt movie (a Scaleform GFX of 38 Xbox glyph sprites, `platform_xbsx.input_icons.Main_Button_<N>`): where it is in `data.rpf`, its tags and canvas sizes, which N is which button, which class of the larger movies asks for a glyph and when, the original PlayStation-style replacement `tools/ps_prompt_glyphs.py` builds, the keyboard-and-mouse set `tools/pc_prompt_glyphs.py` draws itself (key caps fitted to the Xbox glyphs' size) or traces from the player's pictures, `tools/prompt_glyph_movies.py`, which builds both for the launcher and make_game.py, how the runtime serves the one for the device in use, and why the glyphs cannot follow a switch of device during play. |
96| [vi_patch.md](vi_patch.md) | ZiZc3's VI-Patch (game patches for the PS5 build) on the Xbox executable: the title's frame limiter and the 60 fps patch that is always on (RVAs `0x224359a`, `0x1e0fc62`), no vignette behind `LEONIDA_VIPATCH_NO_VIGNETTE=1` (the `spotmeter_aiming` and `spotmeter_fast` exposure profiles), and why the other six are not found or not ported; no licence, so only what each patch does is taken. | 100| [vi_patch.md](vi_patch.md) | ZiZc3's VI-Patch (game patches for the PS5 build) on the Xbox executable: the title's frame limiter and the 60 fps patch that is always on (RVAs `0x224359a`, `0x1e0fc62`), no vignette behind `LEONIDA_VIPATCH_NO_VIGNETTE=1` (the `spotmeter_aiming` and `spotmeter_fast` exposure profiles), and why the other six are not found or not ported; no licence, so only what each patch does is taken. |
97| [victory_gap_media.md](victory_gap_media.md) | VIctory's audio, DSP, media, speech and GameInput modules against Leonida, export by export: what was already the same, what `port/gap-media` ported (the XInput/keyboard GameInput shim for builds without SDL3, `#1` registration, silent speech, the local-only Media Foundation resolver) and what is left (Opus decoding, diagnostics aids). | 101| [victory_gap_media.md](victory_gap_media.md) | VIctory's audio, DSP, media, speech and GameInput modules against Leonida, export by export: what was already the same, what `port/gap-media` ported (the XInput/keyboard GameInput shim for builds without SDL3, `#1` registration, silent speech, the local-only Media Foundation resolver) and what is left (Opus decoding, diagnostics aids). |
102| [victory_gap_gpu.md](victory_gap_gpu.md) | VIctory against Leonida on the console D3D12 surface (`d3d12x`, display, FidelityFX, DirectStorage, the GPU crate): what was the same, what `port/gap-gpu` ported and what is left. |
103| [victory_gap_system.md](victory_gap_system.md) | VIctory against Leonida in the system modules and the loader (kernel, xmem, files, lifecycle, xsystem, xpackage...): what `port/gap-system` ported, each piece naming its VIctory source. |
98| [saves.md](saves.md) | Save containers: `JSAV` (index + JSON story save, byte-exact rebuild), `ASAV` header, `SLAYER1` packed copy (not decoded); `tools/saves.py` and import into the offline `XGameSave` folder; key hashes are case-sensitive joaat (`tools/save_keys.py`). | 104| [saves.md](saves.md) | Save containers: `JSAV` (index + JSON story save, byte-exact rebuild), `ASAV` header, `SLAYER1` packed copy (not decoded); `tools/saves.py` and import into the offline `XGameSave` folder; key hashes are case-sensitive joaat (`tools/save_keys.py`). |
99| [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: the full corpus, 26,503 of 26,503 modules and pipelines, 0 failures (RTX 4060 Ti); an earlier 10/12-shard run, 22,092 modules and 2,217 compute pipelines, also had 0 failures. Driver-level corpus check: 10/12 shards, 22,092 modules, 2,217 compute pipelines, 0 failures. | 105| [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: the full corpus, 26,503 of 26,503 modules and pipelines, 0 failures (RTX 4060 Ti); an earlier 10/12-shard run, 22,092 modules and 2,217 compute pipelines, also had 0 failures. Driver-level corpus check: 10/12 shards, 22,092 modules, 2,217 compute pipelines, 0 failures. |
106| [runtime_ctest_hosts.md](runtime_ctest_hosts.md) | The runtime ctest suite on two hosts, Wine and native Windows 10, on one Pascal card: the 19 failures that are Wine's host, the 5 that reproduce (ours), and the 6 that only fail natively, deterministic, including a SegFault. |
100| [multi_gpu_validation.md](multi_gpu_validation.md) | Running disjoint shards on eight identical RDNA1/RADV GPUs: PCI-BDF pinning, base controls, per-card logs, the V540 farm's aggregate results and its known driver limitations. | 107| [multi_gpu_validation.md](multi_gpu_validation.md) | Running disjoint shards on eight identical RDNA1/RADV GPUs: PCI-BDF pinning, base controls, per-card logs, the V540 farm's aggregate results and its known driver limitations. |
101| [shader_validation.md](shader_validation.md) | Differential CPU/GPU validation design and the current CPU interpreter prototype. | 108| [shader_validation.md](shader_validation.md) | Differential CPU/GPU validation design and the current CPU interpreter prototype. |
102| [isa_coverage.md](isa_coverage.md) | RDNA2 ISA coverage of the translator against AMD's machine-readable XML: which of its 1,153 instructions have a rule, and which matched names are not RDNA2. | 109| [isa_coverage.md](isa_coverage.md) | RDNA2 ISA coverage of the translator against AMD's machine-readable XML: which of its 1,153 instructions have a rule, and which matched names are not RDNA2. |
@@ -114,6 +121,18 @@ method, scope and caveats. No game data is included.
114| [mission_logic.md](mission_logic.md) | Mission state tables: 0x20 record layout (band counter, byte offsets), the 64-byte pool element with world transforms, case-folding joaat keys, 53.5 % of states named, 113 state-set clusters covering 82.4 % of files. | 121| [mission_logic.md](mission_logic.md) | Mission state tables: 0x20 record layout (band counter, byte offsets), the 64-byte pool element with world transforms, case-folding joaat keys, 53.5 % of states named, 113 state-set clusters covering 82.4 % of files. |
115| [gbuffer.md](gbuffer.md) | Deferred G-buffer targets (`PS_DeferredTextured` and all 2,989 `*Deferred*` pixel shaders, `PROC-146`): 5- and 6-target `OSG1`/`PSV0` signatures (`float32` + `exp ... compr` on all outputs), the 24-bit octahedral normal split across `mrt1.gba` (`2047.5` scale, `1/255` byte packing), sqrt-encoded `mrt2`, byte IDs in `mrt3.zw`, float motion in `mrt4`, and why binding `f16` targets mangles the normal bytes. | 122| [gbuffer.md](gbuffer.md) | Deferred G-buffer targets (`PS_DeferredTextured` and all 2,989 `*Deferred*` pixel shaders, `PROC-146`): 5- and 6-target `OSG1`/`PSV0` signatures (`float32` + `exp ... compr` on all outputs), the 24-bit octahedral normal split across `mrt1.gba` (`2047.5` scale, `1/255` byte packing), sqrt-encoded `mrt2`, byte IDs in `mrt3.zw`, float motion in `mrt4`, and why binding `f16` targets mangles the normal bytes. |
116 123
124## Runtime features, tools and proposals
125
126| Document | What it covers |
127|---|---|
128| [launcher.md](launcher.md) | The Leonida Launcher: the desktop window with navigation, a PLAY button, status line and pages; Leonida's own design, no game assets. |
129| [mod-menu.md](mod-menu.md) | The in-game trainer menu drawn by the D3D12 runtime (`d3d12/`): on by default, `LEONIDA_MENU=0` turns it off; single player only, nothing online. |
130| [lua-modding.md](lua-modding.md) | Lua 5.4 mods in the D3D12 runtime: a folder in `mods\` with the same `mod.json` the mod manager lists, and a script next to it. |
131| [ultrawide.md](ultrawide.md) | How the output size goes from the window to the title and back to the screen, and what the opt-in 21:9 and 32:9 settings change; measured versus hypothesis marked. |
132| [test_inventory.md](test_inventory.md) | The subsystem test map and prerequisite catalog (`tools/test_inventory.py`, DX-10): how test modules across `tests/` and `runtime/test/` are discovered and grouped. |
133| [junit_triage.md](junit_triage.md) | Comparing two JUnit XML reports (`tools/junit_triage.py`, e.g. from `ctest --output-junit`): aggregate counts only, never test names or output. |
134| [change_gate.md](change_gate.md) | A proposal, not implemented: a change gate for module boundaries, function complexity and doubled text, with the numbers measured on the merge history. |
135
117## Other languages 136## Other languages
118 137
119Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `pt-PT`, `zh-CN`, `pl-PL`, `tr`, `ru`, `ja`, `es`, `it`, `de`, `ar`, `vi`). 138Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `pt-PT`, `zh-CN`, `pl-PL`, `tr`, `ru`, `ja`, `es`, `it`, `de`, `ar`, `vi`).
diff --git a/docs/boot.md b/docs/boot.md
index 864ac0993..688d91dd1 100644
--- a/docs/boot.md
+++ b/docs/boot.md
@@ -109,6 +109,10 @@ Useful switches:
109 read when the trace opens. 109 read when the trace opens.
110 Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file 110 Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file
111 open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on. 111 open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on.
112* `LEONIDA_SKIP_ASSERTS=N` steps over up to N int3 in guest code, with or without `--trace`, and prints each one
113 as `[rt] LEONIDA_SKIP_ASSERTS: int3 at <module>+0x... stepped over (k of N)`; the next one after N ends the run as
114 before. An int3 in a host module is never stepped over. The same caveat: each skipped address is a finding
115 ([runtime/README.md](../runtime/README.md), "Guest asserts").
112* `LEONIDA_STUB_PIPELINES=1` creates a pipeline whose translated shader is missing (no shader library, or no entry 116* `LEONIDA_STUB_PIPELINES=1` creates a pipeline whose translated shader is missing (no shader library, or no entry
113 for its program) as a stub instead of failing `CreateGraphicsPipelineState` / `CreateComputePipelineState`. 117 for its program) as a stub instead of failing `CreateGraphicsPipelineState` / `CreateComputePipelineState`.
114 A graphics pipeline with a vertex stage (MVP-GPU-04) is a real Vulkan pipeline built from the built-in stages in 118 A graphics pipeline with a vertex stage (MVP-GPU-04) is a real Vulkan pipeline built from the built-in stages in
diff --git a/docs/boot_leads.md b/docs/boot_leads.md
index b3e0207f9..c45c590eb 100644
--- a/docs/boot_leads.md
+++ b/docs/boot_leads.md
@@ -1,9 +1,19 @@
1# Boot leads: open findings and how to implement them 1# Boot leads: open findings and how to implement them
2 2
3Open leads that may move the retail boot further, each with where it lands in this repository and how to check it. 3Leads that may move the retail boot further, each with where it lands in this repository and how to check it.
4Every item is a **hypothesis**: it has not been measured against this package or run in this runtime. Confirm it on 4Every lead started as a **hypothesis**. Its **Status** line says whether a merged pull request has answered it, an
5your own copy or with a synthetic test before you build on it, and record the result in the document named under 5open one is working on it, or nothing has yet. What is not marked done there has not been measured against this
6**Record it in**. 6package or run in this runtime: confirm it on your own copy or with a synthetic test before you build on it, and
7record the result in the document named under **Record it in**.
8
9| Lead | Status |
10|---|---|
11| BL-1 TLS from module index 0 | Done on `main` with a synthetic test; the retail confirmation is pending |
12| BL-2 Feature level at device creation | Done: #913 |
13| BL-3 Replay the console command list | In progress: #1050 (open) |
14| BL-4 Descriptor words as 32-bit addresses | Done: #1166 (no bare 32-bit addresses in the census) |
15| BL-5 Shader corpus count | Done: #882 (a counting difference; the carve misses nothing) |
16| BL-6 Frame pacing drift reporting | Done: #891; real numbers still need a retail run |
7 17
8## Rules 18## Rules
9 19
@@ -52,6 +62,12 @@ your own copy or with a synthetic test before you build on it, and record the re
52 succeed when asked for 12.0. 62 succeed when asked for 12.0.
53- **Where:** `CheckFeatureSupport` reports levels up to 12_1 (`runtime/shims/d3d12_vulkan_device.cpp`, the 63- **Where:** `CheckFeatureSupport` reports levels up to 12_1 (`runtime/shims/d3d12_vulkan_device.cpp`, the
54 `D3D12_FEATURE_FEATURE_LEVELS` case); the Xbox entry point is in `runtime/shims/d3d12_xs_device.cpp`. 64 `D3D12_FEATURE_FEATURE_LEVELS` case); the Xbox entry point is in `runtime/shims/d3d12_xs_device.cpp`.
65- **Status:** done by #913 (merged in `531aa4f5`). The minimum was the problem, not the reported level: the host path
66 of `D3D12XboxCreateDevice` asked the PC `D3D12CreateDevice` for 12_0 as its minimum, which refuses every adapter
67 below it. `rt::d3d12_xs::create_host_device` now asks for `kHostDeviceFloor` = 11_0, and the device reports its
68 own highest level. `xs_proxy_mock_test` covers mock hosts that top out at 11_0 through 12_2. The write-up is in
69 [d3d12_xs_surface.md](d3d12_xs_surface.md) ("Feature level at device creation (BL-2)"). Still open: reproducing the
70 original failure on the Wine or Proton host it came from.
55- **Implement:** read the level the title passes at creation and make the layer accept the full range it can 71- **Implement:** read the level the title passes at creation and make the layer accept the full range it can
56 satisfy, returning the highest supported level through the feature-level query rather than failing creation on a 72 satisfy, returning the highest supported level through the feature-level query rather than failing creation on a
57 lower request. Report 12_2 only where mesh shaders and ray tracing are present 73 lower request. Report 12_2 only where mesh shaders and ray tracing are present
@@ -67,6 +83,8 @@ your own copy or with a synthetic test before you build on it, and record the re
67 list is closed or executed than by translating each call as it is made. 83 list is closed or executed than by translating each call as it is made.
68- **Where:** the "console list tail" listed as open in the README's D3D12 → Vulkan row and in 84- **Where:** the "console list tail" listed as open in the README's D3D12 → Vulkan row and in
69 [d3d12_vulkan.md](d3d12_vulkan.md); call orders are in [d3d12_command_objects.md](d3d12_command_objects.md). 85 [d3d12_vulkan.md](d3d12_vulkan.md); call orders are in [d3d12_command_objects.md](d3d12_command_objects.md).
86- **Status:** in progress in #1050 (open: "replay the console list's inline records as their vtable calls"). Read it
87 and its review before starting work of your own here.
70- **Implement:** record the console-only calls into a per-list buffer, then translate them to Vulkan in order at 88- **Implement:** record the console-only calls into a per-list buffer, then translate them to Vulkan in order at
71 `Close`/`Execute`. Keep calls that must take effect immediately (those whose results the title reads back) out of 89 `Close`/`Execute`. Keep calls that must take effect immediately (those whose results the title reads back) out of
72 the buffer. 90 the buffer.
@@ -86,6 +104,8 @@ your own copy or with a synthetic test before you build on it, and record the re
86 1,296 slots of interleaved constant data; and **0 slots that are bare 32-bit GPU addresses**. 104 1,296 slots of interleaved constant data; and **0 slots that are bare 32-bit GPU addresses**.
87- **Conclusion:** BL-4 hypothesis is not supported on this stack. Descriptors pack 48-bit addresses into V# / T# fields rather 105- **Conclusion:** BL-4 hypothesis is not supported on this stack. Descriptors pack 48-bit addresses into V# / T# fields rather
88 than exposing bare 32-bit pointer words. Characterized by model-level reference contract suite `tests/test_descriptor_address_translation.py` (53 tests modeling the documented arena bitfield partitioning and address extraction contracts). 106 than exposing bare 32-bit pointer words. Characterized by model-level reference contract suite `tests/test_descriptor_address_translation.py` (53 tests modeling the documented arena bitfield partitioning and address extraction contracts).
107- **Status:** done by #1166 (merged in `95eacfa7c`): the census found no bare 32-bit addresses, so the
108 hypothesis is not supported on this stack.
89- **Record it in:** [d3d12_vulkan.md](d3d12_vulkan.md) §3.4 with the census breakdown. 109- **Record it in:** [d3d12_vulkan.md](d3d12_vulkan.md) §3.4 with the census breakdown.
90- **Needs:** none (census completed and verified). 110- **Needs:** none (census completed and verified).
91 111
@@ -96,6 +116,12 @@ your own copy or with a synthetic test before you build on it, and record the re
96 misses. 116 misses.
97- **Where:** the carve and library tools (`make_game.py`, `tools/shader_carve.py`, `tools/shader_library.py`) and 117- **Where:** the carve and library tools (`make_game.py`, `tools/shader_carve.py`, `tools/shader_library.py`) and
98 [shader_library.md](shader_library.md). 118 [shader_library.md](shader_library.md).
119- **Status:** done by #882 (merged in `71f99e22`): a counting difference, not a gap. 26,503 counts carved `DXBC`
120 containers and 26,698 counts the `FSSM` payloads in them; the 195 extra are vertex-shader containers that also hold
121 the export-shader build of the same shader for a legacy geometry-shader pipeline. `tools/fssm_unpack.py` prints
122 both counts and a line per stage; the table is in [shader_library.md](shader_library.md) ("Containers and
123 programs"). Still open: which payload a geometry-shader pipeline selects ([fssm_crosscheck.md](fssm_crosscheck.md)
124 §6); the 195 export-stage variants are not translated yet.
99- **Implement:** list how programs are enumerated (per file, per container, per variant) and print a breakdown by 125- **Implement:** list how programs are enumerated (per file, per container, per variant) and print a breakdown by
100 stage. If the 195 are a counting difference, document it. If they are real, find where the carve skips them and fix 126 stage. If the 195 are a counting difference, document it. If they are real, find where the carve skips them and fix
101 that, not the count. 127 that, not the count.
@@ -110,6 +136,11 @@ your own copy or with a synthetic test before you build on it, and record the re
110 figures make that visible. 136 figures make that visible.
111- **Where:** the frame pacer in `runtime/src/frame_pacer.h` and its `PresentX` wiring in 137- **Where:** the frame pacer in `runtime/src/frame_pacer.h` and its `PresentX` wiring in
112 `runtime/shims/xbox_present.cpp`. 138 `runtime/shims/xbox_present.cpp`.
139- **Status:** done by #891 (merged in `3ba069eb`). `FramePacer` keeps ring buffers of frame times and
140 origin-to-present latencies (`frame_pacing_window` = 1024), `XboxPresentation` logs a pacing summary at teardown,
141 and `tools/boot_trace.py` reports it (p50/p95/p99, mean and drift against target);
142 `runtime/test/frame_pacer_test.cpp` checks it with a fake clock. Recorded in [d3d12_vulkan.md](d3d12_vulkan.md)
143 ("Pacing drift reporting (BL-6)") and [boot.md](boot.md). Still open: numbers from a retail run.
113- **Implement:** record frame times in a ring buffer and report p50, p95 and p99 plus the drift of the mean against 144- **Implement:** record frame times in a ring buffer and report p50, p95 and p99 plus the drift of the mean against
114 the target interval, in the run summary beside the existing D3D12 counts ([boot.md](boot.md)). 145 the target interval, in the run summary beside the existing D3D12 counts ([boot.md](boot.md)).
115- **Test:** extend `runtime/test/frame_pacer_test.cpp` with a fake clock feeding known intervals, asserting the 146- **Test:** extend `runtime/test/frame_pacer_test.cpp` with a fake clock feeding known intervals, asserting the
diff --git a/docs/change_gate.md b/docs/change_gate.md
new file mode 100644
index 000000000..5b4dcb355
--- /dev/null
+++ b/docs/change_gate.md
@@ -0,0 +1,313 @@
1# Proposal: a change gate for module boundaries, function complexity and doubled text
2
3**Status: a proposal for the maintainer's decision; nothing on this page is implemented, and the pull request that
4adds it changes no other file. The numbers were measured at `dde82f2` on the tree and on the 300 squash merges
5that end with it (one merge round on 2026-11-23 in the original repository, whose history this one carries), with a standard-library prototype that is
6not part of this pull request.**
7
8GitHub's search counts 3,680 pull requests merged in the original repository from 2026-11-21 to 2026-11-23. [AGENTS.md](../AGENTS.md) is
9written for the coding agents that many contributors use, and the template asks about them. Review and CI catch
10what a diff shows and what a test exercises. Three things a diff does not show: a new dependency on another part of
11the tree, hidden behind a `sys.path` insert; a function that has grown past the point where a person or an agent can
12change it without breaking a case it did not look at; and text that a merge doubled. This page proposes one
13deterministic check for those three. It compares a pull request with its base, blocks only what the pull request
14adds, tolerates what is already on `main`, and tells the author why a finding matters and how to fix it. Because CI
15had finished on few pull requests when they were merged (section 1.4), it runs where the code is written and in the
16merge round as well as in CI.
17
18Claims are marked:
19
20- **Measured** — counted on the tree or the history at `dde82f2`; section 6 says how.
21- **Proposed** — what this page asks the maintainer to accept.
22- **Open** — a question for the maintainer, collected in section 5.
23
24## 1. What was measured
25
26### 1.1 Dependencies between parts of the tree
27
28**Measured.** Python files reach each other through 1,262 `sys.path.insert` calls, which is why 1,527 imports carry
29`# noqa: E402`. Resolving those paths gives 2,182 import edges between repository files.
30These boundaries hold today with no exception:
31
32- `make_game.py` imports only `tools/`.
33- `viewer/` imports nothing from the repository.
34- `tools/` never imports `scripts/`, `make_game.py` or `viewer/`; `scripts/` never imports `tests/`.
35- No import cycle crosses two areas; inside `tools/` there are two, each of two files
36 (`tools/calibrated_texture.py` with `tools/ttpf_mips.py`, `tools/hw_oracle/drm.py` with `tools/hw_oracle/runner.py`).
37- No production C++ file (`runtime/src`, `runtime/shims`, `runtime/xma_decoder`) includes a `runtime/test` file, and
38 no file-level `#include` cycle exists.
39
40One boundary is crossed: production code imports test code through 39 edges from 32 files. 26 edges go from
41`tools/` to `tests/`, 22 of them to `tests/semantic/spirv_mini_interp.py`, which is in effect a shared reference
42interpreter kept in a test folder; 8 go from `tools/` and 5 from `scripts/` to the GPU fixture helpers in
43`runtime/test/shaders`. The `scripts/` ones are test runners (`scripts/run_gpu_tests.py`,
44`scripts/bench_wave64.py`) using the fixture helpers they run, and the rules below allow them. Two of the 300 merges
45added another edge from `tools/`, both new tools that copied the pattern (`tools/wave_diff.py:53` in `db77244`,
46`tools/div_fixup_diff.py:104` in `5e54bda`).
47
48To be fair to the current setup: 31 of the 32 importing files are themselves imported by a test, so an edit to
49`spirv_mini_interp.py` that breaks a tool makes a test fail once CI runs (section 1.4 shows how often it has not
50run by the merge). What the edge costs even then is legibility. The file looks like test code, and nothing beside it says that 22 tools depend on
51it; an author, human or agent, edits it with that context missing.
52
53The C++ runtime has one directory-level cycle: `runtime/shims` includes `runtime/src` 27 times, and `runtime/src`
54includes `runtime/shims` 7 times, all from `runtime/src/main.cpp` and `runtime/src/pe_loader.cpp`. Whether that is the
55intended layering is question 5 in section 5.
56
57### 1.2 Function complexity
58
59**Measured**, cyclomatic complexity (McCabe for Python, lizard's CCN for C++; section 6):
60
61| Area | Functions | Complexity 11-20 | 21-50 | Above 50 | Largest |
62|---|---|---|---|---|---|
63| `tools/` (Python) | 5,579 | 774 | 399 | 95 | 1,261 |
64| `make_game.py` and `scripts/` | 291 | 37 | 15 | 3 | 280 |
65| `runtime/src` and `runtime/shims` (C++) | 2,514 | 165 | 88 | 27 | 370 |
66
67The largest is `Gen._insn` in `tools/rdna2spirv.py` (line 6722): 4,889 lines and a complexity of 1,261 in an
6818,229-line file. One `if`/`elif` chain of 182 arms holds nearly all of that; section 2.3 judges such a function arm
69by arm.
70
71What the 300 merges did to production functions, checked with the rule proposed in section 2.3:
7289 findings in 48 pull requests. Each was labelled after reading its diff
73(section 6 says by whom): 66 made a function measurably harder to change (new nested logic, a 9 -> 20 or 10 -> 27
74jump, an optional feature threaded through an existing function), 21 are correct measurements whose value is
75arguable, and 2 are artefacts of the tool (section 2.3 lists them). Examples of the first kind:
76
77| Commit | Function | Complexity before -> after |
78|---|---|---|
79| `0a8a552` | `export_bank` in `tools/awc_opus.py` | 19 -> 30 |
80| `9a9ca1e` | `ExecuteIndirect` in `runtime/shims/d3d12_com.cpp` | 10 -> 27 |
81| `21e72aa` | `scan_offsets` in `tools/smh_groom.py` | 9 -> 20 |
82| `86d1c86` | `verify_manifest` in `tools/manifest_verifier.py` | 23 -> 33 |
83| `c1aa89e` | `verify` in `tools/world_drawable_verify.py` (new) | 34 |
84
85### 1.3 Text doubled by a merge
86
87**Measured.** Eight blocks of six or more lines repeat within the same file on `main`, the trace of a pull request
88merged twice or a conflict resolved by keeping both sides (line numbers of the first and last non-blank line of each
89copy; the last row is the first nine lines of the row four above it, which appear a third time):
90
91| File | First copy | Second copy |
92|---|---|---|
93| `docs/models.md` | 568-651 | 653-736 |
94| `docs/animation.md` | 971-1023 | 1052-1104 |
95| `docs/animation.md` | 1025-1050 | 1106-1131 |
96| `docs/shader_validation.md` | 1998-2040 | 2061-2103 |
97| `docs/gbuffer.md` | 13-49 | 52-88 |
98| `docs/testing.md` | 337-353 | 355-371 |
99| `docs/design.md` | 576-590 | 592-606 |
100| `docs/shader_validation.md` | 2061-2069 | 2174-2182 |
101
102The existing guards pass on all of them: `tests/test_docs_repeated_lines.py` compares prose lines at most three lines
103apart and `tests/test_docs_list_items.py` list items at most eight apart, which a doubled section of 84 lines never
104is. `scripts/merge_check.py` finds the doubling when it is run before a merge round; nothing finds it after. No new
105doubled block appeared in the 300 merges, so this part of the check guards a failure that is rare now, not frequent.
106
107### 1.4 Whether a check runs before the merge
108
109**Measured** in the original repository. GitHub's search returned 1,000 of the 1,252 pull requests merged there on 2026-11-23 (it stops at 1,000);
110all of them came from forks. The CI workflow on the head commit each was merged with had:
111
112| CI workflow at merge | Pull requests |
113|---|---|
114| passed | 55 |
115| failed | 282 |
116| queued, pending or still running | 661 |
117| cancelled, or no run | 2 |
118
119After a merge the push run does not finish either: 164 of the last 165 CI runs for pushes to `main` were cancelled
120by the next push, and the last one was still pending when read (2026-11-23, about 20:00 UTC). At `867d922` three
121documentation tests fail on `main`. `tests/test_docs_cli_flags.py` and `tests/test_docs_links.py` have failed since `cc67780`, and later
122merges changed the items they report; `tests/test_docs_design_rows.py` has failed since `0980bea` (both found with
123`git bisect`). Neither pull request had a finished CI run when it was merged.
124
125So a check that lives only in a CI job would have run before the merge for about one pull request in eighteen. This repository merges the same way: of
126its 40 most recently merged pull requests (read on 2026-11-24 at about 03:20 UTC), 19 had no CI run at merge, 18 had
127at least one failing CI job, 2 had jobs still pending and 1 had only passing or skipped jobs.
128Section 2.1 therefore puts it where the code is written and where merges are decided, not only in CI.
129
130## 2. The proposed check
131
132### 2.1 How it runs
133
134**Proposed.** One standard-library script under `scripts/`, run with `python -I` like the other tools. The same
135command gives the same verdict in three places:
136
137- **By the author, before opening or updating the pull request.** It compares the working tree with the merge base
138 of `origin/main`. [AGENTS.md](../AGENTS.md) gives an agent the command, and the pull request's `Tested` section
139 names the result, the way it names the tests that were run.
140- **In the merge round, before the push.** One command takes the round's pull requests in merge order and checks each
141 against `main` plus the ones before it, the way `scripts/merge_check.py` checks a round for repeated merges. It
142 needs no runner, so it does not wait for CI approval or a free runner slot.
143- **In CI, when the pull request's run is approved.** It compares the test merge with its first parent, as the
144 `change-scope` job of `ci.yml` already does.
145- It looks only at what the pull request changed: the files it touched are parsed again, the import and include
146 graphs are re-linked, and the functions whose lines changed are measured on both sides. On the 300 merges the
147 prototype took 80 ms per pull request (90th percentile 170 ms, slowest 1.9 s); building the state
148 of a whole tree from cold takes 8.2 s, so a CI job without a cache costs about ten seconds.
149- What is on the base is tolerated by construction, so there is no baseline list for every pull request to edit and
150 conflict on. The one shared file is the exception list (section 2.5), which changes only when a reviewer approves an
151 exception.
152- No model, no network, no service: the verdict is the same on every machine. C++ complexity uses lizard, pinned in
153 the CI job; everything else is the standard library.
154
155### 2.2 The rules
156
157**Proposed.** "Blocks" means the CI job fails; "reports" means the finding is listed and the job passes.
158
159| ID | Rule | Kind | On `main` today | Findings in the 300 merges |
160|---|---|---|---|---|
161| P1 | `make_game.py` imports only `tools/` | blocks | 0 | 0 |
162| P2 | `viewer/` imports nothing from the repository | blocks | 0 | 0 |
163| P3 | `tools/` does not import `scripts/`, `make_game.py` or `viewer/` | blocks | 0 | 0 |
164| P4 | `tools/` does not import `tests/` or `runtime/` | blocks | 34 edges, tolerated | 2 |
165| P5 | `scripts/` does not import `tests/`, `make_game.py` or `viewer/` | blocks | 0 | 0 |
166| P6 | no new or larger Python import cycle | blocks | 2 cycles, tolerated | 0 |
167| C1 | production C++ does not include `runtime/test` | blocks | 0 | 0 |
168| C2 | no new or larger `#include` cycle | blocks | 0 | 0 |
169| D1 | no new block of six lines repeated within one Markdown file | blocks | 8 blocks, tolerated | 0 |
170| X1 | a new production function has complexity 10 or lower | blocks | — | 44 in 23 pull requests |
171| X2 | a changed production function at 10 or lower stays at 12 or lower (`main`: 15) | blocks | — | 4 in 4 pull requests |
172| X3 | a changed production function above 10 grows by at most 2 (`main`: 5) | blocks | — | 41 in 31 pull requests |
173| R1 | a block of six or more code lines that duplicates code elsewhere | reports | — | 138 |
174| R2 | an added skip or suppression (`unittest.skip`, `# noqa` other than E402, `# type: ignore`, ...) | reports | — | 24 |
175
176An edge counts as new when it exists in the pull request and not in its base; a cycle counts as new when it is not
177contained in one cycle of the base. Existing edges and cycles are never reported again.
178
179### 2.3 The complexity rules in detail
180
181**Proposed.**
182
183- Production code only: `tools/`, `scripts/`, `make_game.py`, `viewer/`, `runtime/src`, `runtime/shims` and
184 `runtime/xma_decoder`. Tests are left out; a test that checks forty cases in a row is long, not tangled.
185- Python complexity is McCabe's: one plus each `if`/`elif`, conditional expression, `for`, `while`, `except`, each
186 extra operand of `and`/`or`, each `for` and `if` of a comprehension, and each `case`. Nested functions are measured
187 on their own. C++ uses lizard's CCN.
188- A function counts as changed when any of its lines changed; it is compared with the function of the same qualified
189 name in the base.
190- Dispatch functions are judged one arm at a time. A function is a dispatch function when one `if`/`elif` chain
191 testing a single subject against constants (`op == "..."`, `name in (...)`, `isinstance(x, ...)`) has at least
192 eight arms and holds at least half of its decision points. A new arm then needs a complexity of 10 or lower, a
193 changed arm keeps the +2 allowance, and code outside the arms may grow by 2. Adding a translator rule as one more
194 arm of `Gen._insn` passes; adding a 14-branch arm does not.
195- `main` and `wmain` may grow by 5 instead of 2, because argument and input checks land there. In the 300 merges
196 this let 18 additions through, all labelled arguable: argument and input checks, and one +3 of other logic in
197 `tools/hashdict.py`. `make_game.py` `main` going from 53 to 59 in one pull request still fails.
198- Known artefacts, both from the 300 merges: `slot_name` in `runtime/shims/d3d12_xs_device.cpp` grew by five `case`
199 labels of a name table (a C++ function is judged whole, since lizard reports no arms); the `VulkanPresenter`
200 constructor in `runtime/src/vulkan_present.h` gained a parameter, so its name changed and it was judged as a new
201 function. A renamed or moved function is judged as new in the same way.
202
203### 2.4 What the author sees
204
205**Proposed.** Every finding carries four parts: why the rule exists, exactly what triggered it, a fix chosen from the
206shape of the change, and how to ask for an exception. The same findings are written three ways: a GitHub annotation on
207the line in the pull request's diff, a job summary with the full text, and plain text for a local run. The prototype's
208output for `0a8a552`, which grew `export_bank` from 19 to 30:
209
210```text
211ERROR X3 tools/awc_opus.py:381 export_bank went from complexity 19 to 30; a changed function may end at 21
212 why: A function this branchy is too large to change safely: neither a person nor a coding agent keeps all its cases in view, so an edit breaks a case it did not look at.
213 what: export_bank at tools/awc_opus.py:381-439: complexity 19 -> 30 (limit 10)
214 what: added lines that carry decision points (11 on 8 lines): 383, 385, 397, 403, 432-433, 435, 437
215 what: tools/awc_opus.py:383 (+1): if cue_sheet:
216 what: tools/awc_opus.py:385 (+1): if os.path.exists(sheet):
217 what: tools/awc_opus.py:397 (+1): if cue_sheet:
218 what: tools/awc_opus.py:403 (+3): if cue_sheet and rate == 48000 and samples > 0:
219 what: tools/awc_opus.py:435 (+2): verified = {cid: limit for cid, limit in frame_limits.items() if channel_counts[cid] == 1}
220 fix: 4 of the added branches test `cue_sheet` (lines 383, 397, 403, 432): that is one optional feature threaded through export_bank. Put its steps into a function of their own and call it where the feature applies.
221 fix: It passes at complexity 21 or lower (now 30): moving 9 decision points out is enough.
222 else: If the rule is wrong for this case, add {"rule": "X3", "path": "tools/awc_opus.py", "key": "export_bank", "reason": "..."} to gate_rules.json in this pull request; it counts once a reviewer approves it.
223
224```
225
226and for `5e54bda`, the second of the two new imports of test code:
227
228```text
229ERROR P4 tools/div_fixup_diff.py:104 new import tools/div_fixup_diff.py -> tests/semantic/spirv_mini_interp.py: tools/ must not import tests/ or runtime/ files (existing edges are tolerated, new ones are not)
230 why: Hidden cross-module coupling: the imported file is changed as if nothing on this side depended on it, so an edit there can break this file without the author or reviewer expecting it.
231 what: tools/div_fixup_diff.py:104 imports tests/semantic/spirv_mini_interp.py (import spirv_mini_interp)
232 fix: `spirv_mini_interp` is shared code kept in a test folder: 21 other tools/ files already import it (tools/buffer_swizzle_probe.py, tools/bvh_tri_probe.py, tools/f32_fuzz.py, ...). Move tests/semantic/spirv_mini_interp.py to tools/ in its own pull request (the tests then import it from tools/), and import it from there.
233 fix: Do not add tests/semantic to sys.path from tools/div_fixup_diff.py: that is the hidden edge this rule stops.
234 else: If the rule is wrong for this case, add {"rule": "P4", "path": "tools/div_fixup_diff.py", "key": "tests/semantic/spirv_mini_interp.py", "reason": "..."} to gate_rules.json in this pull request; it counts once a reviewer approves it.
235
236```
237
238### 2.5 Exceptions
239
240**Proposed.** A finding that is wrong for a case is not fixed by working around the check. The author adds an entry
241with the rule, the path, the edge or function and a reason to one exception file at the repository root, in the same
242pull request; the finding then turns into a note, and the entry is visible in the diff for the reviewer to approve or
243refuse. An entry that no longer matches anything is reported so the file does not grow stale.
244
245## 3. What it does not do
246
247- It changes no existing code and asks nobody to fix what is already on `main`. The 34 imports of test code from
248 `tools/`, the two import cycles and the eight doubled blocks stay until someone chooses to fix them (section 4).
249- It does not judge whether code is correct; the tests and the reviewer still do that.
250- It blocks nothing on code duplication or on skips: the tests copy their templates on purpose, and nearly every skip
251 added in the 300 merges was a missing tool, platform or numpy, which is legitimate.
252- It needs no model and no service. The author adapted it from a gate they use in their own projects; there, a local
253 model chose which documents an agent should read before a change. That part is left out here: the rules file and
254 the messages say what applies to a change, and the same verdict comes out on every machine.
255
256## 4. Rollout
257
258**Proposed**, each step its own pull request:
259
2601. This page, for the decision.
2612. The implementation: the script with its merge-round mode, the rules and exception files, a standard-library test
262 file under `tests/` (the CI loop picks it up, as `tests/test_ci_registration.py` requires), a job on
263 `ubuntu-24.04`, a few lines in [AGENTS.md](../AGENTS.md) that give an agent the local command and the map of which
264 area may import which, and one line in the pull request template for the result.
2653. Follow-up items for the coordination issue, for anyone to claim: move `tests/semantic/spirv_mini_interp.py`,
266 `tests/semantic/spirv_wave_interp.py` and `tests/spirv_interp.py` under `tools/` (removes 25 of the 34 imports
267 of test code from `tools/` at once); delete the second copy of each doubled block in section 1.3; split the largest production
268 functions, starting with those changed most often.
269
270## 5. Decisions for the maintainer
271
272**Open.**
273
2741. Are the boundaries in section 2.2 the intended ones? In particular P4: should the reference interpreters move
275 under `tools/` (proposed), or should `tests/semantic` be declared a library that tools may import?
2762. Complexity: production code only, limit 10 for a new function, +2 for a changed one (+5 for `main`), dispatch
277 arms judged one by one — accept, or which number to change?
2783. Should the job block from the first day (proposed), given the 48 of 300 pull requests it would have
279 stopped and the share of those that were real?
2804. Should the merge round run it before each push (proposed, since CI has not finished for most merges; section 1.4),
281 and should a pull request whose author reports no result be sent back? Where should the CI job live, in `ci.yml`
282 or a workflow of its own, and who approves an entry in the exception file?
2835. `runtime/src` includes `runtime/shims` from `main.cpp` and `pe_loader.cpp`, and the shims include `runtime/src`:
284 is the loader the composition root that may include both, or should one direction be forbidden?
285
286## 6. How the numbers were measured
287
288- Tree: `dde82f2`. History: the 300 single-parent squash merges that end with it (`dde82f2` and the 299 before it),
289 each compared with its parent; the commit below them is the root of the shallow clone and only served as a base.
290- Python imports: resolved from the AST, through each file's own directory and every `sys.path` set-up it performs
291 (`insert`, `append`, slice assignment, `extend`, paths from `conftest.py` and from an imported helper).
292 `importlib` loads with a constant path count as edges. The resolver is a heuristic; it left no import of a
293 repository module unresolved in the measured areas.
294- C++ includes: quoted includes only, resolved against the including file's directory and then the union of the
295 include directories in `runtime/CMakeLists.txt`.
296- Complexity: Python on the AST with the definition in section 2.3; C++ with lizard 1.24.1.
297- Duplication: windows of six significant lines (whitespace normalised; blank lines, comments and lines with fewer
298 than four non-space characters skipped).
299- Every blocking finding was labelled by reading its diff, by one reader: the coding agent that ran the backtest.
300 Each label has a one-line reason (most generated from the label's class and the measured change, five written by
301 hand), and the list can be posted here on request. "Genuine" and "arguable" are a
302 judgement about value; every finding except the 2 artefacts is a correct measurement under the rule as written.
303- Not measured: how often the rules with no finding in the window (P1 to P3, P5, P6, C1, C2, D1) would be wrong.
304 The prototype's own test builds a small repository in which every rule fires once.
305- The 300 merges are one merge round of the original repository (committed between 09:35 and 11:23 UTC-6 on 2026-11-23) of pull requests opened
306 over a longer time; rates per pull request may differ in other rounds.
307- The merge counts in the introduction come from GitHub's search (`is:pr is:merged merged:<date>`), read on
308 2026-11-23 at about 20:00 UTC.
309- Section 1.4: the GraphQL search for pull requests merged on 2026-11-23, with the check suites of each one's last
310 commit, taking the suite of the workflow named CI; the push runs from the Actions list for `main`; the first failing
311 commit of each documentation test by `git bisect` between the oldest commit of the window and `867d922`, and each
312 pull request's checks from its page. All read on 2026-11-23 at about 20:00 UTC, before that repository went private. The
313 figures for this repository come from the checks of its 40 most recently merged pull requests.
diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md
index f5ce49d64..92653e2ea 100644
--- a/docs/d3d12_command_objects.md
+++ b/docs/d3d12_command_objects.md
@@ -826,7 +826,9 @@ surface, not the command objects:
826 826
827- device slots 1/14/15/16/18/19/27/38 in desktop order; slot 14 is `CreateDescriptorHeap`; 827- device slots 1/14/15/16/18/19/27/38 in desktop order; slot 14 is `CreateDescriptorHeap`;
828- device slot 62 is called as `CreateComputePipelineState` (the PC interface's slot 62 is 828- device slot 62 is called as `CreateComputePipelineState` (the PC interface's slot 62 is
829 `CreateStateObject`), and slot 76 is Xbox texture creation; 829 `CreateStateObject`), and slot 76 is Xbox texture creation. In the retail executable slot 62 measures five
830 parameters, `(desc, 0, 0, &riid, &out)`, which the three-argument PC method loses, and the executable itself
831 never calls slot 76 (the callers in this bullet are the package DLLs);
830- descriptor-heap `GetCPU/GPUDescriptorHandleForHeapStart` (heap slots 9/10) return the 8-byte 832- descriptor-heap `GetCPU/GPUDescriptorHandleForHeapStart` (heap slots 9/10) return the 8-byte
831 handle in RAX; 833 handle in RAX;
832- Xbox root-signature descriptors carry flags `0x03000000`, masked on a copy; 834- Xbox root-signature descriptors carry flags `0x03000000`, masked on a copy;
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 225ad5d76..01266d453 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -3405,7 +3405,7 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv
3405 3405
3406| D3D12 / Xbox object | Vulkan / layer object | Notes | 3406| D3D12 / Xbox object | Vulkan / layer object | Notes |
3407|---|---|---| 3407|---|---|---|
3408| `ID3D12Device` … `ID3D12Device11` | one `Device` object with the public chain plus measured Xbox overrides | The shipped BVH builder names Device11; slots 1/15/18/19/27/38 matched desktop in prior art, slot 48 is called as `(desc, riid, out)` with `IID_ID3D12CommandQueue` (PC slot 48 is `OpenExistingHeapFromAddress`; the 32-byte desc is a PC `D3D12_COMMAND_QUEUE_DESC` plus four Xbox words, logged once, and the proxy takes the slot 8 path with the PC prefix and only `DISABLE_GPU_TIMEOUT` kept), slot 62 is called as `CreateComputePipelineState`, slot 76 is Xbox texture creation, and heap slots 9/10 return in RAX. Unknown Xbox IIDs/slots are logged and refused. | 3408| `ID3D12Device` … `ID3D12Device11` | one `Device` object with the public chain plus measured Xbox overrides | The shipped BVH builder names Device11; slots 1/15/18/19/27/38 matched desktop in prior art, slot 48 is called as `(desc, riid, out)` with `IID_ID3D12CommandQueue` (PC slot 48 is `OpenExistingHeapFromAddress`; the 32-byte desc is a PC `D3D12_COMMAND_QUEUE_DESC` plus four Xbox words, logged once, and the proxy takes the slot 8 path with the PC prefix and only `DISABLE_GPU_TIMEOUT` kept), slot 62 is called at `0x14247FE66` as a create with `(desc, 0, 0, &riid, &out)` — five parameters with an explicit IID/out pair, where the PC method it forwards to, `CreateComputePipelineState`, takes three — and static Capstone disassembly over the executable's `.text` (following the device globals `0x148759D00` and `0x1475DF000`–`0x1475DF048` from renderer init `0x142478440`) finds no device call site for slot 76 (`+0x260`; none of the 57 indirect `call [reg+0x260]` sites in `.text` loads a device global); its only measured caller is the shipped FidelityFX upscaler, with the seven `CreateCommittedResource` arguments ([d3d12_command_objects.md](d3d12_command_objects.md) §3.5a), and heap slots 9/10 return in RAX. Unknown Xbox IIDs/slots are logged and refused. |
3409| `ID3D12CommandQueue` | one leased `VkQueue` per live queue: direct queues on the graphics family, compute queues on an async-compute family and copy queues on a transfer-only (DMA) family when the GPU has them (`src/queue_families.h`), else graphics-family leases | Distinct Vulkan queues allow cross-queue waits and signals to make progress. With more than one family in use, buffers, images, the arena and staging are created `VK_SHARING_MODE_CONCURRENT` over those families, so no ownership transfers are needed. Barriers on copy and compute queues are narrowed to the stages their family has; render-target and depth clears are refused there (as in D3D12), and the D24/RGB96 copy conversions and bindless flushes stay off a transfer-only queue. Tested by `vk_queue_test`. `PresentX`, `SuspendX`, `ResumeX` are Xbox queue methods, not in the public vtable; public GDKX samples present only through them (§4.5). Call shapes known, slots **Open**. | 3409| `ID3D12CommandQueue` | one leased `VkQueue` per live queue: direct queues on the graphics family, compute queues on an async-compute family and copy queues on a transfer-only (DMA) family when the GPU has them (`src/queue_families.h`), else graphics-family leases | Distinct Vulkan queues allow cross-queue waits and signals to make progress. With more than one family in use, buffers, images, the arena and staging are created `VK_SHARING_MODE_CONCURRENT` over those families, so no ownership transfers are needed. Barriers on copy and compute queues are narrowed to the stages their family has; render-target and depth clears are refused there (as in D3D12), and the D24/RGB96 copy conversions and bindless flushes stay off a transfer-only queue. Tested by `vk_queue_test`. `PresentX`, `SuspendX`, `ResumeX` are Xbox queue methods, not in the public vtable; public GDKX samples present only through them (§4.5). Call shapes known, slots **Open**. |
3410| `ID3D12CommandAllocator` | IR arena + `VkCommandPool` | Reset only when the previous submission's fence is complete. | 3410| `ID3D12CommandAllocator` | IR arena + `VkCommandPool` | Reset only when the previous submission's fence is complete. |
3411| `ID3D12GraphicsCommandList` … `8` | `CommandList` with IR | Replay at `ExecuteCommandLists`; bundles inlined. Supports render passes, mesh dispatch, enhanced barriers; records the GCL8 front/back stencil references (applied only once a pipeline path consumes them). `Draw` views are inlined and moved into the command stream (D3D-289), eliminating per-draw heap allocations. | 3411| `ID3D12GraphicsCommandList` … `8` | `CommandList` with IR | Replay at `ExecuteCommandLists`; bundles inlined. Supports render passes, mesh dispatch, enhanced barriers; records the GCL8 front/back stencil references (applied only once a pipeline path consumes them). `Draw` views are inlined and moved into the command stream (D3D-289), eliminating per-draw heap allocations. |
@@ -3823,7 +3823,8 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv
3823 the host refuses and the layer copies on purpose. 3823 the host refuses and the layer copies on purpose.
3824 - A driver can report `VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT` for a format, create the image with 3824 - A driver can report `VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT` for a format, create the image with
3825 host-transfer usage, and then give it no memory type (`memoryTypeBits = 0`). This was measured on a GTX 1050 Ti 3825 host-transfer usage, and then give it no memory type (`memoryTypeBits = 0`). This was measured on a GTX 1050 Ti
3826 with NVIDIA 582.78, and the validation layer of Vulkan SDK 1.4.363 reports nothing. Such a texture is made again 3826 with NVIDIA 582.78 and again with 582.66 on Windows 10 (#1364), where the same image without host-transfer usage
3827 takes device-local memory; the validation layer of Vulkan SDK 1.4.363 reports nothing. Such a texture is made again
3827 without host-transfer usage before it is bound, and takes the staging path. `d3d12_vulkan_device_test` and 3828 without host-transfer usage before it is bound, and takes the staging path. `d3d12_vulkan_device_test` and
3828 `d3d12_subresource_copy_test` force this branch on any GPU with `VulkanDeviceInfo::force_host_transfer_retry` 3829 `d3d12_subresource_copy_test` force this branch on any GPU with `VulkanDeviceInfo::force_host_transfer_retry`
3829 (their third CPU-copy path; the second compares it with the host runtime). 3830 (their third CPU-copy path; the second compares it with the host runtime).
@@ -4024,13 +4025,52 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv
4024 and 2^32 in alpha match WARP). `d3d12_clear_test` compares full and rectangular D3D12 readbacks with WARP across 4025 and 2^32 in alpha match WARP). `d3d12_clear_test` compares full and rectangular D3D12 readbacks with WARP across
4025 UNORM, SNORM, FLOAT, all 15 exposed UINT/SINT render targets (11 value vectors, including 8-/16-/10-/2-bit range 4026 UNORM, SNORM, FLOAT, all 15 exposed UINT/SINT render targets (11 value vectors, including 8-/16-/10-/2-bit range
4026 boundaries) and depth/stencil; `clear_color_test` checks both replay paths for 19 integer formats without a GPU, 4027 boundaries) and depth/stencil; `clear_color_test` checks both replay paths for 19 integer formats without a GPU,
4027 including unchanged float values. SRGB clears are omitted from the comparison: the 4028 including unchanged float values. SRGB clears are omitted from that comparison; `d3d12_clear_formats_test`
4028 linear→sRGB encoding rounds differently at the `.5` boundary on WARP vs Vulkan (a 1-ulp driver difference). 4029 compares them (next item).
4029 **Open:** on NVIDIA RTX 5080 (driver 616.56) clears that land exactly on a `.5` UNORM/SNORM step round down where 4030 **Open:** on NVIDIA RTX 5080 (driver 616.56) clears that land exactly on a `.5` UNORM/SNORM step round down where
4030 WARP rounds up: `R8G8B8A8_UNORM`/`SNORM` 0.5 store `7f`/`3f` vs WARP `80`/`40`, and a `D16_UNORM` 0.5 depth clear 4031 WARP rounds up: `R8G8B8A8_UNORM`/`SNORM` 0.5 store `7f`/`3f` vs WARP `80`/`40`, and a `D16_UNORM` 0.5 depth clear
4031 stores `0x7fff` vs WARP `0x8000` (all on `main` before this change; same 1-ulp class as SRGB, not addressed here). 4032 stores `0x7fff` vs WARP `0x8000` (all on `main` before this change; same 1-ulp class as SRGB, not addressed here).
4032 `D32_FLOAT` and `D32_FLOAT_S8X24_UINT` match WARP. 4033 `D32_FLOAT` and `D32_FLOAT_S8X24_UINT` match WARP.
4033 This does not add typed-view reinterpretation of typeless resources. 4034 This does not add typed-view reinterpretation of typeless resources.
4035- **sRGB RTV clears (D3D-CLEAR-SRGB-ENCODE):** `ClearRenderTargetView` through an `R8G8B8A8_UNORM_SRGB` or
4036 `B8G8R8A8_UNORM_SRGB` view encodes the colour channels in the layer and hands Vulkan the linear value of the
4037 resulting code (`srgb8_from_linear` and `srgb8_linear` in `vulkan_replay.h`); alpha is linear and rounds like
4038 UNORM. Before, the linear float went to `vkCmdClearColorImage` or `vkCmdClearAttachments` as it was and the GPU
4039 encoded it, so the stored byte depended on the GPU: 0.5 was `bb` on an Intel Iris Xe and `bc` on WARP and an
4040 NVIDIA RTX 4060. **Measured** (Windows 11 build 26100, WARP 10.0.26100.5074, Iris Xe with Intel 32.0.101.7092, RTX
4041 4060 Laptop with NVIDIA 616.92; a scratch program cleared 256-slice sRGB targets through the layer and through
4042 WARP, a whole view and a rectangle each, and bisected over float bit patterns):
4043 - No driver is wrong. D3D permits FLOAT → SRGB a tolerance of 0.6 of a step (Direct3D 11.3 functional
4044 specification, 3.2.3.8), and each implementation puts the 255 steps between two codes somewhere else: measured
4045 against the halfway point of the ideal curve, the Iris Xe's sit between 0.18 of a code below and 0.33 above, the
4046 RTX 4060's within 0.10 and WARP's between 0.29 below and 0.34 above. On each GPU both Vulkan commands have the
4047 same 255 steps. Of 60 000 random values (half uniform in 0..1, half log-uniform from 1e-6) the Iris Xe stored
4048 another byte than WARP for 6 649 and the RTX 4060 for 3 648, never more than one code away.
4049 - WARP takes the value to 12 bits first and encodes that: `j = floor(x * 4095 + 0.5)` with the product rounded to
4050 single precision, then the nearest code of the IEC 61966-2-1 curve at `j / 4095`. The 255 floats at which WARP's
4051 byte changes are the 255 this rule gives (with the product in exact arithmetic only 188 are: `0x3f018018` times
4052 4095 is 2071.4999986, which a float rounds to 2071.5), and WARP agrees with it on 84 582 further values: every
4053 12-bit value, five floats around each of the 4 095 places between two of them, the 60 000 random ones, 0, 1,
4054 values outside 0..1, NaN and both infinities. It is not the nearest code of the ideal curve for 2 852 of the
4055 60 000 (0.0004 is 2, the curve gives 1.32).
4056 - WARP and both GPUs store the linear value of a code as that code, for all 256 codes and with both commands. That
4057 value is the one farthest from any implementation's steps, so it is what the layer hands over; a GPU whose
4058 encoding is more than half a code off at one of these values would still differ.
4059 - Each GPU's own D3D12 driver stores what its Vulkan driver stores (the same byte for 84 582 of 84 582 values, on
4060 both GPUs): the encoding is the hardware's. So the layer used to store the bytes of the D3D12 driver of the GPU it
4061 ran on, and now stores WARP's on every GPU, which differ from the Intel driver's for those 6 649 of 60 000 values
4062 and from the NVIDIA driver's for 3 648. That is the choice made before for the ties of UNORM clears and for D24:
4063 the layer converts, WARP is the reference, and a host driver that does otherwise is a host quirk.
4064
4065 `clear_color_test` (no GPU) pins 38 values to the bytes WARP stored, checks that every code encodes to itself and
4066 that the result is the same under each floating-point rounding mode. `d3d12_clear_formats_test` clears both formats
4067 to the UNORM colours, the value of every code and the value halfway between every two codes (176 colours each, as
4068 a whole view and as a rectangle): against WARP, 178 of the 352 cases differed on the Iris Xe and 170 on the RTX
4069 4060 before, none after (the five UNORM colours alone differed in 10 of 10 cases on the Iris Xe and in none on the
4070 RTX 4060). `d3d12_state_sweep_test` compares with the D3D12 driver of the same adapter and cleared its sRGB targets
4071 to 0.2, 0.4 and 0.6, of which the first two are codes 124 and 170 on WARP and 123 and 169 on the Iris Xe; it now
4072 clears them to the values of codes 124, 170 and 203, so its eight sRGB cases compare the blending whichever way
4073 the host encodes. A draw into an sRGB target is still encoded by the GPU.
4034- **Depth clears.** Microsoft documents a `[0, 1]` clamp. On Windows 11 build 26100, both WARP and native D3D12 on 4074- **Depth clears.** Microsoft documents a `[0, 1]` clamp. On Windows 11 build 26100, both WARP and native D3D12 on
4035 an RTX 5070 Ti (610.74) preserved finite out-of-range `D32_FLOAT` values and quiet NaN in full and rectangle 4075 an RTX 5070 Ti (610.74) preserved finite out-of-range `D32_FLOAT` values and quiet NaN in full and rectangle
4036 clears. Replay preserves those values when the Vulkan device has enabled `VK_EXT_depth_range_unrestricted`. 4076 clears. Replay preserves those values when the Vulkan device has enabled `VK_EXT_depth_range_unrestricted`.
@@ -5040,13 +5080,13 @@ to be recovered from call sites (or the NDA GDK headers, if a developer has acce
5040| No ESRAM | Xbox Series X\|S uses unified GDDR6; ESRAM was Xbox One | Do not implement ESRAM-era APIs. The `d3d12_xs.cpp` comment about "ESRAM-era extensions" should be read as Xbox One, not Series. | 5080| No ESRAM | Xbox Series X\|S uses unified GDDR6; ESRAM was Xbox One | Do not implement ESRAM-era APIs. The `d3d12_xs.cpp` comment about "ESRAM-era extensions" should be read as Xbox One, not Series. |
5041| Binning | The GDK topic index names Xbox binning modes (NDA content) | Should be a no-op if the game uses it only as an optimisation: it changes how a render pass uses on-chip memory, not the result. Log and ignore for the first boot; revisit for performance. **Open** whether the game relies on binning for correctness. | 5081| Binning | The GDK topic index names Xbox binning modes (NDA content) | Should be a no-op if the game uses it only as an optimisation: it changes how a render pass uses on-chip memory, not the result. Log and ignore for the first boot; revisit for performance. **Open** whether the game relies on binning for correctness. |
5042| DCC / texture compatibility | Public release note for `D3D12XBOX_RESOURCE_FLAG_FORCE_TEXTURE_COMPATIBILITY` | Let Vulkan choose compression; fail if the game aliases/reads raw compressed data. | 5082| DCC / texture compatibility | Public release note for `D3D12XBOX_RESOURCE_FLAG_FORCE_TEXTURE_COMPATIBILITY` | Let Vulkan choose compression; fail if the game aliases/reads raw compressed data. |
5043| PresentX / present planes / frame events | Public GDK samples (MIT/zlib), §4.5 | Likely the only present path of a GDKX title. Presenter + vblank-timed frame events; 1-2 planes composed into the Vulkan swapchain (placement, filter, alpha overlay, HDR10 conversions). Call shapes known; slots/layouts **Open**. | 5083| PresentX / present planes / frame events | Public GDK samples (MIT/zlib), §4.5; the device calls are measured (§7.1) | Likely the only present path of a GDKX title. Presenter + vblank-timed frame events; 1-2 planes composed into the Vulkan swapchain (placement, filter, alpha overlay, HDR10 conversions). Call shapes known; the four frame-call slots are **Measured** called, on one device pointer; plane/parameter layouts **Open**. |
5044| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. | 5084| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation); 78-80 **Measured** in the executable at the documented arities (§7.1) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. |
5045| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. | 5085| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. |
5046| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix, for a caller in an image the guest loader mapped; the PC slot 61 is `CreateMetaCommand`, which any other caller (a host test driving the device through the proxy) still gets. The layout of the description beyond the PC fields is **Open**. | 5086| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix, for a caller in an image the guest loader mapped; the PC slot 61 is `CreateMetaCommand`, which any other caller (a host test driving the device through the proxy) still gets. The layout of the description beyond the PC fields is **Open**. |
5047| Device slot 74 | The retail title's boot under `gta6rt --run`: called as `(pointer, u32, pointer)` | **Stand-in.** `d3d12_xs_device.cpp` answers `S_OK` and does nothing, for a caller in an image the guest loader mapped; the PC slot 74 is `ShaderCacheControl`, which the call does not fit and which any other caller still gets. What the console method is, and what it should do, is **Open**. | 5087| Device slot 74 | The retail title's boot under `gta6rt --run`: called as `(pointer, u32, pointer)` | **Stand-in.** `d3d12_xs_device.cpp` answers `S_OK` and does nothing, for a caller in an image the guest loader mapped; the PC slot 74 is `ShaderCacheControl`, which the call does not fit and which any other caller still gets. What the console method is, and what it should do, is **Open**. |
5048| Command-allocator slot 9 | The retail title's boot under `gta6rt --run`: called past the 9-slot PC allocator, as `(function pointer, context, ...)`; `SetAllocatorCallbackX` is the name the commit that added it uses | **Stand-in.** The allocator proxy records the callback and its context (`allocator_proxy_callback`, `allocator_proxy_callback_context`) and answers `S_OK`. **Nothing calls the callback**: the Vulkan layer backs command buffers itself. Whether the title depends on being called back is **Open**. | 5088| Command-allocator slot 9 | The retail title's boot under `gta6rt --run`: called past the 9-slot PC allocator, as `(function pointer, context, ...)`; `SetAllocatorCallbackX` is the name the commit that added it uses | **Stand-in.** The allocator proxy records the callback and its context (`allocator_proxy_callback`, `allocator_proxy_callback_context`) and answers `S_OK`. **Nothing calls the callback**: the Vulkan layer backs command buffers itself. Whether the title depends on being called back is **Open**. |
5049| Device slot 81, queue `PresentX`/`SuspendX`/`ResumeX` | XCL (GPL-2.0-only, third-party): `GetFrameStatisticsX` at device slot 81, `PresentX` at queue slot 30 (older runtime layout) or 32 (newer); `SuspendX`/`ResumeX` slots unmeasured | `set_presentation_handler` forwards 78-81 and the queue routes to a presenter (`attach_xbox_presentation`). Without one, slot 81 answers `S_OK` with a zero count (no statistics yet; the answer the retail boot through the story load was measured with, where the public samples' "not available yet" is `S_FALSE`; a null count, or a count above zero with no array, is `E_POINTER`); `PresentX` goes to the presentation the device proxy builds itself on the first call (`queue_present_x`: in the title's window or one of the runtime's, `LEONIDA_PRESENT_WINDOW`), which takes its frame tokens from the same source as the device's `WaitFrameEventX`; every other queue slot past the PC table answers `S_OK` and does nothing, except slot 31 (next row). `PresentX` is slot 30 on a queue in the older layout and slot 32 on a queue detected as the newer one (a fence reaching slot 16 or 17, or `SignalX` at 25), never both: in the newer layout slot 30 is another method. Slot 81 moves with `LEONIDA_XS_FRAME_STATISTICS_SLOT` (3..127); `LEONIDA_XS_PRESENT_X_SLOT` pins `PresentX` to one slot whatever the layout; `SuspendX` and `ResumeX` are routed only when `LEONIDA_XS_SUSPEND_X_SLOT` / `LEONIDA_XS_RESUME_X_SLOT` are set (queue slots 19..127; two routes on one slot are refused with a log). | 5089| Device slot 81, queue `PresentX`/`SuspendX`/`ResumeX` | XCL (GPL-2.0-only, third-party): `GetFrameStatisticsX` at device slot 81, `PresentX` at queue slot 30 (older runtime layout) or 32 (newer); `SuspendX`/`ResumeX` slots unmeasured; slot 81 **Measured** called (§7.1) | `set_presentation_handler` forwards 78-81 and the queue routes to a presenter (`attach_xbox_presentation`). Without one, slot 81 answers `S_OK` with a zero count (no statistics yet; the answer the retail boot through the story load was measured with, where the public samples' "not available yet" is `S_FALSE`; a null count, or a count above zero with no array, is `E_POINTER`); `PresentX` goes to the presentation the device proxy builds itself on the first call (`queue_present_x`: in the title's window or one of the runtime's, `LEONIDA_PRESENT_WINDOW`), which takes its frame tokens from the same source as the device's `WaitFrameEventX`; every other queue slot past the PC table answers `S_OK` and does nothing, except slot 31 (next row). `PresentX` is slot 30 on a queue in the older layout and slot 32 on a queue detected as the newer one (a fence reaching slot 16 or 17, or `SignalX` at 25), never both: in the newer layout slot 30 is another method. Slot 81 moves with `LEONIDA_XS_FRAME_STATISTICS_SLOT` (3..127); `LEONIDA_XS_PRESENT_X_SLOT` pins `PresentX` to one slot whatever the layout; `SuspendX` and `ResumeX` are routed only when `LEONIDA_XS_SUSPEND_X_SLOT` / `LEONIDA_XS_RESUME_X_SLOT` are set (queue slots 19..127; two routes on one slot are refused with a log). |
5050| Queue slot 31, `CopyPageMappingsBatchX` | Arguments `(count, batches, pool, pool pages, flags)`, a 24-byte batch `{UINT64 destination; UINT32 range count; const range* ranges}` and a 12-byte range `{UINT32 kind, start, count}`: read statically from the retail executable's call site and the code that fills the batches (#968), corroborated by the same call shape in a public project's queue (VIctory, `copy_page_mappings`, where the newer layout puts it at 29), and the pool-size argument equalled the page count of the title's own `XMemAllocatePhysicalPages` call in a boot | Every range goes to xmem's `copy_page_mappings_fn` (`d3d12_xs_device.cpp`, `queue_copy_page_mappings`): kind 0 maps pool pages `start, start + 1, ...` at the destination, 1 maps pool page `start` at every destination page, 2 unmaps, 3 leaves the destination as it is; each range moves the destination on by `count` pages. A destination page gets a second view of the physical page mapped at its source page, and the same view at the paired CPU range when the destination is a GPU-only reservation (`title_gpu_views`), where the layer reads that memory. `S_OK` when every range was applied, `E_INVALIDARG` (logged once) for a range past the pool, an unknown kind or one xmem refuses; without xmem linked (tests of the proxy alone) the slot answers `S_OK` like the other console-only slots. Tested by `xmem_test` and `xs_proxy_mock_test`. **Known gap:** the mappings change when the call is made, not when the queue reaches the batch, as on the console; whether earlier queued work still reads a destination page then is not measured. | 5090| Queue slot 31, `CopyPageMappingsBatchX` | Arguments `(count, batches, pool, pool pages, flags)`, a 24-byte batch `{UINT64 destination; UINT32 range count; const range* ranges}` and a 12-byte range `{UINT32 kind, start, count}`: read statically from the retail executable's call site and the code that fills the batches (#968), corroborated by the same call shape in a public project's queue (VIctory, `copy_page_mappings`, where the newer layout puts it at 29), and the pool-size argument equalled the page count of the title's own `XMemAllocatePhysicalPages` call in a boot | Every range goes to xmem's `copy_page_mappings_fn` (`d3d12_xs_device.cpp`, `queue_copy_page_mappings`): kind 0 maps pool pages `start, start + 1, ...` at the destination, 1 maps pool page `start` at every destination page, 2 unmaps, 3 leaves the destination as it is; each range moves the destination on by `count` pages. A destination page gets a second view of the physical page mapped at its source page, and the same view at the paired CPU range when the destination is a GPU-only reservation (`title_gpu_views`), where the layer reads that memory. `S_OK` when every range was applied, `E_INVALIDARG` (logged once) for a range past the pool, an unknown kind or one xmem refuses; without xmem linked (tests of the proxy alone) the slot answers `S_OK` like the other console-only slots. Tested by `xmem_test` and `xs_proxy_mock_test`. **Known gap:** the mappings change when the call is made, not when the queue reaches the batch, as on the console; whether earlier queued work still reads a destination page then is not measured. |
5051| VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. | 5091| VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. |
5052| Mesh shader tier | Public `D3D12_MESH_SHADER_TIER` | `VK_EXT_mesh_shader`; the 9,282 translated mesh shaders make this a hard requirement for any content that uses them. | 5092| Mesh shader tier | Public `D3D12_MESH_SHADER_TIER` | `VK_EXT_mesh_shader`; the 9,282 translated mesh shaders make this a hard requirement for any content that uses them. |
@@ -5522,6 +5562,25 @@ folded into the table below with the measurement basis noted per row; nothing is
5522 is wrapped. The public chain is a usable base for those methods, not a guess. 5562 is wrapped. The public chain is a usable base for those methods, not a guess.
5523- The BVH builder receives the device and command lists from the caller; prior art runs it exactly that way. 5563- The BVH builder receives the device and command lists from the caller; prior art runs it exactly that way.
5524 5564
5565**Measured: the presentation slots 78, 79, 80 and 81 are called, on the device** (D3D12-PRESENT-SLOTS-MEASURED).
5566All eight device sites load the one device pointer from the BSS global `0x148759D00` into `rcx` and call through
5567`[[rcx] + offset]`; that is the same global the layer's known device calls use (e.g. `CreateCommittedResource`,
5568slot 27, at `0x142481bce`), and many subsystems load it rip-relative, as they would a device singleton. The
5569other `call [reg+offset]` sites at those offsets belong to other interfaces that share the PC slot numbers, so they are
5570counted but not attributed. Arity and arguments are the register and stack words written before each site:
5571
5572| slot | offset | raw sites | device sites | receiver | arguments (registers, then stack) | what it is |
5573|---:|---|---:|---:|---|---|---|
5574| 78 | `0x270` | 31 | 1 | `[0x148759D00]` | `0x14247abd8`: `rdx`=0 (output), `r8d`=`edi` (latency word from the interval table indexed at `0x14247ab95`), `r9d`=2 or 3 (flags, same table), `[rsp+0x20]`=0 | `SetFrameIntervalX`, 4 arguments (output NULL, latency, flags, 0). Its function (`0x14247ab10`) has three callers on the frame-interval paths; the slot itself has one site. |
5575| 79 | `0x278` | 40 | 3 | `[0x148759D00]` | `0x14247abfc`: `rdx`=0 (event), `r8d`=`edi` (offset), `r9d`=0 (reserved), `[rsp+0x20]`=0. `0x142478de4`: `rdx`=2, `r8`=0, `r9`=0, `[rsp+0x20]`=0. `0x1424900e3`: same as the previous site. | `ScheduleFrameEventX`, 4 arguments (event, offset, null, flags 0). Event 0 is `ORIGIN`; event 2 is unlabelled and only appears on the two later sites. |
5576| 80 | `0x280` | 42 | 3 | `[0x148759D00]` | `0x142482405`: `rdx`=2 (event), `r8d`=`0xFFFFFFFF` (INFINITE), `r9`=0 (reserved), `[rsp+0x20]`=0 (flags), `[rsp+0x28]`=`&[rsp+0x68]` (token out). `0x142482448`: `rdx`=0, `r8d`=INFINITE, `r9`=0, `[rsp+0x20]`=2 (flags), `[rsp+0x28]`=`&global token`. `0x142484637`: `rdx`=0, `r8d`=INFINITE, `r9`=0, `[rsp+0x20]`=0, `[rsp+0x28]`=`&[rsp+0x30]`. | `WaitFrameEventX`, 5 arguments (event, INFINITE, null, flags, token out) — the per-frame wait, once at the top of the loop; event 0 with flag 2 on the path that arms the origin, event 2 on the other. |
5577| 81 | `0x288` | 522 | 1 | `[0x148759D00]` | `0x142482710`: `rdx`=token (`[r9 + r8*8]`, the previous round's entry of a 4-slot ring), `r8d`=`0x11100` (type mask), `r9`=`&count` (`[rsp+0x2c]`, seeded with 6), `[rsp+0x20]`=`&[rsp+0x30]` (0x38-byte statistics array) | `GetFrameStatisticsX`, 4 arguments. After the call it walks the returned entries and matches type `0x10000` (`FRAME_INTERVAL`) and `0x1000` (`FRAME_EVENT`), exactly the documented shape. |
5578
5579The sites also confirm the order the samples use: interval, schedule, then a wait per frame; the statistics call reads
5580a token that an earlier wait wrote. Flag 2 on the wait is the one XCL gives the "write the token even on timeout"
5581meaning. `PresentX` itself is not in this set (it is a queue slot, §4.5); 78-81 are device slots beyond the public
5582vtable order, as the prior art said.
5583
5525**Corrects.** 5584**Corrects.**
5526 5585
5527- **Device creation.** `D3D12XboxCreateDevice` is the entry point. The 24-word params struct is only logged, so 5586- **Device creation.** `D3D12XboxCreateDevice` is the entry point. The 24-word params struct is only logged, so
@@ -5542,8 +5601,7 @@ folded into the table below with the measurement basis noted per row; nothing is
5542 5601
5543**Narrows.** 5602**Narrows.**
5544 5603
5545- Presentation slots and struct layouts (`PresentX` and plane parameters; call shapes are known from public samples, §4.5), command-list extensions, and queue/fence creation slots remain 5604- Presentation slots 78-81 are now measured, with arity and receiver (above); the plane/parameter struct layouts, the queue `PresentX`/`SuspendX`/`ResumeX` slots (prior art only), command-list extensions, and queue/fence creation slots remain **Open**.
5546 unknown; the prior art explicitly stops before them.
5547- Descriptor start-handle ABI is known; descriptor bytes and heap increments are still **Open**. Slot 15 is 5605- Descriptor start-handle ABI is known; descriptor bytes and heap increments are still **Open**. Slot 15 is
5548 forwarded unchanged, but the actual increment values were not measured. 5606 forwarded unchanged, but the actual increment values were not measured.
5549- Texture creation ABI and the `0x101` value are known; the tiled data layout, detile path and DCC remain 5607- Texture creation ABI and the `0x101` value are known; the tiled data layout, detile path and DCC remain
@@ -5595,11 +5653,11 @@ nothing is copied from their trees.
5595| # | Question | How to resolve | 5653| # | Question | How to resolve |
5596|---|---|---| 5654|---|---|---|
5597| 1 | The device entry point is now named `D3D12XboxCreateDevice(adapter, params, riid, out)`. What do its 24-word params and flag bits mean? | Public documentation and the executable's call sites. Log the words and accept any flag bits; do not treat a wrong params layout as fatal until the fields are understood. | 5655| 1 | The device entry point is now named `D3D12XboxCreateDevice(adapter, params, riid, out)`. What do its 24-word params and flag bits mean? | Public documentation and the executable's call sites. Log the words and accept any flag bits; do not treat a wrong params layout as fatal until the fields are understood. |
5598| 2 | Which Xbox device/heap/queue/command-list slots differ? Prior art measured device slots 62 and 76 and descriptor-heap slots 9/10; slot 14 is the public `CreateDescriptorHeap`, with only the returned heap's start-handle return wrapped. **Partly measured** with the FSR DLL ([d3d12_command_objects.md §3.5a](d3d12_command_objects.md)): device slots 14, 15, 16, 18, 19, 27, 38, 62 and 76 at their expected shapes (24 in the code, not called), slot 67 a console-only pipeline call; command-list slots 14, 15, 25 and 26 at their PC positions, then shifted (+4 from `SetDescriptorHeaps` at 32, +2 at `ExecuteIndirect` at 61), with console-only methods at 85 and 141. The BVH builder's call sites add the rest of the +4 root group (37, 39, 43, 45) and console slots 71, 73, 80, 146 (the GCL7 `Barrier`) and 148 (an upload allocator whose pointer is also the GPU address) ([d3d12_command_objects.md §3.3, §3.3a](d3d12_command_objects.md)). A second, retail-title measurement adds console slots 83 (`CopyTextureRegion`), 84 (`CopyResource`), 26 (barriers), 127 (direct mesh dispatch — not the PC position, GCL6 slot 79), 59 (a second indirect/mesh dispatch path) and 96 (an async-compute budget call) (section 7). Presentation, queue and fence slots remain unknown. | Trace every `QueryInterface` and every method slot with per-slot hit counters. A wrong slot shows as an immediate crash or wrong argument; compare against the SDK vtable. | 5656| 2 | Which Xbox device/heap/queue/command-list slots differ? Prior art measured device slots 62 and 76 and descriptor-heap slots 9/10; slot 14 is the public `CreateDescriptorHeap`, with only the returned heap's start-handle return wrapped. **Partly measured** with the FSR DLL ([d3d12_command_objects.md §3.5a](d3d12_command_objects.md)): device slots 14, 15, 16, 18, 19, 27, 38, 62 and 76 at their expected shapes (24 in the code, not called), slot 67 a console-only pipeline call; command-list slots 14, 15, 25 and 26 at their PC positions, then shifted (+4 from `SetDescriptorHeaps` at 32, +2 at `ExecuteIndirect` at 61), with console-only methods at 85 and 141. The BVH builder's call sites add the rest of the +4 root group (37, 39, 43, 45) and console slots 71, 73, 80, 146 (the GCL7 `Barrier`) and 148 (an upload allocator whose pointer is also the GPU address) ([d3d12_command_objects.md §3.3, §3.3a](d3d12_command_objects.md)). A second, retail-title measurement adds console slots 83 (`CopyTextureRegion`), 84 (`CopyResource`), 26 (barriers), 127 (direct mesh dispatch — not the PC position, GCL6 slot 79), 59 (a second indirect/mesh dispatch path) and 96 (an async-compute budget call) (section 7). Presentation slots 78-81 are measured ([§7.1](#71-what-this-confirms-corrects-and-narrows)); the rest of presentation, queue and fence slots remain unknown. | Trace every `QueryInterface` and every method slot with per-slot hit counters. A wrong slot shows as an immediate crash or wrong argument; compare against the SDK vtable. |
5599| 3 | How does the console map a root signature to `s0..s31` (order, per-stage visibility, spills above 32 dwords, static samplers, direct-heap base)? | **Compute partly measured** by a sibling project's console-compiler output (section 7): parameters inline in user SGPRs from `s4` in root order while each fits whole; the first that does not fit, and all after it, go into a packed array addressed by a 40-bit pointer at `s[0:1]`; thread-group ids follow the user SGPRs. That matches this repo's CS census (lowest CS pointer SGPR `s4`). VS/PS/MS bases remain open. Static samplers: no sampling instruction was found reading one from a driver table (SHADER-735, section 3.5; 0.66% undetermined); which S# is a static sampler remains open. Dump the game's root-signature blobs with the host deserializer; mask the `0x03000000` flag byte on a copy first; match against the per-shader user-SGPR read sets. If a signature exceeds 32 dwords, reverse the spill pointer from the shader. | 5657| 3 | How does the console map a root signature to `s0..s31` (order, per-stage visibility, spills above 32 dwords, static samplers, direct-heap base)? | **Compute partly measured** by a sibling project's console-compiler output (section 7): parameters inline in user SGPRs from `s4` in root order while each fits whole; the first that does not fit, and all after it, go into a packed array addressed by a 40-bit pointer at `s[0:1]`; thread-group ids follow the user SGPRs. That matches this repo's CS census (lowest CS pointer SGPR `s4`). VS/PS/MS bases remain open. Static samplers: no sampling instruction was found reading one from a driver table (SHADER-735, section 3.5; 0.66% undetermined); which S# is a static sampler remains open. Dump the game's root-signature blobs with the host deserializer; mask the `0x03000000` flag byte on a copy first; match against the per-shader user-SGPR read sets. If a signature exceeds 32 dwords, reverse the spill pointer from the shader. |
5600| 4 | Are Xbox descriptor bytes GFX10 T#/S#, and what are the heap increments? Does the game use `Create*View` or build descriptors itself? | Dump a shader-visible heap after the first `CreateShaderResourceView` and after the first draw; compare the bytes the shader loads with the T# parser. The start-handle return ABI is known (RAX). The game calls `GetDescriptorHandleIncrementSize` itself (ten device sites, all five heap types, section 3.4) and sizes heaps and handles from the answer; the numeric console values still need measuring, by hooking slot 15 and logging the answer. | 5658| 4 | Are Xbox descriptor bytes GFX10 T#/S#, and what are the heap increments? Does the game use `Create*View` or build descriptors itself? | Dump a shader-visible heap after the first `CreateShaderResourceView` and after the first draw; compare the bytes the shader loads with the T# parser. The start-handle return ABI is known (RAX). The game calls `GetDescriptorHandleIncrementSize` itself (ten device sites, all five heap types, section 3.4) and sizes heaps and handles from the answer; the numeric console values still need measuring, by hooking slot 15 and logging the answer. |
5601| 5 | What is the buffer/descriptor/code VA range, and what arena capacity is needed? | Log every `GetGPUVirtualAddress` and every descriptor base; track the high-water mark. Choose a capacity; grow at a frame boundary if needed. | 5659| 5 | What is the buffer/descriptor/code VA range, and what arena capacity is needed? | Log every `GetGPUVirtualAddress` and every descriptor base; track the high-water mark. Choose a capacity; grow at a frame boundary if needed. |
5602| 6 | Which swapchain/present path is used: DXGI, `PresentX`, or both? | **Partly answered from public samples (§4.5):** GDKX samples use `PresentX` + frame events and no DXGI swapchain (DXGI only for `IDXGIDevice1`→adapter→output). Hypothesis for the game, not observed: same. Still open: vtable slots, `D3D12XBOX_*` layouts, and whether the game also creates a swapchain. Check imports and the first present call. Implement the `PresentX` + frame-event presenter first; keep DXGI swapchain as fallback. | 5660| 6 | Which swapchain/present path is used: DXGI, `PresentX`, or both? | **Answered for the device half (measured, §7.1):** the game calls the frame-event device slots 78-81 on its device pointer, the same path the GDKX samples use; those samples present with `PresentX` and no DXGI swapchain (DXGI only for `IDXGIDevice1`→adapter→output). Still open: the queue `PresentX` slot the game calls, `SuspendX`/`ResumeX`, the `D3D12XBOX_*` layouts, and whether it also creates a swapchain. Check imports and the first present call. Implement the `PresentX` + frame-event presenter first; keep DXGI swapchain as fallback. |
5603| 7 | Does the game build acceleration structures through the standard D3D12 calls or through `XboxBvhBuilder`'s own compute path? | Log `BuildRaytracingAccelerationStructure`, `CopyRaytracingAccelerationStructure`, `Emit...PostbuildInfo`, and the builder's command-list method calls on the first RT frame. The builder's container carries a DXIL bitcode blob and a console `XBCH` record; the record is `FSSM` and all 52 programs pass `spirv-val` ([embedded_shaders.md](embedded_shaders.md)). If the builder path is used, translate the `XBCH` record rather than the bitcode. | 5661| 7 | Does the game build acceleration structures through the standard D3D12 calls or through `XboxBvhBuilder`'s own compute path? | Log `BuildRaytracingAccelerationStructure`, `CopyRaytracingAccelerationStructure`, `Emit...PostbuildInfo`, and the builder's command-list method calls on the first RT frame. The builder's container carries a DXIL bitcode blob and a console `XBCH` record; the record is `FSSM` and all 52 programs pass `spirv-val` ([embedded_shaders.md](embedded_shaders.md)). If the builder path is used, translate the `XBCH` record rather than the bitcode. |
5604| 8 | What are the layouts of `D3D12XBOX_XDXR_STREAM_DESC`, the batched build desc, and the offline statistics desc? | **Measured** from `XboxBvhBuilder.dll`'s reads ([xdxr.md](xdxr.md)): `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) with every field's offset, and the stream records' offsets, types and defaults. Still open: the record names, and the offline statistics layout, which the DLL never writes (it rejects that postbuild type). | 5662| 8 | What are the layouts of `D3D12XBOX_XDXR_STREAM_DESC`, the batched build desc, and the offline statistics desc? | **Measured** from `XboxBvhBuilder.dll`'s reads ([xdxr.md](xdxr.md)): `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) with every field's offset, and the stream records' offsets, types and defaults. Still open: the record names, and the offline statistics layout, which the DLL never writes (it rejects that postbuild type). |
5605| 9 | Xbox texture creation is device slot 76 with layout `0x101` (tiled) or `0x1` (row-major). What is the tiled data layout, and does the game upload console-tiled or DCC data? | Trace slot 76, `CopyTextureRegion` and the resource descs. If the game uploads console-tiled data, add a detile step or a matching layout. | 5663| 9 | Xbox texture creation is device slot 76 with layout `0x101` (tiled) or `0x1` (row-major). What is the tiled data layout, and does the game upload console-tiled or DCC data? | Trace slot 76, `CopyTextureRegion` and the resource descs. If the game uploads console-tiled data, add a detile step or a matching layout. |
diff --git a/docs/d3d12_xs_surface.md b/docs/d3d12_xs_surface.md
index 460b50d29..753529f98 100644
--- a/docs/d3d12_xs_surface.md
+++ b/docs/d3d12_xs_surface.md
@@ -687,7 +687,7 @@ Mesa are public code compiled against the GDK headers, and docs.xbox.com is Micr
687| Device frame calls | Slots **78** `SetFrameIntervalX`, **79** `ScheduleFrameEventX`, **80** `WaitFrameEventX`, **81** `GetFrameStatisticsX` (0-based, `QueryInterface` = 0). XCL's [`frame.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/frame.rs) numbers the calls and documents the arguments; ebiten's `ID3D12Device` vtable has `SetFrameIntervalX`/`ScheduleFrameEventX`/`WaitFrameEventX` at 78/79/80 and leaves 81 unnamed ([`d3d12_windows.go`](https://github.com/hajimehoshi/ebiten/blob/d438df689b19544c82543ad522b36be86a5a60b7/internal/graphicsdriver/directx/d3d12_windows.go)). | **Confirms** all four slots, two independent public sources. | 687| Device frame calls | Slots **78** `SetFrameIntervalX`, **79** `ScheduleFrameEventX`, **80** `WaitFrameEventX`, **81** `GetFrameStatisticsX` (0-based, `QueryInterface` = 0). XCL's [`frame.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/frame.rs) numbers the calls and documents the arguments; ebiten's `ID3D12Device` vtable has `SetFrameIntervalX`/`ScheduleFrameEventX`/`WaitFrameEventX` at 78/79/80 and leaves 81 unnamed ([`d3d12_windows.go`](https://github.com/hajimehoshi/ebiten/blob/d438df689b19544c82543ad522b36be86a5a60b7/internal/graphicsdriver/directx/d3d12_windows.go)). | **Confirms** all four slots, two independent public sources. |
688| `D3D12XBOX_FRAME_STATISTICS` | The MIT FramePacing sample names `Type`, `Interval`, `Event`, `Render`/`Present`/`Display` with `PlaneIndex`, and `Display.PercentScanned`; it treats `S_FALSE` or a count below the request as "not available yet" ([`FramePacing.cpp`](https://github.com/microsoft/Xbox-GDK-Samples/blob/b1e77b6ac10f95b07296025fda171ca2ddc42dbe/Samples/Graphics/FramePacing/FramePacing.cpp)). XCL's implementation writes `Type` at +0, origin at +0x10 and flip at +0x18, so its record is at least 0x20 bytes ([`frame.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/frame.rs)). | **Partly confirms** the field meanings and the two timestamp offsets; the full record layout and the union members stay unmeasured. | 688| `D3D12XBOX_FRAME_STATISTICS` | The MIT FramePacing sample names `Type`, `Interval`, `Event`, `Render`/`Present`/`Display` with `PlaneIndex`, and `Display.PercentScanned`; it treats `S_FALSE` or a count below the request as "not available yet" ([`FramePacing.cpp`](https://github.com/microsoft/Xbox-GDK-Samples/blob/b1e77b6ac10f95b07296025fda171ca2ddc42dbe/Samples/Graphics/FramePacing/FramePacing.cpp)). XCL's implementation writes `Type` at +0, origin at +0x10 and flip at +0x18, so its record is at least 0x20 bytes ([`frame.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/frame.rs)). | **Partly confirms** the field meanings and the two timestamp offsets; the full record layout and the union members stay unmeasured. |
689| Token and timeout | `D3D12XBOX_FRAME_PIPELINE_TOKEN` is a 64-bit integer with 0 as `..._NULL` (ebiten). Microsoft's Game Streaming page says `WaitFrameEventX` returns the token at frame start and `PresentX` sends it with the frame to the client ([Learn](https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/game-streaming/game-streaming-latency-compensation-deep-dive)). XCL's implementation issues 48-bit nonzero tokens (mask `0xFFFF_FFFF_FFFF`), i.e. it leaves the top 16 bits unused, returns `S_FALSE` on a finite timeout, writes the token on timeout only with flag 2, and returns `E_INVALIDARG` for an unscheduled event; `ScheduleFrameEventX` returns `S_FALSE` or `0x10000000` when it starts the clock. | **Confirms** the 64-bit storage and the `0` null. **Contradicts** this layer's `HRESULT_FROM_WIN32(WAIT_TIMEOUT)` on timeout (XCL: `S_FALSE`) and `ERROR_INVALID_STATE` for an unscheduled event (XCL: `E_INVALIDARG`); both are recorded here, not changed in this PR. The 48-bit range is XCL's implementation choice, not a documented mask. | 689| Token and timeout | `D3D12XBOX_FRAME_PIPELINE_TOKEN` is a 64-bit integer with 0 as `..._NULL` (ebiten). Microsoft's Game Streaming page says `WaitFrameEventX` returns the token at frame start and `PresentX` sends it with the frame to the client ([Learn](https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/game-streaming/game-streaming-latency-compensation-deep-dive)). XCL's implementation issues 48-bit nonzero tokens (mask `0xFFFF_FFFF_FFFF`), i.e. it leaves the top 16 bits unused, returns `S_FALSE` on a finite timeout, writes the token on timeout only with flag 2, and returns `E_INVALIDARG` for an unscheduled event; `ScheduleFrameEventX` returns `S_FALSE` or `0x10000000` when it starts the clock. | **Confirms** the 64-bit storage and the `0` null. **Contradicts** this layer's `HRESULT_FROM_WIN32(WAIT_TIMEOUT)` on timeout (XCL: `S_FALSE`) and `ERROR_INVALID_STATE` for an unscheduled event (XCL: `E_INVALIDARG`); both are recorded here, not changed in this PR. The 48-bit range is XCL's implementation choice, not a documented mask. |
690| `D3D12XBOX_CREATE_DEVICE_PARAMETERS` | Public field names and (for ebiten's version) x64 offsets: `Version` @0, `ProcessDebugFlags` @4, `GraphicsCommandQueueRingSizeBytes` @8, `pOffchipTessellationBuffer` @0x10, `GraphicsScratchMemorySizeBytes` @0x18, `ComputeScratchMemorySizeBytes` @0x1C, `DisableGeometryShaderAllocations` @0x20, `DisableTessellationShaderAllocations` @0x24, `DisableDXR` @0x28, `DisableAutomaticDPBBBreakBatchEvents` @0x2C, `pDXRStackBuffer` @0x30, `DXRStackBufferOverrideSizeBytes` @0x38, `CreateDeviceFlags` @0x3C, `AutoHDRPaperWhiteLevelNits` @0x40, `DisableAutomaticCommandSegmentChaining` @0x44 ([`d3d12_windows.go`](https://github.com/hajimehoshi/ebiten/blob/d438df689b19544c82543ad522b36be86a5a60b7/internal/graphicsdriver/directx/d3d12_windows.go)). The MIT samples add `AmplificationShaderIndirectArgsBufferSize` and `AmplificationShaderPayloadBufferSize` by name ([`SimpleDeviceAndSwapChain.cpp`](https://github.com/microsoft/Xbox-GDK-Samples/blob/b1e77b6ac10f95b07296025fda171ca2ddc42dbe/Samples/IntroGraphics/SimpleDeviceAndSwapChain/SimpleDeviceAndSwapChain.cpp)). | **Partly confirms.** Seventeen named fields cover the first 18 words (word 3 is the x64 alignment pad at 0x0C); the samples name two more fields without a public layout. A 24-word (96-byte) block still has at least four words with no public name or meaning. | 690| `D3D12XBOX_CREATE_DEVICE_PARAMETERS` | Public field names and (for ebiten's version) x64 offsets: `Version` @0, `ProcessDebugFlags` @4, `GraphicsCommandQueueRingSizeBytes` @8, `pOffchipTessellationBuffer` @0x10, `GraphicsScratchMemorySizeBytes` @0x18, `ComputeScratchMemorySizeBytes` @0x1C, `DisableGeometryShaderAllocations` @0x20, `DisableTessellationShaderAllocations` @0x24, `DisableDXR` @0x28, `DisableAutomaticDPBBBreakBatchEvents` @0x2C, `pDXRStackBuffer` @0x30, `DXRStackBufferOverrideSizeBytes` @0x38, `CreateDeviceFlags` @0x3C, `AutoHDRPaperWhiteLevelNits` @0x40, `DisableAutomaticCommandSegmentChaining` @0x44 ([`d3d12_windows.go`](https://github.com/hajimehoshi/ebiten/blob/d438df689b19544c82543ad522b36be86a5a60b7/internal/graphicsdriver/directx/d3d12_windows.go)). The MIT samples add `AmplificationShaderIndirectArgsBufferSize` and `AmplificationShaderPayloadBufferSize` by name ([`SimpleDeviceAndSwapChain.cpp`](https://github.com/microsoft/Xbox-GDK-Samples/blob/b1e77b6ac10f95b07296025fda171ca2ddc42dbe/Samples/IntroGraphics/SimpleDeviceAndSwapChain/SimpleDeviceAndSwapChain.cpp)). | **Partly confirms.** Seventeen named fields cover the first 18 words (word 3 is the x64 alignment pad at 0x0C); the samples name two more fields without a public layout. At the one retail call site the block is 0x50 bytes (20 dwords typified by the field list), so the two dwords at 0x48 and 0x4C are the ones with no public name, and both are zero there. |
691| Root-signature flags `0x03000000` | Not documented: the [graphics index](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference.txt) has no `D3D12_ROOT_SIGNATURE_FLAGS` entry, and both URL forms under `docs.xbox.com/reference/graphics/` (`d3d12` and `d3d12_xs`) return 404. | **Leaves provisional.** Keep masking the byte on a copy; no public bit meaning. | 691| Root-signature flags `0x03000000` | Not documented: the [graphics index](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference.txt) has no `D3D12_ROOT_SIGNATURE_FLAGS` entry, and both URL forms under `docs.xbox.com/reference/graphics/` (`d3d12` and `d3d12_xs`) return 404. | **Leaves provisional.** Keep masking the byte on a copy; no public bit meaning. |
692| `CheckFeatureSupport(D3D12_OPTIONS)` with 0x40 bytes | Microsoft publishes the 15-field PC structure, 0x3C bytes, with no extra member ([`D3D12_FEATURE_DATA_D3D12_OPTIONS`](https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options_public.md)); its `CheckFeatureSupport` page says a size mismatch is `E_INVALIDARG` ([`CheckFeatureSupport`](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_checkfeaturesupport_public.md)). XCL measured XDefiant asking 0x40 and retries with 0x3C, zeroing the tail ([`HANDOFF.md`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/HANDOFF.md), [`real.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/real.rs)). | **Confirms the 0x40 request size; leaves the extra 4 bytes unknown.** The measurement fixes the size, not the field. No public source names them; `MaxGPUVirtualAddressBitsPerProcess` is a member of the separate `D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT`, not a published member of `D3D12_OPTIONS`. The repository's accept-and-zero-tail behaviour matches the observed failure and is safe. | 692| `CheckFeatureSupport(D3D12_OPTIONS)` with 0x40 bytes | Microsoft publishes the 15-field PC structure, 0x3C bytes, with no extra member ([`D3D12_FEATURE_DATA_D3D12_OPTIONS`](https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options_public.md)); its `CheckFeatureSupport` page says a size mismatch is `E_INVALIDARG` ([`CheckFeatureSupport`](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_checkfeaturesupport_public.md)). XCL measured XDefiant asking 0x40 and retries with 0x3C, zeroing the tail ([`HANDOFF.md`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/HANDOFF.md), [`real.rs`](https://github.com/ivall/xcl/blob/95bda116cfc1b118156901984052ff5698dbf4cc/crates/xcl/src/hle/d3d12x/real.rs)). | **Confirms the 0x40 request size; leaves the extra 4 bytes unknown.** The measurement fixes the size, not the field. No public source names them; `MaxGPUVirtualAddressBitsPerProcess` is a member of the separate `D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT`, not a published member of `D3D12_OPTIONS`. The repository's accept-and-zero-tail behaviour matches the observed failure and is safe. |
693 693
@@ -792,7 +792,7 @@ evidence.
792 792
793| Leonida unknown | Status after SCARAB (and §7.1) | What is actually new | 793| Leonida unknown | Status after SCARAB (and §7.1) | What is actually new |
794|---|---|---| 794|---|---|---|
795| #1 device entry point and 24-word params | **described** | The separate console device export exists at ordinal 13 and is named `D3D12ConsCreateDevice` internally / `D3D12XboxCreateDevice` publicly; the params struct is named `D3D12CONS_CREATE_DEVICE_PARAMETERS`. Public sources name 17 fields and their x64 offsets, plus two more field names; a 24-word block still has at least four words unaccounted (§7.1). | 795| #1 device entry point and 0x50-byte params | **described** | The separate console device export exists at ordinal 13 and is named `D3D12ConsCreateDevice` internally / `D3D12XboxCreateDevice` publicly; the params struct is named `D3D12CONS_CREATE_DEVICE_PARAMETERS`. Public sources name 17 fields and their x64 offsets, plus two more field names; the block measures 0x50 bytes (20 dwords) at the one retail call site, so the two dwords at 0x48/0x4C are the ones left unnamed (§7.1). |
796| #2 device/heap/queue/command-list slots | **partly measured** | §5.2 measures the arity and receiver of device slots 86, 101, 108, 132 and 133 (86, 101, 108 and 133 match the routes in [d3d12_vulkan.md](d3d12_vulkan.md) §3.1 and [retail_boot_chain.md](retail_boot_chain.md) §3.4); offset `+0x418` (131) has no device receiver, so it stays open. SCARAB has no console slot map. Its appended-after-GCL6 model conflicts with the SDK's GCL8/GCL9 methods (§5.1). Public §7.1 gives the presentation slots (device 78-81, queue 30/32); the heap and command-list slot map is still unknown. Do not use SCARAB as a slot source. | 796| #2 device/heap/queue/command-list slots | **partly measured** | §5.2 measures the arity and receiver of device slots 86, 101, 108, 132 and 133 (86, 101, 108 and 133 match the routes in [d3d12_vulkan.md](d3d12_vulkan.md) §3.1 and [retail_boot_chain.md](retail_boot_chain.md) §3.4); offset `+0x418` (131) has no device receiver, so it stays open. SCARAB has no console slot map. Its appended-after-GCL6 model conflicts with the SDK's GCL8/GCL9 methods (§5.1). Public §7.1 gives the presentation slots (device 78-81, queue 30/32); the heap and command-list slot map is still unknown. Do not use SCARAB as a slot source. |
797| #3 root signature → `s0..s31` | **still unknown** | Only flag names (`D3D12CONS_ROOT_SIGNATURE_FLAG_FORCE_MEMORY_BASED_ABI`, `_RAYTRACING`); no mapping. Leonida's own register-based/spill facts already go further. | 797| #3 root signature → `s0..s31` | **still unknown** | Only flag names (`D3D12CONS_ROOT_SIGNATURE_FLAG_FORCE_MEMORY_BASED_ABI`, `_RAYTRACING`); no mapping. Leonida's own register-based/spill facts already go further. |
798| #4 descriptor bytes and increments | **still unknown** | No measured increment. `D3D12CONS_DESCRIPTOR_HEAP_TYPE_SAMPLER_UNBOUNDED` is a new name, not a size. | 798| #4 descriptor bytes and increments | **still unknown** | No measured increment. `D3D12CONS_DESCRIPTOR_HEAP_TYPE_SAMPLER_UNBOUNDED` is a new name, not a size. |
diff --git a/docs/descriptor_lookup_ampere.md b/docs/descriptor_lookup_ampere.md
new file mode 100644
index 000000000..440d7ec06
--- /dev/null
+++ b/docs/descriptor_lookup_ampere.md
@@ -0,0 +1,68 @@
1# Descriptor lookup cost on NVIDIA RTX 3070 (Ampere)
2
3Divergent lookups in host-visible system RAM showed a steep cliff once the table reached 100,000 entries on this PCIe 3.0 x16 Ampere card with Resizable BAR off. On the GPU-only memory type, one million logical lane lookups took 270.3 µs at 1,000 live descriptors, 773.3 µs at 10,000 and 2,502.6 µs at 100,000 for divergent misses, and 73.0, 94.3 and 231.9 µs for divergent texture hits. The 214 MiB BAR1 memory type (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, exposed even with Resizable BAR disabled) stayed within 0.5% of GPU-only in every cell across all three sizes. By contrast, host-visible memory outside VRAM stayed within 10% of GPU-only at 1,000 entries and within 16% at 10,000, but at 100,000 entries it was 5.0× slower for uniform texture hits, 14.2× slower for divergent texture hits, 21.9× slower for divergent T#+S# pairs and 22.6× slower for divergent misses. These are synthetic compute results from one GeForce RTX 3070 on an idle Windows 11 desktop with NVIDIA driver 621.24. The benchmark ran unchanged at `5d74c27` (with the current default `--warmup-ms 300`).
4
5## Measurements
6
7Each cell is gross GPU time in **µs per million logical lane lookups**, including key reads and result accumulation. The benchmark also prints a figure with a key-read baseline subtracted (summarised below). The table uses its gross column so it compares directly with the [RTX 4070 SUPER (Ada) run](descriptor_lookup_ada.md).
8
9| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss |
10|---:|:---|---:|---:|---:|---:|---:|
11| 1,000 | GPU-only | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 |
12| 1,000 | Host-visible | 16.5 | 16.4 | 71.3 | 69.9 | 267.6 |
13| 1,000 | BAR1 (`host_device_local`) | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 |
14| 10,000 | GPU-only | 15.5 | 15.0 | 94.3 | 115.9 | 773.3 |
15| 10,000 | Host-visible | 16.8 | 17.0 | 104.4 | 134.4 | 880.7* |
16| 10,000 | BAR1 (`host_device_local`) | 15.5 | 15.0 | 94.4 | 115.4 | 771.7 |
17| 100,000 | GPU-only | 21.7 | 15.7 | 231.9 | 216.6 | 2,502.6 |
18| 100,000 | Host-visible | 108.0 | 18.4 | 3,290.5 | 4,734.5 | 56,519.6* |
19| 100,000 | BAR1 (`host_device_local`) | 21.7 | 15.8 | 231.8 | 216.7 | 2,499.3 |
20
21\* Shortened by the benchmark's Windows timeout guard in all 12 rounds (see Method).
22
23Net timings (after subtracting the matching key-read baseline) at 100,000 entries were: GPU-only `14.6`, `8.6`, `207.6`, `204.5`, `2,478.3`; BAR1 `14.6`, `8.6`, `207.5`, `204.6`, `2,475.1`; Host-visible `101.0`, `11.5`, `3,265.5`, `4,722.4`, `56,495.1*` µs per million.
24
25At 100,000 entries on type 1 (GPU-only), a divergent T# dispatch took 3.89 ms, a T#+S# dispatch took 7.27 ms and a divergent miss dispatch took 41.99 ms. Each paired iteration resolves two descriptors.
26
27GPU-only is type 1, `DEVICE_LOCAL`, on heap 0 (8,018 MiB). Host-visible is type 3, `HOST_VISIBLE | HOST_COHERENT` without `HOST_CACHED`, on heap 1 (16,345 MiB, not device-local). BAR1 (`host_device_local`, selected by `--memory rebar`) is type 5, `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, on heap 2 (214 MiB). Resizable BAR was **off**: `nvidia-smi` reported a 256 MiB BAR1 aperture (227 MiB used, 29 MiB free at idle), and every allocation on type 5 still succeeded up to the 20.0 MiB table. On this card, keeping the descriptor table out of non-device-local host-visible RAM matters far more at 100,000 entries than on the [Ada PCIe 4.0 + ReBAR card](descriptor_lookup_ada.md) (14.2×–22.6× penalty on divergent traffic here vs 1.45×–2.5× there), while the 214 MiB BAR1 heap remained within 0.5% of GPU-only VRAM in every cell whenever the table fit inside it.
28
29At 100,000 entries on GPU-only and BAR1, the 12 round medians split deterministically by which table size ran first in the process: the four rounds that started with 1,000 entries (rounds 1, 5, 8 and 12) measured 167.4–167.9 µs per million for divergent T# hits and 1,791.5–1,791.9 for divergent misses; the four that started with 10,000 entries (rounds 3, 6, 7 and 10) measured 231.8–232.1 and 2,498.4–2,505.4; and the four that started with 100,000 entries (rounds 2, 4, 9 and 11) measured 232.2–232.9 and 2,581.9–2,591.8. The table medians follow the eight rounds that did not start at 1,000 entries. The cause was not measured.
30
31The tables contain 90% T# texture keys and 10% S# sampler keys. Their allocations were 163,844, 2,621,444 and 20,971,524 bytes (0.156, 2.50 and 20.0 MiB). The capacities were 4,096, 65,536 and 524,288 slots, at 24.4%, 15.3% and 19.1% load. At 100,000 entries the ordinary uniform hit runs covered all 90,000 textures or all 10,000 samplers. Each workgroup shared a key for each iteration. The separate hot-key control (`uniform_hot_tsharp`) reused one texture and measured 12.8–13.1 µs per million gross (5.7–6.8 µs net) across all three memory types and sizes. Divergent misses visited 1,024, 16,384 and 131,072 distinct absent keys across the three sizes. Cache residency and memory traffic were unmeasured.
32
33## Method and replay
34
35Each dispatch used 4,096 groups of 64 lanes and 64 iterations. The RTX 3070 reported 32-lane subgroups (`minSubgroupSize = maxSubgroupSize = 32`). The denominator was 16,777,216 logical lookups per single-key dispatch and 33,554,432 per paired dispatch, counting the texture and sampler separately. Vulkan timestamps bracketed one dispatch. The compute queue advertised 64 valid bits and a 1 ns tick period.
36
37Each cell is the median of 12 process medians, each from 25 timed dispatches after five warmups plus the default `--warmup-ms 300` clock-warmup window (TEST-277). The 11 scenarios ran in the benchmark's fixed order. There were 36 processes: three memory types in each of 12 rounds. Across them there were 29,124 timed dispatches. Every process exited 0, wrote nothing to stderr and reported `timing_status` `ok` on all 1,188 rows. The run used the default Windows Vulkan loader with validation layers off and `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` set to keep overlay layers out of the run; desktop GPU utilization at idle was 2% (993 MiB VRAM used, P5).
38
39As in the [Ada run](descriptor_lookup_ada.md), this run kept the default `--max-dispatch-ms 120` guard to stay clear of the Windows 2 s GPU timeout (TDR). Only host-visible cells were shortened, all 12 of 12 rounds: at 10,000 entries, `divergent_miss` ran with 13–26 iterations (median dispatch 4.38 ms, range 1.60–6.37 ms); at 100,000 entries, `divergent_miss` ran with 19 iterations in all 12 rounds (median dispatch 281.51 ms, range 276.11–285.21 ms) and `latency_divergent` (outside the summary table; gross median 8,135.0 µs per million) ran with 26 iterations in all 12 rounds (median dispatch 55.45 ms, range 47.57–56.15 ms).
40
41From a Leonida checkout on Windows, with Visual Studio C++ tools, CMake + Ninja, Windows SDK 10.0.26100+ and Vulkan headers (`VULKAN_SDK` or `-DLEONIDA_VULKAN_HEADERS_FETCH=ON`):
42
43```powershell
44runtime\build\vk_descriptor_bench.exe --list-devices
45runtime\build\vk_descriptor_bench.exe --self-test
46$env:DISABLE_RTSS_LAYER = "1"
47$env:DISABLE_VULKAN_OBS_CAPTURE = "1"
48foreach ($memory in 'device', 'host', 'rebar') {
49 runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 `
50 --groups 4096 --iters 64 --warmup 5 --reps 25 --warmup-ms 300 --csv
51}
52```
53
54Device 0 was the RTX 3070, the only Vulkan device. For the full 12-round series, let A, B and C denote 1k, 10k and 100k. The rounds used the same size orders and starting memory types as the [M3 Max](descriptor_lookup_apple.md) and [Ada](descriptor_lookup_ada.md) runs: the first six size orders were ABC, CBA, BAC, CAB, ACB and BCA, starting with `device`, `host`, `device`, `device`, `host` and `host` respectively; the next six reversed the sequence of rounds and swapped the starting memory type in each, with `rebar` third in every round.
55
56## System
57
58| | |
59|:---|:---|
60| GPU | NVIDIA GeForce RTX 3070 (Ampere), 8,192 MiB (discrete) |
61| PCI id | `0x10de:0x2488`, subsystem `0x404e1458` |
62| Link | PCIe 3.0 x16 (current and maximum reported by `nvidia-smi`; B450 AORUS M) |
63| Resizable BAR | Off (BAR1 aperture 256 MiB, `nvidia-smi -q -d MEMORY`; Vulkan heap 2 reports 214 MiB `DEVICE_LOCAL \| HOST_VISIBLE \| HOST_COHERENT`) |
64| Subgroup size | 32 |
65| Driver | NVIDIA 621.24 (`nvidia-smi`), Vulkan API 1.4.357 |
66| OS | Windows 11 Pro 26H2, build 26300.9974 |
67| Vulkan headers | 1.4.363.0 (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`) |
68| Compiler | Visual Studio 18 Professional (MSVC 19.51.36260.0), `RelWithDebInfo` via CMake + Ninja |
diff --git a/docs/design.md b/docs/design.md
index 9e728f737..75f12c530 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -300,7 +300,7 @@ How the generated SPIR-V expects the runtime to work:
300|---|---| 300|---|---|
301| Heap-relative buffer device addresses | `Gen.host_addr` sign-extends the low 48 bits of the effective VA after adding any byte offset, then adds `%heap_base`. The runtime stores `device_address - heap_base` in a V#'s 48-bit base field. NVIDIA's Windows driver can place an imported buffer below the heap, so that offset is negative. Zero extension made the resulting device address too high by `2^48`. Console user-mode VAs below `2^47` and full-width root descriptor addresses already within the signed 48-bit range retain their values. A 64-bit base-plus-offset sum gives the correct address for effective VAs in that range, including when the sum crosses zero. Each new shader's `index.json` entry carries `"vsharp_base_sign_extended": true`. Check the field on all loaded entries before enabling below-arena imports for a library, because older modules can share an index with newly translated ones. `tests/semantic/test_vsharp_sext48.py` checks the emitted shifts, both reads against synthetic memory, and the metadata field. | 301| Heap-relative buffer device addresses | `Gen.host_addr` sign-extends the low 48 bits of the effective VA after adding any byte offset, then adds `%heap_base`. The runtime stores `device_address - heap_base` in a V#'s 48-bit base field. NVIDIA's Windows driver can place an imported buffer below the heap, so that offset is negative. Zero extension made the resulting device address too high by `2^48`. Console user-mode VAs below `2^47` and full-width root descriptor addresses already within the signed 48-bit range retain their values. A 64-bit base-plus-offset sum gives the correct address for effective VAs in that range, including when the sum crosses zero. Each new shader's `index.json` entry carries `"vsharp_base_sign_extended": true`. Check the field on all loaded entries before enabling below-arena imports for a library, because older modules can share an index with newly translated ones. `tests/semantic/test_vsharp_sext48.py` checks the emitted shifts, both reads against synthetic memory, and the metadata field. |
302| Null sources in 64-bit integer VALU compares | `v_cmp` and `v_cmpx` relations `eq`, `ne`, `lt`, `le`, `gt`, `ge` on `u64` and `i64` read `null` as the 64-bit value 0 in either source, like immediate `0`. Register pairs and immediates retain their existing semantics; `v_cmp` writes the active lane's comparison to VCC/SGPR, while `v_cmpx` narrows EXEC without changing VCC. Source: RDNA2 ISA special operand `null` reads zero; LLVM `llvm-mc -mcpu=gfx1013` accepts the encoding. CPU-checked by `tests/semantic/test_vcmp64_null_src.py` (both sources, signed/unsigned ordering, equality, e32/e64, EXEC and inactive lanes); **not GPU-verified, no corpus count**. | 302| Null sources in 64-bit integer VALU compares | `v_cmp` and `v_cmpx` relations `eq`, `ne`, `lt`, `le`, `gt`, `ge` on `u64` and `i64` read `null` as the 64-bit value 0 in either source, like immediate `0`. Register pairs and immediates retain their existing semantics; `v_cmp` writes the active lane's comparison to VCC/SGPR, while `v_cmpx` narrows EXEC without changing VCC. Source: RDNA2 ISA special operand `null` reads zero; LLVM `llvm-mc -mcpu=gfx1013` accepts the encoding. CPU-checked by `tests/semantic/test_vcmp64_null_src.py` (both sources, signed/unsigned ordering, equality, e32/e64, EXEC and inactive lanes); **not GPU-verified, no corpus count**. |
303| `s_load_dword*` with `vcc` 64-bit base pointer | SMEM `s_load_dword*` accepts `vcc` (`{vcc_lo, vcc_hi}`, hardware `s[106:107]`) as its 64-bit base pointer in `Gen.scalar_load`, loading `%vcc` as the low dword and `%vcc_hi` as the high dword; `s_buffer_load*` still requires a 4-dword V# and rejects 2-dword `vcc`. Source: RDNA2 ISA SMEM `SBASE` encoding (`sbase = 53` -> `s[106:107] = vcc`). Confirmed by corpus count over the 2,684-shader pipeline library compute corpus (79 shaders use `vcc` as the `s_load` base: 72 `s_load_dwordx4 sgpr, vcc`, 6 `s_load_dwordx8 sgpr, vcc`, 1 `s_load_dwordx4 slist, vcc`; all 79 translate and pass `spirv-val` under `--wave64-emulate`) and CPU-checked by `tests/semantic/test_sload_vcc_base.py` (`spirv-as` + `spirv-val`) and `tests/semantic/test_scalar_mem_smem.py` (both halves and the resulting addresses); **not GPU-verified**: the synthetic `runtime/test/shaders/cs_smem_vcc_base.asm` reads back eight seeded words through the pair in the standard GPU runner. | 303| `s_load_dword*` with `vcc` 64-bit base pointer | SMEM `s_load_dword*` accepts `vcc` (`{vcc_lo, vcc_hi}`, hardware `s[106:107]`) as its 64-bit base pointer in `Gen.scalar_load`, loading `%vcc` as the low dword and `%vcc_hi` as the high dword; `s_buffer_load*` still requires a 4-dword V# and rejects 2-dword `vcc`. Source: RDNA2 ISA SMEM `SBASE` encoding (`sbase = 53` -> `s[106:107] = vcc`). Confirmed by corpus count over the 2,684-shader pipeline library compute corpus (79 shaders use `vcc` as the `s_load` base: 72 `s_load_dwordx4 sgpr, vcc`, 6 `s_load_dwordx8 sgpr, vcc`, 1 `s_load_dwordx4 slist, vcc`; all 79 translate and pass `spirv-val` under `--wave64-emulate`) and CPU-checked by `tests/semantic/test_sload_vcc_base.py` (`spirv-as` + `spirv-val`) and `tests/semantic/test_scalar_mem_smem.py` (both halves and the resulting addresses); **GPU-checked** with the synthetic `runtime/test/shaders/cs_smem_vcc_base.asm`, which reads back the eight seeded words through the pair in the standard GPU runner (`0x7210..0x7217`): on an AMD Radeon gfx1036 iGPU (Ryzen 7 7800X3D, Windows 11, driver 32.0.21045.29003) and, under `LEONIDA_W64_EMULATE=1`, on an NVIDIA GeForce RTX 4090 (Windows 11, driver 32.0.16.2124); without the emulation the fixture skips on the 4090 (no 64-wide compute subgroup). Still not measured: those eight words of one fixture are the whole hardware check, the 79-program corpus count stays a translation count, and there is no native 32-wide-subgroup run of this form. |
304| Execution model | One invocation = one lane. Compute and mesh waves derive lanes from the workgroup-local index; other stages use the subgroup lane. A wave = a subgroup, so cross-lane ops (`ds_swizzle`, `v_permlane*`, `v_readlane`/`v_writelane`, `v_mbcnt`) become subgroup shuffles. Wave32 pixel shaders split a 64-lane physical subgroup into two logical waves: lane IDs are `SubgroupLocalInvocationId & 31`, shuffle sources retain the current half (`& 32`), and ballots/votes use that half's 32-bit word. A value the translator knows is uniform (the bindless descriptor index) is read from the half's first running lane, never from a fixed lane, which need not be running (SHADER-1016). Other stage/wave combinations still require subgroup size == wave size or wave64 emulation. **Requires subgroup size == wave size** (wave32 maps directly onto NVIDIA GPUs; wave64 shaders need a 64-wide subgroup or emulation). `v_readlane_b32`/`v_writelane_b32` mask the lane select with 63 in wave64 (`S1[5:0]`) and 31 in wave32 (`S1[4:0]`); until SHADER-52 both used 63, so a wave32 select ≥ 32 pointed past a 32-wide subgroup. GPU-checked with `cs_w32_lane_wrap.asm` (lane 40 → 8). For the fragment-half rule, `ps_bitmask_perm` produced 4096/4096 exact pixels on an AMD Radeon RX 5700 XT; Vulkan reported a default subgroup size of 64 (range 32..64), but does not permit pinning fragment subgroup size on this device. CPU semantic tests compare a 64-lane wave32 pixel subgroup against two 32-lane subgroups for reads/writes, permutations, ballots, and votes. | 304| Execution model | One invocation = one lane. Compute and mesh waves derive lanes from the workgroup-local index; other stages use the subgroup lane. A wave = a subgroup, so cross-lane ops (`ds_swizzle`, `v_permlane*`, `v_readlane`/`v_writelane`, `v_mbcnt`) become subgroup shuffles. Wave32 pixel shaders split a 64-lane physical subgroup into two logical waves: lane IDs are `SubgroupLocalInvocationId & 31`, shuffle sources retain the current half (`& 32`), and ballots/votes use that half's 32-bit word. A value the translator knows is uniform (the bindless descriptor index) is read from the half's first running lane, never from a fixed lane, which need not be running (SHADER-1016). Other stage/wave combinations still require subgroup size == wave size or wave64 emulation. **Requires subgroup size == wave size** (wave32 maps directly onto NVIDIA GPUs; wave64 shaders need a 64-wide subgroup or emulation). `v_readlane_b32`/`v_writelane_b32` mask the lane select with 63 in wave64 (`S1[5:0]`) and 31 in wave32 (`S1[4:0]`); until SHADER-52 both used 63, so a wave32 select ≥ 32 pointed past a 32-wide subgroup. GPU-checked with `cs_w32_lane_wrap.asm` (lane 40 → 8). For the fragment-half rule, `ps_bitmask_perm` produced 4096/4096 exact pixels on an AMD Radeon RX 5700 XT; Vulkan reported a default subgroup size of 64 (range 32..64), but does not permit pinning fragment subgroup size on this device. CPU semantic tests compare a 64-lane wave32 pixel subgroup against two 32-lane subgroups for reads/writes, permutations, ballots, and votes. |
305| DPP | VOP1/VOP2 `_dpp` applies to src0. DPP16 controls (`quad_perm`, `row_shl/shr/ror/share/xmask/mirror/half_mirror`) and DPP8 (`dpp8` + `fi`) select the source lane, then `row_mask` (one bit per 16-lane row) and `bank_mask` (one bit per 4-lane bank) decide which destination lanes update. A lane whose row/bank is off is not written. A source lane outside the row is invalid: `bound_ctrl` 1 uses 0 as src0, otherwise the lane is not written. Hardware applies src0 float modifiers (`neg`/`abs`) after the invalid-lane zero selection, so `-src0` on an invalid lane yields `-0.0f` (`0x80000000`) and `\|src0\|` yields `+0.0f` (HW-DPP-NEG-INVALID-LANE, measured on RDNA3 (gfx1101) RX 7800 XT, RDNA2 not measured; tested by `tests/semantic/test_dpp_bound_ctrl_modifiers.py`). A source lane inactive under EXEC is used when `fi` is 1; otherwise `bound_ctrl` decides. DPP8 always writes an enabled lane: `fi` 1 reads the inactive source, `fi` 0 uses 0. DPP16/8 never leaves its 16/8-lane group, so this is exact on every subgroup at least that wide; under `--wave64-emulate` the exchange goes through the workgroup buffer like the other cross-lane ops. GPU-checked with `runtime/test/shaders/cs_dpp*.asm` on an RTX 3070 and hardware-measured on an RX 6800. On an RX 6700 XT (gfx1031), `tools/crosslane_fuzz.py --dpp-sweep --oracle hw` checks every DPP16 control × `bound_ctrl` × `fi`, every `row_mask`/`bank_mask` pair and the DPP8 selects in wave32 and wave64: 14,412 cases, all matching these rules (BUILD-162, `docs/shader_validation.md` FUZZ-7). The ballot of the source lanes' EXEC bits and the shuffle are each stored to a Function variable of their own (`Gen.eager`): SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that uses it, which put the ballot on the right of a short-circuiting `&&` and the shuffle in a ternary's arm, so lanes out of their row skipped the ballot and row_shr:1's lane 1 found lane 0 inactive (`cs_dpp_ops` on MoltenVK; SHADER-529). A store is a statement every lane runs. Out-of-row `in_bounds` clamps `safe_sg` to own subgroup lane `sgl` (never constant lane 0). For native FI=0, the active-lane ballot bit selects the shuffle index (`OpSelect(bit, safe_sg, sgl)`); for native FI=1 on a VGPR source, a `%true` present-lane ballot bit similarly redirects unlaunched/absent lanes in a partial subgroup to `sgl` (treating absent lanes as invalid while still fetching EXEC-off launched lanes). CPU-checked by `tests/semantic/test_dpp_eager_subgroup.py` and `tests/semantic/test_absent_lane_ub.py`, and GPU-checked on a Radeon gfx1036 RDNA2 iGPU (RADV, `tests/test_absent_lane_gpu.py`, partial 5-thread CS and 1×1 PS with `LEONIDA_VK_VALIDATION=1`). Checked in SPIRV-Cross 1.3.239's MSL for the `cs_dpp*` tests (each op is now its own statement) and by `tests/semantic/test_dpp_eager_subgroup.py`; not yet run on a Mac. Semantics from the RDNA2 ISA, AMD LLVM modifier syntax and the GPUOpen DPP notes. | 305| DPP | VOP1/VOP2 `_dpp` applies to src0. DPP16 controls (`quad_perm`, `row_shl/shr/ror/share/xmask/mirror/half_mirror`) and DPP8 (`dpp8` + `fi`) select the source lane, then `row_mask` (one bit per 16-lane row) and `bank_mask` (one bit per 4-lane bank) decide which destination lanes update. A lane whose row/bank is off is not written. A source lane outside the row is invalid: `bound_ctrl` 1 uses 0 as src0, otherwise the lane is not written. Hardware applies src0 float modifiers (`neg`/`abs`) after the invalid-lane zero selection, so `-src0` on an invalid lane yields `-0.0f` (`0x80000000`) and `\|src0\|` yields `+0.0f` (HW-DPP-NEG-INVALID-LANE, measured on RDNA3 (gfx1101) RX 7800 XT, RDNA2 not measured; tested by `tests/semantic/test_dpp_bound_ctrl_modifiers.py`). A source lane inactive under EXEC is used when `fi` is 1; otherwise `bound_ctrl` decides. DPP8 always writes an enabled lane: `fi` 1 reads the inactive source, `fi` 0 uses 0. DPP16/8 never leaves its 16/8-lane group, so this is exact on every subgroup at least that wide; under `--wave64-emulate` the exchange goes through the workgroup buffer like the other cross-lane ops. GPU-checked with `runtime/test/shaders/cs_dpp*.asm` on an RTX 3070 and hardware-measured on an RX 6800. On an RX 6700 XT (gfx1031), `tools/crosslane_fuzz.py --dpp-sweep --oracle hw` checks every DPP16 control × `bound_ctrl` × `fi`, every `row_mask`/`bank_mask` pair and the DPP8 selects in wave32 and wave64: 14,412 cases, all matching these rules (BUILD-162, `docs/shader_validation.md` FUZZ-7). The ballot of the source lanes' EXEC bits and the shuffle are each stored to a Function variable of their own (`Gen.eager`): SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that uses it, which put the ballot on the right of a short-circuiting `&&` and the shuffle in a ternary's arm, so lanes out of their row skipped the ballot and row_shr:1's lane 1 found lane 0 inactive (`cs_dpp_ops` on MoltenVK; SHADER-529). A store is a statement every lane runs. Out-of-row `in_bounds` clamps `safe_sg` to own subgroup lane `sgl` (never constant lane 0). For native FI=0, the active-lane ballot bit selects the shuffle index (`OpSelect(bit, safe_sg, sgl)`); for native FI=1 on a VGPR source, a `%true` present-lane ballot bit similarly redirects unlaunched/absent lanes in a partial subgroup to `sgl` (treating absent lanes as invalid while still fetching EXEC-off launched lanes). CPU-checked by `tests/semantic/test_dpp_eager_subgroup.py` and `tests/semantic/test_absent_lane_ub.py`, and GPU-checked on a Radeon gfx1036 RDNA2 iGPU (RADV, `tests/test_absent_lane_gpu.py`, partial 5-thread CS and 1×1 PS with `LEONIDA_VK_VALIDATION=1`). Checked in SPIRV-Cross 1.3.239's MSL for the `cs_dpp*` tests (each op is now its own statement) and by `tests/semantic/test_dpp_eager_subgroup.py`; not yet run on a Mac. Semantics from the RDNA2 ISA, AMD LLVM modifier syntax and the GPUOpen DPP notes. |
306| DPP on a VOPC compare | A VOPC compare whose src0 field is a DPP marker (250 for DPP16, 233/234 for DPP8) takes src0 through the DPP lane selection of the row above and writes VCC: a lane's bit is `compare(src0 of the selected lane, its own src1)`, with 0 for src0 when the selected lane is out of its row or inactive (`bound_ctrl` 1, or DPP8 with `fi` 0). The second word has the layout of a VOP2's DPP word. `llvm-mc` has no decoding for it on gfx10 (LLVM 21.1.8 rejects the first word for `gfx1013`; LLVM defines the form from GFX11 on), so `tools/shader_disasm.py` prints it: it decodes the pair with the first word turned into `v_max_f32` into `v0`, which takes the same second word, and gives the line the compare's name, a `vcc_lo` destination and the real encoding back (`with_vopc_dpp`); `tools/rdna2_decode.py` decodes it directly. **Only the forms where every lane writes its bit are translated**: `row_mask` and `bank_mask` 0xF and either `bound_ctrl` 1 or DPP8. Any other form is refused (`DPP compare with lanes DPP leaves unwritten`), because what such a lane writes is measured only on RDNA3, not on RDNA2. On RDNA3 (gfx1101, RX 7800 XT, `tools/hw_oracle`, wave32 and wave64; [measurement](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161289307)) a lane DPP leaves unwritten does not keep its bit: `v_cmp` writes 0 to its VCC bit and `v_cmpx` turns it off in EXEC. That holds for an invalid source with `bound_ctrl` 0, and for a lane `row_mask` or `bank_mask` turns off, even with `bound_ctrl` 1. Translating these forms on RDNA2 (gfx1013) would need the same measurement there. `v_cmpx` in DPP form takes the same lane selection and the same forms, and writes EXEC as the plain `v_cmpx` does (a lane that was off stays off); it prints no destination, so its src0 is the first operand (SHADER-VOPCX-DPP). Found in 3 of the 2,684 pipeline-library compute programs of 1.0.2.1: 4 `v_cmp_gt_f32` each, with `quad_perm:[1,0,3,2]`, `quad_perm:[2,3,0,1]`, `row_ror:8` (all `bound_ctrl:1`, masks 0xF) and `dpp8:[4,5,6,7,0,1,2,3]`, beside `v_min/max_f32_dpp` and `v_mov_b32_dpp` on the same lanes. `v_cmpx` in DPP form is in 78 of the 18,837 graphics programs of the pipeline library (all pixel shaders, 113 instructions), all `v_cmpx_gt_f32_dpp vN, -vM quad_perm:[2,3,0,1] row_mask:0xf bank_mask:0xf bound_ctrl:1 fi:1`, a compare against the lane two above or below in its quad. **Not measured on RDNA2 hardware**: the rule follows from the encoding, from LLVM's GFX11 definition of the same form and from the VOP2 DPP rules measured in the row above; the sweep that measured those (`tools/crosslane_fuzz.py --dpp-sweep --oracle hw`) does not cover compares. The RDNA3 measurement above also ran the translated forms (`bound_ctrl` 1, masks 0xF): an invalid source lane gets the compare of a 0 source, as the rule says. Lane values are checked in `tests/semantic/test_dpp_compare.py` (the SPIR-V interpreter) and on a GPU with `runtime/test/shaders/cs_dpp_cmp.asm` and, for `v_cmpx`, `cs_dpp_cmpx.asm` (RTX 4070 Laptop, native wave32 and `--wave64-emulate`). | 306| DPP on a VOPC compare | A VOPC compare whose src0 field is a DPP marker (250 for DPP16, 233/234 for DPP8) takes src0 through the DPP lane selection of the row above and writes VCC: a lane's bit is `compare(src0 of the selected lane, its own src1)`, with 0 for src0 when the selected lane is out of its row or inactive (`bound_ctrl` 1, or DPP8 with `fi` 0). The second word has the layout of a VOP2's DPP word. `llvm-mc` has no decoding for it on gfx10 (LLVM 21.1.8 rejects the first word for `gfx1013`; LLVM defines the form from GFX11 on), so `tools/shader_disasm.py` prints it: it decodes the pair with the first word turned into `v_max_f32` into `v0`, which takes the same second word, and gives the line the compare's name, a `vcc_lo` destination and the real encoding back (`with_vopc_dpp`); `tools/rdna2_decode.py` decodes it directly. **Only the forms where every lane writes its bit are translated**: `row_mask` and `bank_mask` 0xF and either `bound_ctrl` 1 or DPP8. Any other form is refused (`DPP compare with lanes DPP leaves unwritten`), because what such a lane writes is measured only on RDNA3, not on RDNA2. On RDNA3 (gfx1101, RX 7800 XT, `tools/hw_oracle`, wave32 and wave64; [measurement](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161289307)) a lane DPP leaves unwritten does not keep its bit: `v_cmp` writes 0 to its VCC bit and `v_cmpx` turns it off in EXEC. That holds for an invalid source with `bound_ctrl` 0, and for a lane `row_mask` or `bank_mask` turns off, even with `bound_ctrl` 1. Translating these forms on RDNA2 (gfx1013) would need the same measurement there. `v_cmpx` in DPP form takes the same lane selection and the same forms, and writes EXEC as the plain `v_cmpx` does (a lane that was off stays off); it prints no destination, so its src0 is the first operand (SHADER-VOPCX-DPP). Found in 3 of the 2,684 pipeline-library compute programs of 1.0.2.1: 4 `v_cmp_gt_f32` each, with `quad_perm:[1,0,3,2]`, `quad_perm:[2,3,0,1]`, `row_ror:8` (all `bound_ctrl:1`, masks 0xF) and `dpp8:[4,5,6,7,0,1,2,3]`, beside `v_min/max_f32_dpp` and `v_mov_b32_dpp` on the same lanes. `v_cmpx` in DPP form is in 78 of the 18,837 graphics programs of the pipeline library (all pixel shaders, 113 instructions), all `v_cmpx_gt_f32_dpp vN, -vM quad_perm:[2,3,0,1] row_mask:0xf bank_mask:0xf bound_ctrl:1 fi:1`, a compare against the lane two above or below in its quad. **Not measured on RDNA2 hardware**: the rule follows from the encoding, from LLVM's GFX11 definition of the same form and from the VOP2 DPP rules measured in the row above; the sweep that measured those (`tools/crosslane_fuzz.py --dpp-sweep --oracle hw`) does not cover compares. The RDNA3 measurement above also ran the translated forms (`bound_ctrl` 1, masks 0xF): an invalid source lane gets the compare of a 0 source, as the rule says. Lane values are checked in `tests/semantic/test_dpp_compare.py` (the SPIR-V interpreter) and on a GPU with `runtime/test/shaders/cs_dpp_cmp.asm` and, for `v_cmpx`, `cs_dpp_cmpx.asm` (RTX 4070 Laptop, native wave32 and `--wave64-emulate`). |
@@ -499,7 +499,7 @@ How the generated SPIR-V expects the runtime to work:
499| Scalar select and pack (`s_cmov_b32`, `s_cmovk_i32`, `s_cmov_b64`, `s_pack_ll/lh/hh_b32_b16`) | `s_cmov_b32` / `s_cmovk_i32`: D = SCC ? S0 : D (`s_cmovk_i32`'s S0 is the 16-bit immediate, sign-extended); SCC is read, not written; the destination must be an SGPR (a lane-mask destination stays `Unsupported`, #210). `s_cmov_b64`: D[63:0] = SCC ? S0[63:0] : D[63:0] on plain 64-bit data pairs (SGPR pair, immediate or `null`), SCC read and not written; a pair that is or has been a lane mask (EXEC, VCC or a mask SGPR) stays `Unsupported` (#210) — conservatively, because a CFG join can drop a register that is a mask on only one path — while 0/-1 EITHER constants are data; selecting a per-lane bit as data would silently return a bool instead of the wave's mask. D[63:0] on plain 64-bit data pairs (SGPR pair, immediate or `null`), SCC read and not written; a pair that is or has been a lane mask stays `Unsupported` (#210). D[63:0], SCC read and not written, on plain 64-bit data pairs (SGPR pair, immediate or `null`); any dword that is or has been a lane mask (EXEC, VCC or a mask SGPR) makes the pair `Unsupported` — conservatively, because a CFG join can drop a register that is a mask on only one path — while 0/-1 EITHER constants are data; selecting a per-lane bit as data would silently return a bool instead of the wave's mask (#210). `s_pack_*`: the low half of D from S0, the high half from S1, the letters naming the half of each (l = 15:0, h = 31:16), S0 first; GFX10 has no `s_pack_hl`; SCC not written. Source: RDNA2 ISA SOP1/SOP2/SOPK and LLVM AMDGPU `SOPInstructions.td` (`S_CMOV_B64 : RDNA2 ISA SOP1/SOP2/SOPK. CPU-checked by `tests/semantic/test_salu_cmov.py` and `test_salu_pack.py`; the translated shaders were run on NVIDIA by reviewers (`s_cmov*`: RDNA2 ISA SOP1/SOP2/SOPK and LLVM AMDGPU [SOPInstructions.td](https://github.com/llvm/llvm-project/blob/2bfedf3338162e2c841a73cd7cd9e98d00add608/llvm/lib/Target/AMDGPU/SOPInstructions.td) (`S_CMOV_B64 : SOP1_64` under `Uses = [SCC]`). CPU-checked by `tests/semantic/test_salu_cmov.py`, `tests/semantic/test_salu_cmov_b64.py` and `test_salu_pack.py`; no corpus count; **not GPU-verified, no corpus count**; the translated shaders were run on NVIDIA by reviewers (`s_cmov_b32/k_i32`: **no corpus count**; Hardware: on native `gfx1036` (Ryzen 9 9950X3D iGPU, Windows 11, driver 26.10.1) `tools/int_hw_probe.py --oracle both --wave both` matches the translator in wave32 and wave64 for all five `salu_cmov_pack` cases and for the 14 `s_cmov_b64` cases (`--group salu_cmov_b64`: GPU-checked for `s_cmov_b32` (`cs_w32_salu64.asm`, SCC = 1 selects S0) and `s_pack_lh_b32_b16` (`cs_w32_int_ext.asm`) on the Radeon iGPU of a Ryzen 9 9950X3D (RDNA2, `gfx1036`, driver 26.10.1) and an RTX 5080 (driver 616.92); `s_cmovk_i32`, `s_cmov_b64` and the other `s_pack_*` forms have no GPU test on main; the translated shaders were also run on NVIDIA by reviewers (`s_cmov_b32/k_i32`: RTX 5090, RTX 4050 and Radeon 740M in #613; `s_pack_*`: RTX 5090 in #449). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137, SCC kept), and on native gfx1036 (AMD Radeon Graphics, Windows 11, driver 26.10.1) through `tools/hw_oracle`: all five `salu_cmov_pack` cases and the 14 `s_cmov_b64` cases match the translator in wave32 and wave64 (SCC 0 and 1; an SGPR pair, the inline constants -1/-16/64, the literal 0x89abcdef, `null` and the destination itself; SCC = 1 takes S0, 0 keeps D, SCC is never written), `s_cmov_b32` matches under SCC=0 and SCC=1, and `s_pack_ll/lh/hh_b32_b16` is bit-exact on 500 random programs with 0 mismatches (`--oracle translator,hw`). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137, SCC kept). Also **measured on RDNA2 gfx1036** (Radeon iGPU of a Ryzen 9 9950X3D, Windows 11, driver 26.10.1, `tools/hw_oracle` HIP launcher, rocm-sdk-core clang): `tools/int_hw_probe.py --oracle both --wave both` gives the same words as the translator for all five `salu_cmov_pack` cases in wave32 and wave64, and the 14 `s_cmov_b64` cases of the `salu_cmov_b64` group (`python -I tools/int_hw_probe.py --oracle both --wave both --group salu_cmov_b64`; SCC 0 and 1; source an SGPR pair, the inline constants -1, -16 and 64, the literal 0x89abcdef, `null`, and the destination itself; SCC preset and read back after): SCC preset and read back after) match the translator in wave32 and wave64: SCC = 1 takes S0 (a literal zero-extended, an inline constant sign-extended, `null` gives 0), SCC = 0 keeps D, SCC is never written. Also on `gfx1035` via `int_hw_probe` (SHADER-137, SCC kept), and on `gfx1036` and an RTX 5080 through the fixtures `cs_w32_salu64.asm` (`s_cmov_b32`) and `cs_w32_int_ext.asm` (`s_pack_lh_b32_b16`). `tools/hw_oracle` + `tools/salu_diff.py` verify `s_cmov_b32` under SCC 0/1 and `s_pack_ll/lh/hh_b32_b16` bit-exact on 500 random programs with 0 mismatches. Reviewers ran `s_cmov*` on an RTX 5090, an RTX 4050 and a Radeon 740M (#613) and `s_pack_*` on an RTX 5090 (#449). Measured on native gfx1036 (AMD Radeon Graphics, RDNA2) through tools/hw_oracle and tools/salu_diff.py: s_cmov_b32 verified under SCC=0 and SCC=1 (preserving destination and updating respectively); s_pack_ll/lh/hh_b32_b16 verified bit-exact on 500 random programs with 0 mismatches (--oracle translator,hw). **Not measured on RDNA2.** | 499| Scalar select and pack (`s_cmov_b32`, `s_cmovk_i32`, `s_cmov_b64`, `s_pack_ll/lh/hh_b32_b16`) | `s_cmov_b32` / `s_cmovk_i32`: D = SCC ? S0 : D (`s_cmovk_i32`'s S0 is the 16-bit immediate, sign-extended); SCC is read, not written; the destination must be an SGPR (a lane-mask destination stays `Unsupported`, #210). `s_cmov_b64`: D[63:0] = SCC ? S0[63:0] : D[63:0] on plain 64-bit data pairs (SGPR pair, immediate or `null`), SCC read and not written; a pair that is or has been a lane mask (EXEC, VCC or a mask SGPR) stays `Unsupported` (#210) — conservatively, because a CFG join can drop a register that is a mask on only one path — while 0/-1 EITHER constants are data; selecting a per-lane bit as data would silently return a bool instead of the wave's mask. D[63:0] on plain 64-bit data pairs (SGPR pair, immediate or `null`), SCC read and not written; a pair that is or has been a lane mask stays `Unsupported` (#210). D[63:0], SCC read and not written, on plain 64-bit data pairs (SGPR pair, immediate or `null`); any dword that is or has been a lane mask (EXEC, VCC or a mask SGPR) makes the pair `Unsupported` — conservatively, because a CFG join can drop a register that is a mask on only one path — while 0/-1 EITHER constants are data; selecting a per-lane bit as data would silently return a bool instead of the wave's mask (#210). `s_pack_*`: the low half of D from S0, the high half from S1, the letters naming the half of each (l = 15:0, h = 31:16), S0 first; GFX10 has no `s_pack_hl`; SCC not written. Source: RDNA2 ISA SOP1/SOP2/SOPK and LLVM AMDGPU `SOPInstructions.td` (`S_CMOV_B64 : RDNA2 ISA SOP1/SOP2/SOPK. CPU-checked by `tests/semantic/test_salu_cmov.py` and `test_salu_pack.py`; the translated shaders were run on NVIDIA by reviewers (`s_cmov*`: RDNA2 ISA SOP1/SOP2/SOPK and LLVM AMDGPU [SOPInstructions.td](https://github.com/llvm/llvm-project/blob/2bfedf3338162e2c841a73cd7cd9e98d00add608/llvm/lib/Target/AMDGPU/SOPInstructions.td) (`S_CMOV_B64 : SOP1_64` under `Uses = [SCC]`). CPU-checked by `tests/semantic/test_salu_cmov.py`, `tests/semantic/test_salu_cmov_b64.py` and `test_salu_pack.py`; no corpus count; **not GPU-verified, no corpus count**; the translated shaders were run on NVIDIA by reviewers (`s_cmov_b32/k_i32`: **no corpus count**; Hardware: on native `gfx1036` (Ryzen 9 9950X3D iGPU, Windows 11, driver 26.10.1) `tools/int_hw_probe.py --oracle both --wave both` matches the translator in wave32 and wave64 for all five `salu_cmov_pack` cases and for the 14 `s_cmov_b64` cases (`--group salu_cmov_b64`: GPU-checked for `s_cmov_b32` (`cs_w32_salu64.asm`, SCC = 1 selects S0) and `s_pack_lh_b32_b16` (`cs_w32_int_ext.asm`) on the Radeon iGPU of a Ryzen 9 9950X3D (RDNA2, `gfx1036`, driver 26.10.1) and an RTX 5080 (driver 616.92); `s_cmovk_i32`, `s_cmov_b64` and the other `s_pack_*` forms have no GPU test on main; the translated shaders were also run on NVIDIA by reviewers (`s_cmov_b32/k_i32`: RTX 5090, RTX 4050 and Radeon 740M in #613; `s_pack_*`: RTX 5090 in #449). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137, SCC kept), and on native gfx1036 (AMD Radeon Graphics, Windows 11, driver 26.10.1) through `tools/hw_oracle`: all five `salu_cmov_pack` cases and the 14 `s_cmov_b64` cases match the translator in wave32 and wave64 (SCC 0 and 1; an SGPR pair, the inline constants -1/-16/64, the literal 0x89abcdef, `null` and the destination itself; SCC = 1 takes S0, 0 keeps D, SCC is never written), `s_cmov_b32` matches under SCC=0 and SCC=1, and `s_pack_ll/lh/hh_b32_b16` is bit-exact on 500 random programs with 0 mismatches (`--oracle translator,hw`). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137, SCC kept). Also **measured on RDNA2 gfx1036** (Radeon iGPU of a Ryzen 9 9950X3D, Windows 11, driver 26.10.1, `tools/hw_oracle` HIP launcher, rocm-sdk-core clang): `tools/int_hw_probe.py --oracle both --wave both` gives the same words as the translator for all five `salu_cmov_pack` cases in wave32 and wave64, and the 14 `s_cmov_b64` cases of the `salu_cmov_b64` group (`python -I tools/int_hw_probe.py --oracle both --wave both --group salu_cmov_b64`; SCC 0 and 1; source an SGPR pair, the inline constants -1, -16 and 64, the literal 0x89abcdef, `null`, and the destination itself; SCC preset and read back after): SCC preset and read back after) match the translator in wave32 and wave64: SCC = 1 takes S0 (a literal zero-extended, an inline constant sign-extended, `null` gives 0), SCC = 0 keeps D, SCC is never written. Also on `gfx1035` via `int_hw_probe` (SHADER-137, SCC kept), and on `gfx1036` and an RTX 5080 through the fixtures `cs_w32_salu64.asm` (`s_cmov_b32`) and `cs_w32_int_ext.asm` (`s_pack_lh_b32_b16`). `tools/hw_oracle` + `tools/salu_diff.py` verify `s_cmov_b32` under SCC 0/1 and `s_pack_ll/lh/hh_b32_b16` bit-exact on 500 random programs with 0 mismatches. Reviewers ran `s_cmov*` on an RTX 5090, an RTX 4050 and a Radeon 740M (#613) and `s_pack_*` on an RTX 5090 (#449). Measured on native gfx1036 (AMD Radeon Graphics, RDNA2) through tools/hw_oracle and tools/salu_diff.py: s_cmov_b32 verified under SCC=0 and SCC=1 (preserving destination and updating respectively); s_pack_ll/lh/hh_b32_b16 verified bit-exact on 500 random programs with 0 mismatches (--oracle translator,hw). **Not measured on RDNA2.** |
500| `v_bfi_b32` | `(S0 & S1) \| (~S0 & S2)` (RDNA2 ISA, VOP3 opcode 330). A literal or known same-block SGPR mask of zero or all ones selects S2 or S1 directly. A contiguous mask uses `OpBitFieldInsert` with S1 shifted down by the field offset, since RDNA2 reads the bits in place. For sparse constant masks the translator precomputes the complement. Runtime masks use the full bitwise expression. Checked by the hand-written `bfi_known_mask.asm` and `tests/semantic/test_bfi_known_mask.py`. | 500| `v_bfi_b32` | `(S0 & S1) \| (~S0 & S2)` (RDNA2 ISA, VOP3 opcode 330). A literal or known same-block SGPR mask of zero or all ones selects S2 or S1 directly. A contiguous mask uses `OpBitFieldInsert` with S1 shifted down by the field offset, since RDNA2 reads the bits in place. For sparse constant masks the translator precomputes the complement. Runtime masks use the full bitwise expression. Checked by the hand-written `bfi_known_mask.asm` and `tests/semantic/test_bfi_known_mask.py`. |
501| `v_bfm_b32` | The low five bits of S0 give the width and those of S1 give the offset. The result is the low 32 bits of `((1 << width) - 1) << offset` (RDNA2 ISA §12.12, VOP3 opcode 867). Literal and same-block SGPR constants are folded in the translator, including zero width and shifts that discard the high bits. Runtime operands keep their low-five-bit masks. Checked by `tests/semantic/test_bfm_known_operands.py` and `test_alu_int_misc.py`. | 501| `v_bfm_b32` | The low five bits of S0 give the width and those of S1 give the offset. The result is the low 32 bits of `((1 << width) - 1) << offset` (RDNA2 ISA §12.12, VOP3 opcode 867). Literal and same-block SGPR constants are folded in the translator, including zero width and shifts that discard the high bits. Runtime operands keep their low-five-bit masks. Checked by `tests/semantic/test_bfm_known_operands.py` and `test_alu_int_misc.py`. |
502| `s_bfe_u32` / `s_bfe_i32` past bit 31 | offset = S1[4:0], width = S1[22:16] (7 bits; S1 bits 23 to 31 are ignored). When offset + width > 32 the field stops at bit 31: width = min(width, 32 - offset), and `s_bfe_i32` sign-extends from the top bit that exists. Example: `s_bfe_i32 s4, 0xd2f90159, 0x7f001c` gives `0xfffffffd` (4-bit field `0xd`), not `0xd`. SCC = D ≠ 0. Source: measured on gfx1150 (Radeon 880M) with `tools/salu_diff.py --oracle hw`, 4000 random control words, all bit-exact, on gfx1201 (Radeon RX 9070, RDNA4) with 10,000 `salu_diff --oracle hw` programs, 0 mismatches (seed 500 with `--bfe-any`), and **on RDNA2** (AMD Radeon 680M, `gfx1035`: `tools/salu_diff.py --oracle hw,translator --bfe-any --programs 500 --seed 1`, 500/500 match, plus `tools/int_hw_probe.py --oracle both` wave32 and wave64, SHADER-137; and RDNA2 `gfx1036`, Windows 11, driver 26.10.1, `tools/hw_oracle` HIP launcher: `tools/salu_diff.py --oracle translator,hw --bfe-any --ops s_bfe_u32,s_bfe_i32 --programs 2000` with seeds 1, 2 and 3, 6,000 of 6,000 programs pass on both sides, plus seed 4 over every opcode with `--bfe-any`, 2,000 of 2,000, and `int_hw_probe.py`'s `salu_bfe_past31` cases in wave32 and wave64); the translator (`bfe_width`) already did this. `tools/salu_diff.py --oracle hw,translator --bfe-any --programs 500 --seed 1`, 500/500 match, plus `tools/int_hw_probe.py --oracle both` wave32 and wave64, SHADER-137); the translator (`bfe_width`) already did this. Source: measured on gfx1150 (Radeon 880M) with `tools/salu_diff.py --oracle hw`, 4000 random control words, all bit-exact, and on gfx1201 (Radeon RX 9070, RDNA4) with 10,000 `salu_diff --oracle hw` programs, 0 mismatches (seed 500 with `--bfe-any`); the translator (`bfe_width`) already did this. LLVM's v_bfe fold (`constantFoldBFE`) is analogous but has a 5-bit width. **RDNA2 is not measured**; the ISA pseudocode does not say. | 502| `s_bfe_u32` / `s_bfe_i32` past bit 31 | offset = S1[4:0], width = S1[22:16] (7 bits; S1 bits 23 to 31 are ignored). When offset + width > 32 the field stops at bit 31: width = min(width, 32 - offset), and `s_bfe_i32` sign-extends from the top bit that exists. Example: `s_bfe_i32 s4, 0xd2f90159, 0x7f001c` gives `0xfffffffd` (4-bit field `0xd`), not `0xd`. SCC = D ≠ 0. Source: measured on gfx1150 (Radeon 880M) with `tools/salu_diff.py --oracle hw`, 4000 random control words, all bit-exact, on gfx1201 (Radeon RX 9070, RDNA4) with 10,000 `salu_diff --oracle hw` programs, 0 mismatches (seed 500 with `--bfe-any`), and **on RDNA2** (AMD Radeon 680M, `gfx1035`: `tools/salu_diff.py --oracle hw,translator --bfe-any --programs 500 --seed 1`, 500/500 match, plus `tools/int_hw_probe.py --oracle both` wave32 and wave64, SHADER-137; and RDNA2 `gfx1036`, Windows 11, driver 26.10.1, `tools/hw_oracle` HIP launcher: `tools/salu_diff.py --oracle translator,hw --bfe-any --ops s_bfe_u32,s_bfe_i32 --programs 2000` with seeds 1, 2 and 3, 6,000 of 6,000 programs pass on both sides, plus seed 4 over every opcode with `--bfe-any`, 2,000 of 2,000, and `int_hw_probe.py`'s `salu_bfe_past31` cases in wave32 and wave64); the translator (`bfe_width`) already did this. LLVM's v_bfe fold (`constantFoldBFE`) is analogous but has a 5-bit width. |
503| 64-bit scalar data ops (`s_brev_b64`, `s_bfe_u64`/`s_bfe_i64`, `s_bitset0_b64`/`s_bitset1_b64`, `s_flbit_i32_b64`/`s_flbit_i32_i64`) | The SGPR pair normally carries 64-bit data. In wave64, `s_flbit_i32_b64` can also gather both halves of a lane mask or EXEC before scanning it. The other operations require scalar data. `test_library_compute_forms.py` checks an empty mask and set bits in either half on native and emulated waves; `tests/semantic/test_lane_mask_bitreplicate_flbit.py` runs EXEC and VCC masks on every lane of a wave64 (the 1.0.2.1 pipeline library reads EXEC this way). `s_brev_b64`: D.lo = reverse(S0.hi), D.hi = reverse(S0.lo). `s_bfe_*64`: offset = S1[5:0], width = S1[22:16]; width 0 gives 0; a field past bit 63 stops there (the 64-bit form of the `s_bfe_u32` rule, LLVM `constantFoldBFE`); SCC = D ≠ 0. `s_bitset*_b64`: bit S0 & 63 of the pair cleared / set. `s_flbit_i32_b64`: zeros above the top 1 from bit 63, −1 for 0; `s_flbit_i32_i64`: the same of ~S0 when S0 < 0, −1 for 0 and −1. None but `s_bfe` writes SCC. Source: RDNA2 ISA SOP1/SOP2. CPU-checked by `tests/semantic/test_salu_brev_b64.py`, `test_salu_bfe_64.py`, `test_salu_bitset_b64.py`, `test_salu_flbit_64.py` (#723, #726, #729, #733). **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1), one raw wave32 kernel per op through `tools/hw_oracle`: `s_brev_b64` of 0x12345678_0000000F has low word 0x1E6A2C48, `s_bfe_u64(0x00000123_45678000, w16 o28)` = 0x1234, `s_bfe_i64(0x00000001_80000000, w2 o31)` has 0xFFFFFFFF in both words, `s_bitset1_b64(0, 40)` has high word 0x100, `s_flbit_i32_b64(0x00010000)` = 47 and `s_flbit_i32_i64(0xFFFFFFFF_FFFF0000)` = 48. These are the words `runtime/test/shaders/cs_w32_salu64.asm` expects. Also **hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137). | 503| 64-bit scalar data ops (`s_brev_b64`, `s_bfe_u64`/`s_bfe_i64`, `s_bitset0_b64`/`s_bitset1_b64`, `s_flbit_i32_b64`/`s_flbit_i32_i64`) | The SGPR pair normally carries 64-bit data. In wave64, `s_flbit_i32_b64` can also gather both halves of a lane mask or EXEC before scanning it. The other operations require scalar data. `test_library_compute_forms.py` checks an empty mask and set bits in either half on native and emulated waves; `tests/semantic/test_lane_mask_bitreplicate_flbit.py` runs EXEC and VCC masks on every lane of a wave64 (the 1.0.2.1 pipeline library reads EXEC this way). `s_brev_b64`: D.lo = reverse(S0.hi), D.hi = reverse(S0.lo). `s_bfe_*64`: offset = S1[5:0], width = S1[22:16]; width 0 gives 0; a field past bit 63 stops there (the 64-bit form of the `s_bfe_u32` rule, LLVM `constantFoldBFE`); SCC = D ≠ 0. `s_bitset*_b64`: bit S0 & 63 of the pair cleared / set. `s_flbit_i32_b64`: zeros above the top 1 from bit 63, −1 for 0; `s_flbit_i32_i64`: the same of ~S0 when S0 < 0, −1 for 0 and −1. None but `s_bfe` writes SCC. Source: RDNA2 ISA SOP1/SOP2. CPU-checked by `tests/semantic/test_salu_brev_b64.py`, `test_salu_bfe_64.py`, `test_salu_bitset_b64.py`, `test_salu_flbit_64.py` (#723, #726, #729, #733). **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1), one raw wave32 kernel per op through `tools/hw_oracle`: `s_brev_b64` of 0x12345678_0000000F has low word 0x1E6A2C48, `s_bfe_u64(0x00000123_45678000, w16 o28)` = 0x1234, `s_bfe_i64(0x00000001_80000000, w2 o31)` has 0xFFFFFFFF in both words, `s_bitset1_b64(0, 40)` has high word 0x100, `s_flbit_i32_b64(0x00010000)` = 47 and `s_flbit_i32_i64(0xFFFFFFFF_FFFF0000)` = 48. These are the words `runtime/test/shaders/cs_w32_salu64.asm` expects. Also **hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137). |
504| `v_bfe_u32` / `v_bfe_i32` past bit 31 | offset = S1[4:0] and width = S2[4:0]: the bits above are ignored, so an offset of 36 reads as 4 and a width of 32 as 0 (a width of 0 gives 0). When offset + width > 32 the field stops at bit 31, as for `s_bfe`: width = min(width, 32 - offset), and `v_bfe_i32` sign-extends from bit 31. Example: `v_bfe_i32` of `0xd2f90159` with offset 28 and width 16 gives `0xfffffffd` (4-bit field `0xd`), not `0xd`, and `0x80000000` with offset 31 and width 4 gives `0xffffffff`. The translator (`bfe_width` for VGPR or SGPR offset and width, the same cut folded at translation time for constants) already did this. Source: **measured on RDNA2**, AMD Radeon 610M (`gfx1036`, Windows 11, AMD driver 32.0.11016.14003), wave32 and wave64 identical, 16 words over VGPR, inline-constant and literal operands: `tools/int_hw_probe.py --oracle both --group valu_bfe_past31`, 4/4 cases match the translator. The words are pinned on the CPU by `tests/test_int_hw_probe.py` (`ValuBfeMeasuredOnRdna2`). | 504| `v_bfe_u32` / `v_bfe_i32` past bit 31 | offset = S1[4:0] and width = S2[4:0]: the bits above are ignored, so an offset of 36 reads as 4 and a width of 32 as 0 (a width of 0 gives 0). When offset + width > 32 the field stops at bit 31, as for `s_bfe`: width = min(width, 32 - offset), and `v_bfe_i32` sign-extends from bit 31. Example: `v_bfe_i32` of `0xd2f90159` with offset 28 and width 16 gives `0xfffffffd` (4-bit field `0xd`), not `0xd`, and `0x80000000` with offset 31 and width 4 gives `0xffffffff`. The translator (`bfe_width` for VGPR or SGPR offset and width, the same cut folded at translation time for constants) already did this. Source: **measured on RDNA2**, AMD Radeon 610M (`gfx1036`, Windows 11, AMD driver 32.0.11016.14003), wave32 and wave64 identical, 16 words over VGPR, inline-constant and literal operands: `tools/int_hw_probe.py --oracle both --group valu_bfe_past31`, 4/4 cases match the translator. The words are pinned on the CPU by `tests/test_int_hw_probe.py` (`ValuBfeMeasuredOnRdna2`). |
505| `s_quadmask_b32`/`_b64`, `s_bitreplicate_b64_b32` | On scalar data (RDNA2 ISA SOP1): `s_quadmask_b32` sets D[i] to the OR of S0[4i+3:4i] for the 8 quads, `s_quadmask_b64` does the same for the 16 quads of the 64-bit S0 (D[63:16] = 0), and both set SCC = D != 0. `s_bitreplicate_b64_b32` copies each bit S0[i] to D[2i] and D[2i+1] and leaves SCC. Built from fixed shift/mask steps, with no loop. Bit replication can also write EXEC, or VCC in wave64 (in wave32 VCC's high word is data, so it stays `Unsupported`). Each lane takes source bit `lane // 2`. `test_library_compute_forms.py` checks both halves of VCC and SCC on native and emulated waves; `tests/semantic/test_lane_mask_bitreplicate_flbit.py` checks VCC, which the 1.0.2.1 pipeline library writes from a constant, on every lane of a wave64. A 32-bit lane-mask source (`exec_lo`/`exec_hi`, `vcc_lo`/`vcc_hi`) of `s_bitreplicate_b64_b32` into a scalar (non-EXEC/VCC) destination reads that half of the wave's mask as data (`Gen.wave_mask`, as `s_ff1_i32_b64` reads one) and replicates it as any scalar (#998, for 6 pipeline-library programs of 1.0.2.1). Confirmed only by the CPU interpreter on every lane of a wave64 (`test_lane_mask_bitreplicate_flbit.py`: EXEC halves and a compare's VCC halves, synthetic lines) and by the ISA pseudocode above; not measured on hardware. Any other lane-mask source (EXEC, VCC or an SGPR that `holds_lane_mask`), and a lane-mask source with an EXEC/VCC destination, raises `Unsupported`: each invocation holds only its own lane's bit, and these ops read the other lanes of a quad or move bits between lanes. Until 2026-11-22 all three were rejected. CPU-checked by `tests/semantic/test_salu_quadmask_bitreplicate.py` (fixed and seeded values, SCC written or kept, immediates, aliasing, lane masks rejected). **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1) through `tools/hw_oracle`, one raw wave32 kernel per op: `s_quadmask_b32(0xF)` = 1 with SCC 1, `(0xF0000000)` = 0x80, `(0x0F0F0F0F)` = 0x55 (the set quads are 0, 2, 4 and 6), `(0)` = 0 with SCC 0; `s_quadmask_b64` of 0xF = 1 and of 0xF0000000_00000000 (quad 15, bits 60..63) = 0x8000 in the low word with D[63:16] = 0; `s_bitreplicate_b64_b32` of 5 = 0x33 and of 0x80000000 = 0xC0000000_00000000, with SCC left as it was. **GPU-checked** by `runtime/test/shaders/cs_w32_new_ops.asm` (`s_quadmask_b32(0x01020408)` = 0x55, `s_quadmask_b64(0x80000000_00000001)` low word 0x8001, `s_bitreplicate_b64_b32(0x80000001)` high word 0xC0000000, with the expected words from the ISA pseudocode), exact on the Radeon iGPU of a Ryzen 9 9950X3D (RDNA2, `gfx1036`, driver 26.10.1) and an RTX 5080 (driver 616.92). **Not GPU-verified.** | 505| `s_quadmask_b32`/`_b64`, `s_bitreplicate_b64_b32` | On scalar data (RDNA2 ISA SOP1): `s_quadmask_b32` sets D[i] to the OR of S0[4i+3:4i] for the 8 quads, `s_quadmask_b64` does the same for the 16 quads of the 64-bit S0 (D[63:16] = 0), and both set SCC = D != 0. `s_bitreplicate_b64_b32` copies each bit S0[i] to D[2i] and D[2i+1] and leaves SCC. Built from fixed shift/mask steps, with no loop. Bit replication can also write EXEC, or VCC in wave64 (in wave32 VCC's high word is data, so it stays `Unsupported`). Each lane takes source bit `lane // 2`. `test_library_compute_forms.py` checks both halves of VCC and SCC on native and emulated waves; `tests/semantic/test_lane_mask_bitreplicate_flbit.py` checks VCC, which the 1.0.2.1 pipeline library writes from a constant, on every lane of a wave64. A 32-bit lane-mask source (`exec_lo`/`exec_hi`, `vcc_lo`/`vcc_hi`) of `s_bitreplicate_b64_b32` into a scalar (non-EXEC/VCC) destination reads that half of the wave's mask as data (`Gen.wave_mask`, as `s_ff1_i32_b64` reads one) and replicates it as any scalar (#998, for 6 pipeline-library programs of 1.0.2.1). Confirmed only by the CPU interpreter on every lane of a wave64 (`test_lane_mask_bitreplicate_flbit.py`: EXEC halves and a compare's VCC halves, synthetic lines) and by the ISA pseudocode above; not measured on hardware. Any other lane-mask source (EXEC, VCC or an SGPR that `holds_lane_mask`), and a lane-mask source with an EXEC/VCC destination, raises `Unsupported`: each invocation holds only its own lane's bit, and these ops read the other lanes of a quad or move bits between lanes. Until 2026-11-22 all three were rejected. CPU-checked by `tests/semantic/test_salu_quadmask_bitreplicate.py` (fixed and seeded values, SCC written or kept, immediates, aliasing, lane masks rejected). **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1) through `tools/hw_oracle`, one raw wave32 kernel per op: `s_quadmask_b32(0xF)` = 1 with SCC 1, `(0xF0000000)` = 0x80, `(0x0F0F0F0F)` = 0x55 (the set quads are 0, 2, 4 and 6), `(0)` = 0 with SCC 0; `s_quadmask_b64` of 0xF = 1 and of 0xF0000000_00000000 (quad 15, bits 60..63) = 0x8000 in the low word with D[63:16] = 0; `s_bitreplicate_b64_b32` of 5 = 0x33 and of 0x80000000 = 0xC0000000_00000000, with SCC left as it was. **GPU-checked** by `runtime/test/shaders/cs_w32_new_ops.asm` (`s_quadmask_b32(0x01020408)` = 0x55, `s_quadmask_b64(0x80000000_00000001)` low word 0x8001, `s_bitreplicate_b64_b32(0x80000001)` high word 0xC0000000, with the expected words from the ISA pseudocode), exact on the Radeon iGPU of a Ryzen 9 9950X3D (RDNA2, `gfx1036`, driver 26.10.1) and an RTX 5080 (driver 616.92). **Not GPU-verified.** |
diff --git a/docs/directstorage.md b/docs/directstorage.md
index d6272e588..10b9390cb 100644
--- a/docs/directstorage.md
+++ b/docs/directstorage.md
@@ -273,16 +273,18 @@ shim beyond the size check it already does. The last one is behaviour the first
273 256 blocks of a stream. It combines adjacent mips from the same layer with full-stream index anchor 273 256 blocks of a stream. It combines adjacent mips from the same layer with full-stream index anchor
274 and shared-p-bit constraints. A shared p-bit can relate low red endpoint bits even when its sibling 274 and shared-p-bit constraints. A shared p-bit can relate low red endpoint bits even when its sibling
275 mip supplies only the leading bits. These local fits preserve the recorded precision and exact reference 275 mip supplies only the leading bits. These local fits preserve the recorded precision and exact reference
276 bits. A packed tail whose larger mips are BCPack-coded too has no raw or zlib sibling, so a history field that 276 bits. A packed tail whose larger mips are BCPack-coded too has no adjacent raw or zlib sibling, so a history
277 only such tails use stayed unknown: in the game runs of 2026-11-25 two BC7 tail streams of one pool failed 277 field that only such tails use stayed unknown: in the game runs of 2026-11-25 two BC7 tail streams of one pool
278 with `missing-endpoint` (alpha fields of two history entries). For the streams that still start a chain at a 278 failed with `missing-endpoint` (alpha fields of two history entries). For streams that still start a chain at a
279 missing field, the fitter now decodes the nearest BCPack sibling with the profile so far and fits against it, 279 missing field after adjacent-mip fitting, the fitter first pairs their mips with the closest raw or zlib mip on
280 repeating while a round adds fields. The sibling may sit in the same refused BC7 stream: every block whose 280 the same layer across multi-level mip distances, then decodes the nearest BCPack sibling with the profile so far
281 chains start elsewhere is still determined, and the undetermined ones are left out of the reference. Those 281 and fits against it, repeating while a round adds fields. The sibling may sit in the same refused BC7 stream:
282 fields are fitted, never confirmed, and fill only what the other fits left empty. On the 1.0.2.1 package this 282 every block whose chains start elsewhere is still determined, and the undetermined ones are left out of the
283 raised the BC7 endpoint fields from 4,228 to 4,406 of 6,144; the runtime decoder then refuses 8 of 5,167 BC7 283 reference. Those fields are fitted, never confirmed, and fill only what the earlier fits left empty. On the
284 streams instead of 60 (both failing requests decode), and the 268 BC6H streams are unchanged (10 refused; a 284 1.0.2.1 package this raised BC6H coverage from 210 to 226 of 256 endpoint rows and 249 to 251 of 256 index rows
285 refused BC6H sibling is not used as a reference yet). A profile can still lack endpoint values or exceed the reference consistency tolerance. Such a request reports a decompression error before publication. 285 (0 of 268 BC6H streams refused instead of 10) and raised BC7 endpoint fields from 4,228 to 4,406 of 6,144 (8 of
286 5,167 BC7 streams refused instead of 60; both failing requests decode). A profile can still lack endpoint values
287 or exceed the reference consistency tolerance. Such a request reports a decompression error before publication.
286- The four swizzle modes interleave stripes from request-wide component planes into 16 KiB (mode 1) or 288- The four swizzle modes interleave stripes from request-wide component planes into 16 KiB (mode 1) or
287 32 KiB (modes 2–4) groups. The enum names give the successive stripe widths. The shipped BC4 sample 289 32 KiB (modes 2–4) groups. The enum names give the successive stripe widths. The shipped BC4 sample
288 separates its endpoint planes from indices across the inflated source. The title's compute shader does 290 separates its endpoint planes from indices across the inflated source. The title's compute shader does
diff --git a/docs/gdk_public_reference.md b/docs/gdk_public_reference.md
new file mode 100644
index 000000000..08efd95cd
--- /dev/null
+++ b/docs/gdk_public_reference.md
@@ -0,0 +1,56 @@
1# Using the public GDK to write shims
2
3How to use Microsoft's **public** GDK documentation and headers to implement the console APIs the game imports,
4without copying Microsoft's files and without touching anything under NDA. A convention for contributors, not a
5measurement.
6
7## The rule in one line
8
9Read the public PC GDK reference and headers, then write in your own words only what a shim needs: names, values,
10signatures and struct layouts. Never commit GDK files, and never use the console GDK, which is under NDA.
11
12## What the public GDK gives the project
13
14- Signatures, enums and structs of the system APIs the game imports: XGameRuntime, XTaskQueue, XUser, XStore,
15 XGameSave and GameInput.
16- That is what these already implement, and they are the models to follow:
17 - `runtime/shims/xgameruntime.cpp`, `xgameruntime_user.cpp`, `xgameruntime_store.cpp`,
18 `xgameruntime_gamesave.cpp`, `xgameruntime_offline.cpp`
19 - `d3d12/crates/leonida-hle/src/modules/xgameruntime.rs`
20 - `runtime/shims/gameinput*` (see [gameinput.md](gameinput.md))
21
22## What it does not give
23
24- The console-only graphics surface: `D3D12XboxCreateDevice`, `PresentX`, XDXR and the rest of `d3d12_xs` beyond
25 what the public pages list. [d3d12_xs_surface.md](d3d12_xs_surface.md) and [xbox_d3d12_xs.md](xbox_d3d12_xs.md)
26 say which pages exist and which are missing or NDA-gated.
27- Those layouts are recovered from the game's own call sites and from public code compiled against the headers
28 (Mesa, ebiten, the Microsoft samples), as [d3d12_vulkan.md](d3d12_vulkan.md) does. They are not guessed, and
29 they are not taken from leaked or NDA material.
30
31## The method, in 4 steps
32
331. **Get the public references.** The system API reference at
34 [docs.xbox.com](https://docs.xbox.com/reference/system/xgamestreaming/functions/xgamestreamingsetresolution)
35 (pages under `reference/system/<family>/functions/<name>`), the graphics reference at
36 [devdocs.xbox.com](https://devdocs.xbox.com/reference/graphics/d3d12), and the public PC GDK headers from
37 Microsoft's own download. GameInput is also published as the `Microsoft.GameInput` NuGet package.
382. **List what the game imports**, locally, on your own copy (`dumpbin /imports`). The measured tables are already
39 in [runtime_imports.md](runtime_imports.md), and `tests/test_gdk_runtime_calls.py` checks them. Nothing from the
40 game goes into the repository.
413. **For each missing function**, read its public page and header, then write the declaration and the shim yourself,
42 with a test: `runtime/test/xgameruntime_*_test.cpp` for the C++ runtime, with
43 `runtime/test/fixtures/tiny_gdk_load.cpp` as the model for loading a GDK-style module.
444. **Document it** in [runtime_imports.md](runtime_imports.md), linking the public page you used. Then the usual
45 path: claim it in the coordination issue, open a pull request with a test that fails on `main` and passes with
46 it ([CONTRIBUTING.md](../CONTRIBUTING.md)).
47
48## Lines not to cross
49
50- **Do not copy GDK headers, samples or documentation text into the repository.** They are under Microsoft's
51 licence. Take the facts (names, values, layouts), not the text.
52- **Nothing from the console GDK or from a leak**, not even to check a value. If a layout is only in NDA material,
53 write down that it is open and recover it from call sites instead.
54- **The repository's hard rules still apply** ([AGENTS.md](../AGENTS.md)): no keys, no decryption, no protection
55 workarounds, and nothing online. The shims answer offline (`runtime/shims/xgameruntime_offline.cpp`); no Xbox Live
56 or Rockstar services.
diff --git a/docs/linux.md b/docs/linux.md
index 3bc8c1550..b6be52568 100644
--- a/docs/linux.md
+++ b/docs/linux.md
@@ -11,8 +11,8 @@ names; the build lists anything it can't find before it starts.
11 11
12| Piece | On Linux | How it is checked | 12| Piece | On Linux | How it is checked |
13|---|---|---| 13|---|---|---|
14| `make_game.py`: check, shaders, assets, pipelines | Native | CI (`stdlib-tests-linux`, `translator-tests`, `semantic-tests`) | 14| `make_game.py`: check, shaders, assets, pipelines | Native | CI (`linux-python-and-viewer`, `semantic-tests`) |
15| `Build.sh`, `Mods.sh` | Native (`/bin/sh`) | `tests/test_shell_launchers.py`, in the standard-library loop of `stdlib-tests-linux` | 15| `Build.sh`, `Mods.sh` | Native (`/bin/sh`) | `tests/test_shell_launchers.py`, in the standard-library loop of `linux-python-and-viewer` |
16| Shader translator, its tests and the GPU test tools (`vk_harness`, `vk_pipeline_check`, ...) | Native, GCC or Clang | CI (`linux-gpu-tools`: GCC, tests on llvmpipe); Clang builds them too, but no CI job uses it yet | 16| Shader translator, its tests and the GPU test tools (`vk_harness`, `vk_pipeline_check`, ...) | Native, GCC or Clang | CI (`linux-gpu-tools`: GCC, tests on llvmpipe); Clang builds them too, but no CI job uses it yet |
17| `rpf9dump` (asset export) | Native, .NET 8 or newer | CI builds it on Windows only (the `check` job) | 17| `rpf9dump` (asset export) | Native, .NET 8 or newer | CI builds it on Windows only (the `check` job) |
18| `gta6rt`, its shims and their tests | Windows program, under Wine or Proton | Cross-built with clang-cl and xwin; CI runs the Windows build under Wine on pushes to `main` | 18| `gta6rt`, its shims and their tests | Windows program, under Wine or Proton | Cross-built with clang-cl and xwin; CI runs the Windows build under Wine on pushes to `main` |
diff --git a/docs/mobile.md b/docs/mobile.md
index 583f5cacd..93ddb9a34 100644
--- a/docs/mobile.md
+++ b/docs/mobile.md
@@ -32,7 +32,7 @@ of the x86-64 → arm64 groundwork.
32| Dispatch runtime | `tools/x64_recomp.py` `emit_rt` | `rt_dispatch` (guest pc → host pc through a generated table), `rt_mkflags` (NZCV+operands → canonical x86 EFLAGS; preserves NZCV), `rt_print` (semihosting result output) | 32| Dispatch runtime | `tools/x64_recomp.py` `emit_rt` | `rt_dispatch` (guest pc → host pc through a generated table), `rt_mkflags` (NZCV+operands → canonical x86 EFLAGS; preserves NZCV), `rt_print` (semihosting result output) |
33| Verification | `tools/x64_recomp.py` `build_test_kernel`/`run_kernel` | flat kernel image → `qemu-system-aarch64 -M virt -cpu cortex-a53 -kernel -semihosting`; guest `ret` off the sentinel stack exits and prints `R=xxxxxxxx` (guest edi) | 33| Verification | `tools/x64_recomp.py` `build_test_kernel`/`run_kernel` | flat kernel image → `qemu-system-aarch64 -M virt -cpu cortex-a53 -kernel -semihosting`; guest `ret` off the sentinel stack exits and prints `R=xxxxxxxx` (guest edi) |
34| PE census | `tools/recomp_census.py` | walks every `.pdata` function, decodes + translates it, reports coverage %, hazard mnemonics, indirect control flow, unwind-info flags | 34| PE census | `tools/recomp_census.py` | walks every `.pdata` function, decodes + translates it, reports coverage %, hazard mnemonics, indirect control flow, unwind-info flags |
35| Tests | `tests/test_x64_recomp.py`, `tests/test_recomp_census.py` | hand-built byte fixtures only; exec tests skip when qemu is absent | 35| Tests | `tests/test_x64_recomp.py`, `tests/test_recomp_census.py` | hand-built byte fixtures only; exec tests skip when qemu is absent (`QEMU_AARCH64` names the binary, else `qemu-system-aarch64` on `PATH`) |
36 36
37### Translator contract (as implemented) 37### Translator contract (as implemented)
38 38
diff --git a/docs/mod-menu.md b/docs/mod-menu.md
index 18023dd0f..9ac70e56f 100644
--- a/docs/mod-menu.md
+++ b/docs/mod-menu.md
@@ -216,16 +216,59 @@ the title's. A panic in our own work stops the work and not the title.
216(what the runtime sees: threads, whether the work ran at once or at the queue's point of rest, the ped, its 216(what the runtime sees: threads, whether the work ran at once or at the queue's point of rest, the ped, its
217position and forward vector, wanted level, clock, the weather types, the cheat table), `cheat <n>`, `wanted <n>`, 217position and forward vector, wanted level, clock, the weather types, the cheat table), `cheat <n>`, `wanted <n>`,
218`time <h> [m [s]]`, `hours <n>`, `pause <0|1>`, `weather <index|NAME|freeze|free>`, `nudge <dx> <dy> <dz> 218`time <h> [m [s]]`, `hours <n>`, `pause <0|1>`, `weather <index|NAME|freeze|free>`, `nudge <dx> <dy> <dz>
219[frames]`. Everything asked and done is written to `%TEMP%\leonida-actions\log.txt` (addresses of the run: not 219[frames]`, `spawn <model name|0x key>` (a vehicle of any model, by the spawn the vehicle cheats call), `god <0|1>`
220for the repository). 220and `native <0x hash> [slots]` (below). Everything asked and done is written to `%TEMP%\leonida-actions\log.txt`
221(addresses of the run: not for the repository).
222
223### Any vehicle, and the natives by their handlers (2026-11-30)
224
225The nine vehicle cheats are each `mov rcx, <model key>` and a call of one function: `spawn` calls that function
226(taken from the cheats' own code through the table) with another model's key, the low 64 bits of
227MurmurHash3_x64_128 (seed 0) of the lower-cased model name (one cheat's key is that hash of its model's name).
228
229The script natives turned out to be findable after all, by their handlers' shape rather than any table: each
230handler checks its argument count first and, on a negative one, stores its native's own 64-bit hash where the
231result goes. `leonida_loader::natives` reads that hash from every handler (6,000 and more in 1.0.2.1, the start of
232each from the unwind table), so a native is called by its hash: `god` is SET_ENTITY_INVINCIBLE on PLAYER_PED_ID's
233reference, both by the hashes of modpapi/scripthook-vi's native database (CC BY 4.0). The shape, the call context
234and the model key's form are kylepelham/El1xr's findings (GPL-3.0). Unit-tested and checked against the executable;
235god mode not yet seen in the running title.
236
237Seen in the running title (2026-11-30, run d179, the game actions' first run in the world, a script of commands):
238every place found; the weather forced to RAIN (previous, next and forced all its type) and let go; the time set to
23922:00 and back to 12:00; the wanted level raised to 2 and cleared (the title's state read 2, then 0); the health
240cheat run; `spawn sanchez` and `spawn airbus` asked of the spawn the cheats call (taken from their code, the same
241function El1xr's trainer calls): a motorbike on the minimap beside the player, and the airport bus (a model none of
242the nine cheats holds) in the air just ahead of the player on the deck, falling. All of it ran on the title's thread
243at the queue's point of rest, not in the hook's own call. The HUD kept two red stars after the wanted level was
244cleared by the title's function (its state read 0): a clear now also calls CLEAR_PLAYER_WANTED_LEVEL on the
245player's reference.
246
247Teleports go through the title's own teleport now when its natives are found: `teleport <x> <y> <z>`, and the
248menu's Teleport page, call SET_ENTITY_COORDS on PLAYER_PED_ID's reference (the place as four packed floats, the
249axis flags off and the area cleared), in place of the write of the ped's position below.
250
251Seen in the running title (run d195): 6,805 natives found by their handlers; PLAYER_PED_ID gave a reference of
252two slots; god mode on and off with it; and the teleport moved the player at once, but into the bay far from the
253deck: the place the actions had read (the ped's +0x70) is not in the world's coordinates. The title keeps an
254entity's place relative to an origin of its own, and GET_ENTITY_COORDS turns it into the world's (the native
255database says the command decodes +0x70). So the place the actions give (`game_actions::position`, the info line,
256the Teleport page's own place and its saved spots) is now GET_ENTITY_COORDS on the player, read on the title's
257thread a few times a second, and `lift <metres>` sets the player that far above it.
258
259The time of day set while the title still loads can end it: run d197 set 23:00 sixty seconds after the start and the
260title stopped within two seconds (an access violation, a write of title memory in KERNELBASE on another thread).
261Set in the world (run d199, at 120 s) it did not, and the night it gave looked as it should (the moon, the stars,
262the bridge's lights, a lit porch; no one-frame dips or spikes in 545 frames). Scripts set the time once the world is
263there.
221 264
222## What is not there yet, and why 265## What is not there yet, and why
223 266
224God mode, stamina, fast run and swim, super jump, invisibility, ragdoll, the vehicle items other than the nine 267Stamina, fast run and swim, super jump, invisibility, ragdoll, every weapon item, moon gravity, traffic,
225spawns, every weapon item, moon gravity, traffic, pedestrians, police, blackout, strong wind, moving the player 268pedestrians, police, blackout, strong wind, HUD and radio, and the menu's own item for any vehicle (the run script
226(teleports), HUD and radio. These items go through `GameActions` (`actions.rs`); for them the backend answers 269has it). These items go through `GameActions` (`actions.rs`); for
227with the reason, and the menu shows them dimmed with that reason in the help box. The title's functions for them 270them the backend answers with the reason, and the menu shows them dimmed with that reason in the help box. Most of
228were not looked for one by one: the cheat table has none of them, and the script commands (below) have no names. 271them are natives now within reach (above); each needs its hash and its arguments checked.
229 272
230Moving the player: the ped and its position are known now (above), but the title's function that moves a ped was 273Moving the player: the ped and its position are known now (above), but the title's function that moves a ped was
231not found. Looked for among the script commands (below) by their arguments: 46 commands take a 16-byte handle, 274not found. Looked for among the script commands (below) by their arguments: 46 commands take a 16-byte handle,
diff --git a/docs/port_status.md b/docs/port_status.md
index 6b9a7314a..889f369ca 100644
--- a/docs/port_status.md
+++ b/docs/port_status.md
@@ -20,11 +20,9 @@ work folders outside the repository (`G:\gta6port` on the test machine).
20| Path | What | 20| Path | What |
21|---|---| 21|---|---|
22| `runtime/`, `tools/`, `make_game.py`, `Build.bat` | Leonida: the product | 22| `runtime/`, `tools/`, `make_game.py`, `Build.bat` | Leonida: the product |
23| `victory/` | DexNom/VIctory subtree with full history, the patch source. A background poller fetches `victory/main` every 15 minutes and speaks up only when new commits exist; they are then merged with `python -I scripts/sync_victory.py --merge` and reviewed for fixes to port | 23| `victory/` | DexNom/VIctory subtree with full history (historical patch source; superseded by `d3d12/`) |
24| `scripts/sync_victory.py` | Fetches `victory/main`, lists new commits, merges them with `git subtree pull` | 24| remote `victory7900` | avatarmanz/VIctory-7900XTX, a second patch source (fetch only, not merged: it diverges from DexNom's line, 408 commits ahead and 334 behind at the time of adding; much of its recent work is frame time). Polled every 15 minutes in the background. Port from it commit by commit (`git show victory7900/main:<path>`) |
25| remote `victory7900` | avatarmanz/VIctory-7900XTX, a second patch source (fetch only, not merged: it diverges from DexNom's line, 408 commits ahead and 334 behind at the time of adding; much of its recent work is frame time). Also polled every 15 minutes in the background. Port from it commit by commit (`git show victory7900/main:<path>`) |
26| `tools/victory_saves.py` | Converts a VIctory data folder's saves and local storage into gta6rt's layout, so a save made under VIctory skips the first-boot screens | 25| `tools/victory_saves.py` | Converts a VIctory data folder's saves and local storage into gta6rt's layout, so a save made under VIctory skips the first-boot screens |
27| `scripts/port_ctl.py` | Drives a reference run of VIctory's runtime (start, pad presses from a file, frame captures, fps lines, stop) |
28 26
29## Test machine 27## Test machine
30 28
diff --git a/docs/prompt_glyphs.md b/docs/prompt_glyphs.md
index 7fadaa197..c8a0c0164 100644
--- a/docs/prompt_glyphs.md
+++ b/docs/prompt_glyphs.md
@@ -3,8 +3,9 @@
3The title draws its button prompts from one Scaleform movie, and it has only the Xbox set: the dump holds no 3The title draws its button prompts from one Scaleform movie, and it has only the Xbox set: the dump holds no
4PlayStation or keyboard glyphs. This note records the movie's format, which export is which button and who asks for 4PlayStation or keyboard glyphs. This note records the movie's format, which export is which button and who asks for
5them, measured on the user's own `data.rpf`. It holds no shapes. `tools/ps_prompt_glyphs.py` builds an original 5them, measured on the user's own `data.rpf`. It holds no shapes. `tools/ps_prompt_glyphs.py` builds an original
6PlayStation set, `tools/pc_prompt_glyphs.py` a keyboard-and-mouse set from pictures the player supplies, and the runtime 6PlayStation set, `tools/pc_prompt_glyphs.py` a keyboard-and-mouse set from its own built-in key caps or from pictures
7serves the one for the device in use. 7the player supplies, `tools/prompt_glyph_movies.py` builds both where the runtime looks (from the D3D12 launcher and
8make_game.py's runtime stage), and the runtime serves the one for the device in use.
8 9
9## The movie 10## The movie
10 11
@@ -118,11 +119,56 @@ subclasses, no `Main` behaviour, no sound hook); whether the title's loader need
118 119
119## The keyboard and mouse replacement 120## The keyboard and mouse replacement
120 121
121`tools/pc_prompt_glyphs.py` (standard library only) turns a folder of pictures, one `*Main_Button_<N>.png` per N, into 122`tools/pc_prompt_glyphs.py` (standard library only) turns pictures, one per N, into the shapes of the same 38 sprites:
122the shapes of the same 38 sprites. The pictures are the player's: the set this was written for was drawn by a friend 123its own built-in set unless a folder of the player's pictures (`*Main_Button_<N>.png`) is named with `--glyphs`. The
123of the user from scratch (W/A/S/D and arrow keys with one or more keys lit, a mouse in a circle for the right stick, 124first set it was written for was drawn by a friend of the user from scratch (W/A/S/D and arrow keys with one or more
124key caps for the face buttons and shoulders), its licence is not stated, and neither the pictures nor a movie built 125keys lit, a mouse in a circle for the right stick, key caps for the face buttons and shoulders); its licence is not
125from them is in the repository. 126stated, and neither those pictures nor a movie built from them is in the repository.
127
128### The built-in set
129
130Key caps, arrow keys and a mouse drawn by the tool itself (`builtin`, `BUILTIN`): rounded rectangles, quadratic
131curves, polygons and a stroke font of its own (16 capitals), painted with exact-area anti-aliasing into the same
132in-memory 4x pictures (264 x 264) that the tracer reads from a player's folder, so the two take one path. No picture,
133font, Pillow or game file is needed. Black rim (heavier at the bottom, the cap's edge), white face, black label; the
134lit mouse button is the grey (103, 103, 103); the movement arrows around the mouse are white with a black edge, so
135they show on a dark scene and a light one.
136
137| N | shows | N | shows |
138|---|---|---|---|
139| 4, 5, 6, 7 | the up, down, left, right arrow key | 25 | C |
140| 8, 9 | the four arrow keys (inverted T) | 21-24, 26, 29, 59 | the mouse, arrows four ways |
141| 10 / 11 | up over down / left beside right | 27 / 28 | the mouse, arrows up and down / left and right |
142| 12, 13, 14, 15 | W, S, A, D | 30, 31 | SPACE, CTRL (wide caps) |
143| 16 | SHIFT (a wide cap) | 32, 33 | R, F |
144| 17, 20, 58 | W over A S D (inverted T) | 34 / 36 | TAB (a wide cap) / Q |
145| 18 / 19 | W over S / A beside D | 35 / 37 | the mouse, right / left button lit |
146| | | 38, 39 | ESC, M |
147
148The keys are those of the runtime's on-foot keyboard table (`gameinput/kbm.rs`, `SHARED` and `FOOT_ONLY`) for the pad
149input of each Xbox glyph; `tests/test_pc_prompt_glyphs.py` reads that table and fails when a label no longer matches.
150Checked on 2026-11-29: every slot matched (Y is both F and E on foot; the cap shows F, the key that enters and
151leaves vehicles in both tables).
152
153**Size.** Players found an earlier set "covered other UI". Measured on the user's movie (each Xbox sprite drawn at 4x
154with `tools/xbox_prompt_glyphs.py`, opaque bounds and covered area counted; only the numbers are kept, as
155`XBOX_AREA` in the tool): the Xbox glyphs are not drawn small inside the canvas. The face buttons, sticks, Menu and
156View are discs of diameter 64 that touch all four edges (3,216 canvas pixels, a 3-pixel black ring around a white
157disc of diameter 58); the D-pad is a cross that reaches the same edges (2,339-2,345); the bumpers are 64 x 39 at
158y 12.5..51.5 (2,161), the triggers 61 x 64 (3,496-3,534), the stick presses 64 x 62 (2,534). A square cap of 64 fills
159the corners the disc leaves empty, and so it reads larger than the glyph it replaces. Every built-in picture
160therefore stays inside the outline of its slot's Xbox glyph (the circle of radius 32, or the slot's bounds for 16, 25
161and 34-37) and covers no more of the canvas than that glyph: a single cap is 48 x 48 (2,235 pixels, against 2,341 for
162the D-pad and 3,216 for a disc), clusters and pairs 1,120-1,212, the wide caps 56-60 wide and 30-34 tall (never taller
163than a single cap) with a smaller font for the long names (SHIFT, SPACE, CTRL, TAB; ESC keeps a square cap), TAB and Q
164inside the bumpers' band, the mice 648 and 1,543. `footprint()` measures it and the test asserts it for every slot.
165The sprites keep the Xbox glyphs' bounds (the invisible rectangle), so where a prompt's text is laid out does not move.
166
167**Built, over the user's movie (2026-11-29):** 7,456 bytes of shapes and sprites of the 15,226 (7,770 to spare);
168drawn back, 0.12 % to 0.61 % of a glyph's opaque area differs from its picture, one pixel in all more than half wrong
169(N 16). The tool takes a few seconds for the whole set.
170
171### From pictures to shapes (either set)
126 172
127- **Pictures.** 8-bit PNG, the 64 x 64 canvas with one more canvas pixel on every side, at a whole multiple (264 x 264 173- **Pictures.** 8-bit PNG, the 64 x 64 canvas with one more canvas pixel on every side, at a whole multiple (264 x 264
128 is 4x), three flat colours with anti-aliased edges: black, white and the grey (103, 103, 103). 174 is 4x), three flat colours with anti-aliased edges: black, white and the grey (103, 103, 103).
@@ -149,10 +195,15 @@ from them is in the repository.
149 of them). 195 of them).
150 196
151``` 197```
198python -I tools/pc_prompt_glyphs.py --from-archive "<package>/data.rpf" --out pc_prompt_glyphs.gfx # built-in set
152python -I tools/pc_prompt_glyphs.py --glyphs <folder> --from-archive "<package>/data.rpf" --out pc_prompt_glyphs.gfx 199python -I tools/pc_prompt_glyphs.py --glyphs <folder> --from-archive "<package>/data.rpf" --out pc_prompt_glyphs.gfx
200python -I tools/pc_prompt_glyphs.py --sheet sheet.png --pictures <folder> # the built-in set drawn back, and as PNGs
153python -I tools/pc_prompt_glyphs.py --selftest # pictures made by the tool itself, no game file 201python -I tools/pc_prompt_glyphs.py --selftest # pictures made by the tool itself, no game file
154``` 202```
155 203
204The numbers under "Size" and "Check" in this list are for the friend's set; the built-in set's are in the section
205above.
206
156## How the runtime swaps the movie 207## How the runtime swaps the movie
157 208
158The D3D12 runtime (`leonida-hle`, `modules/glyphs.rs`, hooked in `modules/dstorage.rs` `execute`) answers the title's 209The D3D12 runtime (`leonida-hle`, `modules/glyphs.rs`, hooked in `modules/dstorage.rs` `execute`) answers the title's
@@ -178,11 +229,28 @@ contents is not touched or needed.
178 movie once, about 3 s after it starts: one `the title reads its glyph movie` line in the log of a 15 minute session 229 movie once, about 3 s after it starts: one `the title reads its glyph movie` line in the log of a 15 minute session
179 with the menus opened (2026-11-27). Picking up another device later does not show until the next start; see the 230 with the menus opened (2026-11-27). Picking up another device later does not show until the next start; see the
180 last section. 231 last section.
181- **Builds.** `python -I tools/ps_prompt_glyphs.py --from-archive "<package>/data.rpf" --out ps_prompt_glyphs.gfx` builds 232- **Built for every player.** `tools/prompt_glyph_movies.py --game <package>` writes both movies into `d3d12/target`
233 (above `target/diag` and `target/release`, so either build finds them; ignored by git): the keyboard one from the
234 built-in set (or `--pc-glyphs <folder>`), the PlayStation one, each over the title's movie in `<package>/data.rpf`
235 and, if that cannot be read, the standalone movie padded to 28,148 bytes. `d3d12\scripts\play-nvidia.ps1` (and so
236 `scripts\play-d3d12.ps1` and the `play-*` scripts, which go through it; `-PcGlyphs <folder>` for your pictures) runs
237 it before each start when Python is there, and make_game.py runs it in its runtime stage (`--pc-glyphs DIR`). It
238 prints nothing when there is nothing to do and never stops the start or the build: a set it cannot build keeps the
239 Xbox glyphs. A movie of the player's is never touched: a set is skipped while its variable is set (in the launcher,
240 `-More @{LEONIDA_PC_GLYPHS=...}`, since it clears the window's other `LEONIDA_*` variables), and when a movie file
241 this step did not write is in any folder the runtime searches, where this step's own copy is removed so it cannot
242 come first. What it wrote is told by `<movie>.stamp` beside it (the movie's SHA-256 and a digest of the tools, the
243 archive's size and time and the pictures); its own movie is rebuilt only when that digest changes. A cargo clean
244 removes them with `target\`; the next start builds them again.
245- **Builds by hand.** `python -I tools/ps_prompt_glyphs.py --from-archive "<package>/data.rpf" --out ps_prompt_glyphs.gfx` builds
182 over the title's own movie: the shapes are replaced and every other tag (the ActionScript, export and class tables) is 246 over the title's own movie: the shapes are replaced and every other tag (the ActionScript, export and class tables) is
183 kept as it is, so the title's code finds the symbols as before. The output holds those tags of the game's movie: keep it 247 kept as it is, so the title's code finds the symbols as before. The output holds those tags of the game's movie: keep it
184 on your PC, never commit it. `--pad-inflated 28148 --out ps_prompt_glyphs.gfx` builds the standalone movie 248 on your PC, never commit it. `--pad-inflated 28148 --out ps_prompt_glyphs.gfx` builds the standalone movie
185 (with its own ActionScript block, which has never run in the title) padded to the same length. 249 (with its own ActionScript block, which has never run in the title) padded to the same length.
250 `--mono` draws the PlayStation glyphs in a look close to the PS5's own prompts: white keys and discs with black
251 symbols, and the d-pad as the DualSense's four separate arrow keys pointing at the middle (the pressed ones white,
252 the rest grey). Its sprites have no see-through box behind them: a highlight's colour change showed that box as a
253 black halo.
186- **Checking it.** Run with `LEONIDA_PROMPTS=playstation` (or `keyboard`) and look in the log for 254- **Checking it.** Run with `LEONIDA_PROMPTS=playstation` (or `keyboard`) and look in the log for
187 `prompt glyphs: PlayStation movie loaded` (or `keyboard movie loaded`) and `prompt glyphs: the title reads its glyph 255 `prompt glyphs: PlayStation movie loaded` (or `keyboard movie loaded`) and `prompt glyphs: the title reads its glyph
188 movie`, which names the family and the glyphs served. If the second line never appears, the title does not read the 256 movie`, which names the family and the glyphs served. If the second line never appears, the title does not read the
diff --git a/docs/runtime_ctest_hosts.md b/docs/runtime_ctest_hosts.md
new file mode 100644
index 000000000..d8d895657
--- /dev/null
+++ b/docs/runtime_ctest_hosts.md
@@ -0,0 +1,105 @@
1# The runtime ctest suite on two hosts: Wine and native Windows
2
3The same runtime test suite, the same GPU model, two hosts: Wine on Linux ([#1150](https://github.com/ubiquitarianism/leonida/issues/1150)) and native Windows 10. The point is not to compare percentages but to separate the failures that belong to Wine's host DLLs from the ones that are ours. A test that fails only under Wine is a limit of the host; a test that fails on both is a bug in the layer, and one that fails only natively is a bug Wine was hiding.
4
5No game files were used by either run. The suite builds its own fixtures.
6
7## The two runs
8
9| | Wine run (#1150) | Native run (this page) |
10|---|---|---|
11| Host | Parrot Linux (Debian 13), Wine 10.0 | Windows 10 Pro 19045, no Wine |
12| GPU | NVIDIA GPU (Pascal class, 4 GB). Model and PCI id withheld | the same card |
13| Driver | NVIDIA 555.58 | NVIDIA 582.28 |
14| Compiler | clang-cl 21 / lld-link, xwin SDK 10.0.26100 | MSVC 19.44 x64, installed SDK |
15| Commit | `3aa97542` | `58be9cdf` |
16| Tests run | 304 of 304 | 307 of 308 (one disabled) |
17| Result | 239 passed, 19 failed, 5 timeouts, 40 skipped — 92% | 278 passed, 11 failed (9 failed, 1 SegFault, 1 timeout), 18 skipped — 96%, 452 s |
18| ctest valve | `--timeout 120` | `--timeout 120` |
19
20The commits differ by a day of `main`. Nothing in the 24 Wine failures is a test added between them except `d3d12_existing_heap`, `d3d12_xmem_placed` and `root_sig`, which all exist in both.
21
22## 19 Wine failures pass natively
23
24These are host limits. Wine's `ntdll`/`bcrypt`/`dxgi`/vkd3d answer differently from the Windows DLLs the tests compare against:
25
26| Test | What Wine does that heals here |
27|---|---|
28| `xmem` | protection windows, page charging and read-only faults: Windows virtual-memory semantics Wine does not give |
29| `file_system` | `ReadFile` into uncommitted pages does not fail with `ERROR_NO_ACCESS` |
30| `bcrypt_rng`, `bcrypt_rng_seeded` | the unknown-algorithm probe: the shim delegates to Wine's `bcrypt`, which answers another status |
31| `d3d12_clear`, `d3d12_clear_formats` | no WARP under Wine, so the differential test cannot run |
32| `dxgi_swapchain` | `CreateSwapChainForHwnd` returned `0x887a0001` against the host's `0x00000000` |
33| `dstorage` | the timeout with no output after `OpenFile: null or empty path` is Wine's, not ours |
34| `run_startup_cmdline` | the Wine init-message issue |
35| `vk_device_filter_tools` | the script ran the `.exe` directly on Linux (`Exec format error`) instead of through Wine |
36| `root_sig` | the all-zero-checksum Xbox blob: Wine's chained serialization, as the issue suspected |
37| `d3d12_residency`, `d3d12_fence_timing`, `d3d12_indirect_dispatch_count`, `d3d12_xmem_placed` | the documented host-comparison family |
38| `d3d12_buffer_tiles`, `d3d12_texture_tiles` | the sparse-residency deadlock: the first `UpdateTileMappings` is refused under Wine and teardown blocks on the queue |
39| `dxgi_host_parity`, `dxgi_waitable_latency` | the page fault on write to `0x0` only turned into a hang because winedbg attached |
40
41The four hangs are the clearest case: natively they are ordinary sub-second passes.
42
43## 5 Wine failures reproduce natively, so they are ours
44
45| Test | Measured |
46|---|---|
47| `d3d12_vulkan_device` | fails as under Wine |
48| `d3d12_subresource_copy` | `CPU copies (host image copy): the steps differ from the host's`, line 391 |
49| `d3d12_heap_properties` | `heap properties committed texture, CUSTOM write-back L0: ours 0x8007000e host 0x0` — our `E_OUTOFMEMORY` where the host creates the resource |
50| `d3d12_existing_heap` | `a title-placed buffer (device slot 133) could not import its pages…`, line 196 `GetGPUVirtualAddress() == (D3D12_GPU_VIRTUAL_ADDRESS)pages` (`HRESULT 0x80004001`) |
51| `d3d12_r9g9b9e5_uav` | line 669 `SUCCEEDED(device->CreateCommittedResource(&custom_heap, ..., &cpu_uav.p))` — CPU-heap `HOST_TRANSFER` texture gets `E_OUTOFMEMORY` on Pascal (same root cause as `d3d12_subresource_copy` and `d3d12_heap_properties`, after the expected `GetResourceAllocationInfo format not supported yet: 67` refusal log) |
52
53## 6 that only fail natively, deterministic 3 of 3
54
55Each was rerun three times alone with `ctest -R '^name$' --repeat until-fail:3`; every repetition failed the same way on this build.
56
57| Test | Symptom |
58|---|---|
59| `d3d12_subgroup` | **SegFault** at 1.4 s, right after `device slot 16 (CreateRootSignature) first call`. Stack-layout-dependent: device slot 14 (`CreateDescriptorHeap`) accepted an unaligned caller stack word (`0x65626f72705f7370`, `"ps_probe"`) as a console heap address whenever the next word happened to equal `32` ([#1328](https://github.com/ubiquitarianism/leonida/pull/1328)); an independent Pascal 4 GB build with a different stack frame passed 3/3 |
60| `d3d12_set_descriptor_heaps` | `CHECK failed: !blob.empty()` (line 341), after two `upload heaps in system memory (no Resizable BAR)` lines |
61| `root_signature_oracle` | `FAIL 1.1 with every root-signature flag: Microsoft serializer accepts it` (`Unsupported bit-flag set (root signature flags c7f)` — Windows 10's `d3d12.dll` refuses the SM 6.6 heap-direct bits `0xC00`) |
62| `d3d12_close_parity` | the compared steps diverge from the host from the third case on |
63| `d3d12_pso_validation` | line 436 `check_gfx_parity("gfx: Flags=DYNAMIC_DEPTH_BIAS", ...)` (`layer 0x00000000 != host 0x80070057`: Windows 10's runtime refuses `DYNAMIC_DEPTH_BIAS`; the `depth-stencil format not supported: 9999, ...` lines are negative-case logs) |
64| `xdxr_build_check` | a **Timeout at 120 s** that is not a hang: with `--timeout 400` it passes in **212 s** |
65
66`d3d12_subgroup` is the most serious: a crash in device slot 14's console-layout heuristic ([#1328](https://github.com/ubiquitarianism/leonida/pull/1328)) that depended on adjacent stack words, which is why neither the `clang-cl` Wine build nor a second MSVC build on the same Pascal 4 GB class hit it. `xdxr_build_check` costs a full-suite run two minutes of wall clock and a false fail on this card; 212 s on a 4 GB Pascal for a DXR build is a plausible ceiling for any low-end machine.
67
68## Reading it
69
70- A native pass does not mean the Wine report was wrong: it means the missing piece was Wine. Both runs stay useful.
71- Skipped here are 18 (7 retail-package skips plus 11 validation, DXR, conservative-tier-3 and mesh-shader skips); the Wine run skipped 40 for its own reasons. A skip is neither a pass nor a fail and the percentages do not compare one for one.
72- This run was from an interactive desktop session, where `xgameruntime_offline` and `xgameruntime_offline_hdr` pass (`0.11 s` and `0.03 s`); over a non-interactive SSH session they fail `XDisplayAcquireTimeoutDeferral`.
73- The implicit Vulkan layers were disabled (`VK_LOADER_LAYERS_DISABLE=~implicit~`): this machine has OBS and RenderDoc layers installed.
74
75## Re-measured on `main` `d1dff794` (27 November 2026)
76
77Two days later, same card and same Windows 10 19045 host, five rows of the tables above re-run three times each
78(`ctest -R '^name$' --timeout 300`). This is a targeted re-run, not a new full-suite figure: the counts in "The two
79runs" still describe `58be9cdf`.
80
81| Test | 25 November | 27 November, `main` `d1dff794` | Covers it now |
82|---|---|---|---|
83| `d3d12_subresource_copy` | failed, line 391 (`CPU copies (host image copy): the steps differ from the host's`) | **passes 3/3** (0.55–0.56 s) | [#1364](https://github.com/ubiquitarianism/leonida/pull/1364), merged 24 November |
84| `d3d12_r9g9b9e5_uav` | failed, line 669 (CPU-heap `HOST_TRANSFER` texture gets `E_OUTOFMEMORY`) | **passes 3/3** (0.31–0.32 s) | [#1364](https://github.com/ubiquitarianism/leonida/pull/1364) |
85| `d3d12_existing_heap` | failed, line 196 (`0x80004001`) | still fails 3/3; each run logs `texture memory unavailable: 2048 bytes, alignment 1024, type bits 0x0 (vk format 9 256x8)` twice | [#1894](https://github.com/ubiquitarianism/leonida/pull/1894): with its head `2d258c8c` applied to this tree the test passes 3/3 and each run logs `title image has no host-transfer memory type, using staging for Vulkan format` |
86| `d3d12_heap_properties` | failed on the `0x8007000e` CPU-heap rows | still fails 3/3, now on exactly two rows: `placed buffer` and `placed texture, DEFAULT heap, ALLOW_ALL` give `0x0` in the layer and `0x80070057` on the host | [#1389](https://github.com/ubiquitarianism/leonida/pull/1389) |
87| `d3d12_vulkan_device` | failed (the `CreateHeap` comparison) | still fails 3/3; the last compared row is now `invalid arguments heap: HARDWARE_PROTECTED: an older host runtime (Windows 10, Windows 11 23H2) refuses it (ours 0x00000000, host 0x80070057)` | [#1389](https://github.com/ubiquitarianism/leonida/pull/1389) |
88
89Both remaining `d3d12_heap_properties` rows are the same host fact. This GPU reports
90`D3D12_RESOURCE_HEAP_TIER_1`, and `D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES` (the value `0`, no `DENY` flag) is
91heap tier 2 and greater only, so the host refuses the two `ALLOW_ALL` cases with `E_INVALIDARG` while the
92`ALLOW_ONLY_*` rows match. The layer accepts them because the console it imitates is tier 2; what has to change is the
93host comparison in the test, which is what #1389 does.
94
95The `HARDWARE_PROTECTED` row is the same kind of host gate: Windows 10's `d3d12.dll` refuses the flag with
96`E_INVALIDARG`, and the layer, like the console, accepts it. Also #1389.
97
98`d3d12_existing_heap` is not a heap-flag case. The layer builds the title's 256x8 Vulkan format-9 image (2048 bytes,
99alignment 1024), finds no host-transfer memory type for it and the placed import fails; #1894 stages that upload. The
100sub-page host buffer imports named above for this test ([#1458](https://github.com/ubiquitarianism/leonida/pull/1458))
101are a different path and are still open.
102
103## What follows
104
105The 5 reproduced and the 6 native-only are the actionable list (5 + 6 = 11 failures). Since this run: [#1364](https://github.com/ubiquitarianism/leonida/pull/1364) fixed the Pascal `HOST_TRANSFER` CPU-heap image failure behind `d3d12_subresource_copy`, `d3d12_r9g9b9e5_uav` and the `0x8007000e` rows of `d3d12_heap_properties` and `d3d12_vulkan_device`; open pull requests cover the remaining host-tier-1 heap comparisons ([#1389](https://github.com/ubiquitarianism/leonida/pull/1389)), sub-page host buffer imports on 256-byte UBO GPUs (`d3d12_existing_heap`, [#1458](https://github.com/ubiquitarianism/leonida/pull/1458)), `d3d12_subgroup` ([#1328](https://github.com/ubiquitarianism/leonida/pull/1328)), `d3d12_set_descriptor_heaps` ([#1353](https://github.com/ubiquitarianism/leonida/pull/1353)), `root_signature_oracle` ([#988](https://github.com/ubiquitarianism/leonida/pull/988)), `d3d12_close_parity` ([#989](https://github.com/ubiquitarianism/leonida/pull/989)), `d3d12_pso_validation` ([#967](https://github.com/ubiquitarianism/leonida/pull/967), [#1377](https://github.com/ubiquitarianism/leonida/pull/1377)), and `xdxr_build_check`'s timeout ([#1424](https://github.com/ubiquitarianism/leonida/pull/1424)).
diff --git a/docs/testing.md b/docs/testing.md
index d62a0cf99..e84313891 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -701,13 +701,13 @@ for every pull request that touches the runtime, the scripts or a tool the jobs
701lists them), and you can do the same on Linux without a GPU: 701lists them), and you can do the same on Linux without a GPU:
702 702
703```sh 703```sh
704sudo apt-get install -y libvulkan-dev mesa-vulkan-drivers vulkan-tools spirv-tools llvm-19 704sudo apt-get install -y libvulkan-dev mesa-vulkan-drivers vulkan-tools spirv-tools llvm-21
705cmake -S runtime -B runtime/build/linux && cmake --build runtime/build/linux --parallel 705cmake -S runtime -B runtime/build/linux && cmake --build runtime/build/linux --parallel
706python -I scripts/run_gpu_tests.py --build runtime/build/linux --llvm-mc /usr/lib/llvm-19/bin/llvm-mc 706python -I scripts/run_gpu_tests.py --build runtime/build/linux --llvm-mc /usr/lib/llvm-21/bin/llvm-mc
707LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \ 707LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \
708 --llvm-mc /usr/lib/llvm-19/bin/llvm-mc --filter cs_ 708 --llvm-mc /usr/lib/llvm-21/bin/llvm-mc --filter cs_
709LEONIDA_BARY_FALLBACK=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \ 709LEONIDA_BARY_FALLBACK=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \
710 --llvm-mc /usr/lib/llvm-19/bin/llvm-mc 710 --llvm-mc /usr/lib/llvm-21/bin/llvm-mc
711``` 711```
712 712
713With Mesa 25.2 (llvmpipe, LLVM 20) the first run passes 52 of 88 and skips 36, the second passes 37 of 39 and 713With Mesa 25.2 (llvmpipe, LLVM 20) the first run passes 52 of 88 and skips 36, the second passes 37 of 39 and
@@ -736,7 +736,7 @@ differences.
736## Macs in CI 736## Macs in CI
737 737
738The `macos` job in `.github/workflows/runtime.yml` builds the runtime on GitHub's `macos-26` arm64 runner and runs 738The `macos` job in `.github/workflows/runtime.yml` builds the runtime on GitHub's `macos-26` arm64 runner and runs
739`ctest` and `run_gpu_tests.py` on MoltenVK; `macos-python` in `ci.yml` runs the Python suites. The runner is a VM 739`ctest` and `run_gpu_tests.py` on MoltenVK on pushes to `main`, the daily schedule, and `workflow_dispatch`. The runner is a VM
740whose Metal device is "Apple Paravirtual device" (Metal family Mac2, not Apple7): MoltenVK runs on it with 32-wide 740whose Metal device is "Apple Paravirtual device" (Metal family Mac2, not Apple7): MoltenVK runs on it with 32-wide
741subgroups, so the wave64 and "32 lanes on request" tests skip there (about 75 of 190 in November 2026), and Mesa's 741subgroups, so the wave64 and "32 lanes on request" tests skip there (about 75 of 190 in November 2026), and Mesa's
742KosmicKrisp finds no device. `macos-15` can't build the runtime: Xcode 16's libc++ has no floating-point 742KosmicKrisp finds no device. `macos-15` can't build the runtime: Xcode 16's libc++ has no floating-point
@@ -899,6 +899,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin
899| On RADV with Mesa 25.2 (Ubuntu 24.04's default; 25.2.8 measured) or 25.3 (from the source, not run), `cs_w32_salu64` fails with word 2 = `0` (want `0xFFFFFFFF`) and `cs_signed_zero_nan` fails with word 5 = `0` (want `1`). The `cs_signed_zero_nan` failure alone is also measured on RADV 25.0.7 (RX 7800 XT, Debian 13; @mrbean56, #4421) and on ANV 25.2.8 (Intel UHD 630; @theswiss24, #4571); llvmpipe on Mesa 26.0.8 (Ubuntu 26.04) still gives word 5 = `0`, which `check.py` does not judge there (`UNJUDGED_WORDS`) | Two Mesa bugs, not translator bugs (#166). `cs_w32_salu64`: ACO's `combine_add_sub_b2i` reads a temporary without counting the use, so dead-code elimination removes it (`ACO ERROR: ... never defined` with `MESA_SHADER_CACHE_DISABLE=true`); `RADV_DEBUG=llvm` passes. `cs_signed_zero_nan`: NIR's range analysis (`fmul_is_a_number`) calls `0 * x` a number when `x` may be infinite, so the `x != x` check folds to false despite `SignedZeroInfNanPreserve`. The same NIR code is behind llvmpipe's word 5 (#664) and ANV's, since both drivers run NIR; `cs_w32_salu64` is ACO's, so only RADV has it | Expected with these Mesa versions. From the source, the ACO function is gone from Mesa 26.0 and the NIR code was replaced in 26.1 (neither run); RADV from Mesa 26.3.1 passes both on an 8060S (gfx1151) | 899| On RADV with Mesa 25.2 (Ubuntu 24.04's default; 25.2.8 measured) or 25.3 (from the source, not run), `cs_w32_salu64` fails with word 2 = `0` (want `0xFFFFFFFF`) and `cs_signed_zero_nan` fails with word 5 = `0` (want `1`). The `cs_signed_zero_nan` failure alone is also measured on RADV 25.0.7 (RX 7800 XT, Debian 13; @mrbean56, #4421) and on ANV 25.2.8 (Intel UHD 630; @theswiss24, #4571); llvmpipe on Mesa 26.0.8 (Ubuntu 26.04) still gives word 5 = `0`, which `check.py` does not judge there (`UNJUDGED_WORDS`) | Two Mesa bugs, not translator bugs (#166). `cs_w32_salu64`: ACO's `combine_add_sub_b2i` reads a temporary without counting the use, so dead-code elimination removes it (`ACO ERROR: ... never defined` with `MESA_SHADER_CACHE_DISABLE=true`); `RADV_DEBUG=llvm` passes. `cs_signed_zero_nan`: NIR's range analysis (`fmul_is_a_number`) calls `0 * x` a number when `x` may be infinite, so the `x != x` check folds to false despite `SignedZeroInfNanPreserve`. The same NIR code is behind llvmpipe's word 5 (#664) and ANV's, since both drivers run NIR; `cs_w32_salu64` is ACO's, so only RADV has it | Expected with these Mesa versions. From the source, the ACO function is gone from Mesa 26.0 and the NIR code was replaced in 26.1 (neither run); RADV from Mesa 26.3.1 passes both on an 8060S (gfx1151) |
900| On an Intel iGPU with ANV from Mesa 25.2 (25.2.8 measured), `cs_fmt_int_narrow` fails with word 34 = `0x00000000` (want `0xFFFFFFFF`); the full dump also has words 49 and 129 = `0x80000000` (want `0x8000FFFF`), natively and under `LEONIDA_W64_EMULATE=1` alike (`check.py`'s comparison stops at the first mismatch, so its line names only word 34). Measured on Gen9 at subgroup sizes 8, 16 and 32 alike (UHD 630, CFL GT2; TEST-1000), and on an Arrow Lake-H Arc 140T (device subgroup 8–32; `Intel(R) Graphics (ARL)`, Xe2; ANV 25.2.8-0ubuntu0.24.04.5, Vulkan 1.4.318) | A Mesa bug, not a translator bug (TEST-1000). The fixture's second source dword `0x8000FFFF` reaches the SSBO as `0x80000000`: the translated module holds it as one `OpConstant %uint` stored by a single dword `OpStore` to PhysicalStorageBuffer, no float operation on the path, yet the raw buffer readback (word 129) shows its low halfword `0xffff` zeroed and its high halfword `0x8000` intact — the bit pattern is a negative f32 denormal and it comes back as `-0`, as if flushed. Words 34 and 49 are a correct `16_16_16_16_SINT` load of the corrupted dword (the neighbouring channels sign-extend correctly). The module requests `DenormPreserve 16` and `SignedZeroInfNanPreserve 32`, not `DenormPreserve 32`, and the same module passes 136/136 on gfx1036 (native `hw_oracle`), llvmpipe, an RTX 2060 SUPER, 5060 Laptop and 5080, an RX 7900 XTX under RADV, Xe-LP (UHD 770, ANV 26.3.1) and Meteor Lake (ANV 26.2.7); adding `OpExecutionMode DenormPreserve 32` by hand fixes all 136 words on both Gen9 and the Arc 140T | Expected with this Mesa. Don't add `DenormPreserve 32` to the translator for it: the game runs f32 denormals flushed (`denorm_mode_32 = 0`, docs/design.md) and the translator leaves denormal handling to the driver. A newer Mesa passes (26.2.7 on Meteor Lake, 26.3.1 on Xe-LP); Gen9 and the Arc 140T with a newer Mesa not run | 900| On an Intel iGPU with ANV from Mesa 25.2 (25.2.8 measured), `cs_fmt_int_narrow` fails with word 34 = `0x00000000` (want `0xFFFFFFFF`); the full dump also has words 49 and 129 = `0x80000000` (want `0x8000FFFF`), natively and under `LEONIDA_W64_EMULATE=1` alike (`check.py`'s comparison stops at the first mismatch, so its line names only word 34). Measured on Gen9 at subgroup sizes 8, 16 and 32 alike (UHD 630, CFL GT2; TEST-1000), and on an Arrow Lake-H Arc 140T (device subgroup 8–32; `Intel(R) Graphics (ARL)`, Xe2; ANV 25.2.8-0ubuntu0.24.04.5, Vulkan 1.4.318) | A Mesa bug, not a translator bug (TEST-1000). The fixture's second source dword `0x8000FFFF` reaches the SSBO as `0x80000000`: the translated module holds it as one `OpConstant %uint` stored by a single dword `OpStore` to PhysicalStorageBuffer, no float operation on the path, yet the raw buffer readback (word 129) shows its low halfword `0xffff` zeroed and its high halfword `0x8000` intact — the bit pattern is a negative f32 denormal and it comes back as `-0`, as if flushed. Words 34 and 49 are a correct `16_16_16_16_SINT` load of the corrupted dword (the neighbouring channels sign-extend correctly). The module requests `DenormPreserve 16` and `SignedZeroInfNanPreserve 32`, not `DenormPreserve 32`, and the same module passes 136/136 on gfx1036 (native `hw_oracle`), llvmpipe, an RTX 2060 SUPER, 5060 Laptop and 5080, an RX 7900 XTX under RADV, Xe-LP (UHD 770, ANV 26.3.1) and Meteor Lake (ANV 26.2.7); adding `OpExecutionMode DenormPreserve 32` by hand fixes all 136 words on both Gen9 and the Arc 140T | Expected with this Mesa. Don't add `DenormPreserve 32` to the translator for it: the game runs f32 denormals flushed (`denorm_mode_32 = 0`, docs/design.md) and the translator leaves denormal handling to the driver. A newer Mesa passes (26.2.7 on Meteor Lake, 26.3.1 on Xe-LP); Gen9 and the Arc 140T with a newer Mesa not run |
901| Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer | 901| Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer |
902| The synthetic `cs_imgstore_cube` test reports 63 bad `r32 sint` texels on a Tesla V100-SXM2-16GB (Volta, NVIDIA 580.178.04, Linux; Vulkan 1.4.312; [#1492](https://github.com/ubiquitarianism/leonida/issues/1492)) | The signed 32-bit cube-storage-write failure is known on that reported host, but its cause has not been isolated. It passes on an RTX 5090 with NVIDIA 621.14 on Windows 11 | No workaround is confirmed. Keep the test's expected values; report the GPU, driver and output if you reproduce it on another setup |
902| `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` | 903| `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` |
903| `vk_harness` doesn't compile: `VK_KHR_maintenance8` names unknown | Vulkan headers older than the SDK the code was written against | Update to current `main` (the code now builds without it), or use current Khronos Vulkan-Headers; conda-forge's package is too old | 904| `vk_harness` doesn't compile: `VK_KHR_maintenance8` names unknown | Vulkan headers older than the SDK the code was written against | Update to current `main` (the code now builds without it), or use current Khronos Vulkan-Headers; conda-forge's package is too old |
904| Configure stops with "Vulkan headers too old: ... VK_HEADER_VERSION N" (before: the build stopped at `d3d12_com.h(42): error C3646: 'calibrated': unknown override specifier` and 100+ errors in `d3d12_vulkan_device.cpp`, or at `VkPhysicalDevicePipelineBinaryFeaturesKHR` in `vk_harness.cpp`) | The Windows runtime found Vulkan headers older than v1.3.294 (`runtime/cmake/vulkan_headers_version.cmake`). conda-forge's `vulkan-headers` resolves to 1.3.231 next to `llvm-tools`. Measured on MSVC 14.51: v1.3.294 builds every target, SDK 1.3.280.0 all but `vk_harness` (`VK_KHR_pipeline_binary` is new in v1.3.294), 1.3.231 stops in the D3D12 layer | Point `VULKAN_SDK` at a Vulkan SDK from 1.3.296.0 on or current Khronos Vulkan-Headers, then delete `CMakeCache.txt`; or pass `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` with no other headers installed | 905| Configure stops with "Vulkan headers too old: ... VK_HEADER_VERSION N" (before: the build stopped at `d3d12_com.h(42): error C3646: 'calibrated': unknown override specifier` and 100+ errors in `d3d12_vulkan_device.cpp`, or at `VkPhysicalDevicePipelineBinaryFeaturesKHR` in `vk_harness.cpp`) | The Windows runtime found Vulkan headers older than v1.3.294 (`runtime/cmake/vulkan_headers_version.cmake`). conda-forge's `vulkan-headers` resolves to 1.3.231 next to `llvm-tools`. Measured on MSVC 14.51: v1.3.294 builds every target, SDK 1.3.280.0 all but `vk_harness` (`VK_KHR_pipeline_binary` is new in v1.3.294), 1.3.231 stops in the D3D12 layer | Point `VULKAN_SDK` at a Vulkan SDK from 1.3.296.0 on or current Khronos Vulkan-Headers, then delete `CMakeCache.txt`; or pass `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` with no other headers installed |
@@ -918,6 +919,8 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin
918| On a Mac, `valu_fuzz.py --family f16` reads `+0` where the model wants `-0`, from a multiply whose exact product is -0 (`v_mul_f16`, `v_pk_mul_f16`) or from an FMA whose product and addend are both -0 (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`) | MoltenVK computes a `NoContraction` multiply as `fma(l, r, +0)`, which drops the sign. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-182, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions. To run the rest of the fuzzer clean, add `--skip-op` for each of the five ops. To see them match, install Homebrew's `mesa` and use its KosmicKrisp driver: `LEONIDA_VULKAN_LOADER=/opt/homebrew/opt/vulkan-loader/lib/libvulkan.1.dylib VK_DRIVER_FILES=/opt/homebrew/share/vulkan/icd.d/kosmickrisp_mesa_icd.aarch64.json python3 -I tools/valu_fuzz.py --family f16 --build runtime/build/linux`. Or build MoltenVK with SPIRV-Cross `300681bb` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision`, and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` | 919| On a Mac, `valu_fuzz.py --family f16` reads `+0` where the model wants `-0`, from a multiply whose exact product is -0 (`v_mul_f16`, `v_pk_mul_f16`) or from an FMA whose product and addend are both -0 (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`) | MoltenVK computes a `NoContraction` multiply as `fma(l, r, +0)`, which drops the sign. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-182, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions. To run the rest of the fuzzer clean, add `--skip-op` for each of the five ops. To see them match, install Homebrew's `mesa` and use its KosmicKrisp driver: `LEONIDA_VULKAN_LOADER=/opt/homebrew/opt/vulkan-loader/lib/libvulkan.1.dylib VK_DRIVER_FILES=/opt/homebrew/share/vulkan/icd.d/kosmickrisp_mesa_icd.aarch64.json python3 -I tools/valu_fuzz.py --family f16 --build runtime/build/linux`. Or build MoltenVK with SPIRV-Cross `300681bb` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision`, and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` |
919| A pixel shader exporting non-canonical f32 NaNs reads back `0x7fc00000` from an RGBA32F color attachment | KosmicKrisp (Mesa 26.3.1), reproduced on Apple M3 Max, M2 Ultra and M1 Pro ([#3125](https://github.com/ItsNotRexed/Leonida/issues/3125)): `nir_to_msl` emits `(NAN)` for `float`-typed NaN constants (`MESA_KK_DEBUG=msl`); MoltenVK 1.4.2 preserved both tested payloads on the same hardware | `ps_nan_payload` allows the measured canonical word only for the NaN channels and only when `vk_harness` reports `driver: KosmicKrisp`. Finite channels and other drivers still require exact words. Integer or storage-buffer readback still canonicalizes constants that NIR infers as `float` (see the `cs_bvh` row below). | 920| A pixel shader exporting non-canonical f32 NaNs reads back `0x7fc00000` from an RGBA32F color attachment | KosmicKrisp (Mesa 26.3.1), reproduced on Apple M3 Max, M2 Ultra and M1 Pro ([#3125](https://github.com/ItsNotRexed/Leonida/issues/3125)): `nir_to_msl` emits `(NAN)` for `float`-typed NaN constants (`MESA_KK_DEBUG=msl`); MoltenVK 1.4.2 preserved both tested payloads on the same hardware | `ps_nan_payload` allows the measured canonical word only for the NaN channels and only when `vk_harness` reports `driver: KosmicKrisp`. Finite channels and other drivers still require exact words. Integer or storage-buffer readback still canonicalizes constants that NIR infers as `float` (see the `cs_bvh` row below). |
920| `cs_bvh` and `cs_bvh32` fail on a Mac with KosmicKrisp: `out[3]` reads `0x7fc00000`, want `0xffffffff` | KosmicKrisp's `nir_to_msl` compiler (Mesa 26.3.1, measured on Apple M2 Ultra, macOS 27.3), not the translator or the buffer format. The triangle branch writes bitcast `float` words and the box branch writes `OpSelect %uint` with `0xffffffff` (`-1`) into the same VGPRs; NIR erases `OpBitcast`, type inference marks the shared register and `bcsel` as `float`, and `nir_to_msl` prints any `float`-typed 32-bit constant in the IEEE-754 NaN range (`0x7f800001..0x7fffffff`, `0xff800001..0xffffffff`) as `(NAN)` (`0x7fc00000`) | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) return `0xffffffff` on the same machine. Do not weaken `vk_compute_test`'s expected BVH words | 921| `cs_bvh` and `cs_bvh32` fail on a Mac with KosmicKrisp: `out[3]` reads `0x7fc00000`, want `0xffffffff` | KosmicKrisp's `nir_to_msl` compiler (Mesa 26.3.1, measured on Apple M2 Ultra, macOS 27.3), not the translator or the buffer format. The triangle branch writes bitcast `float` words and the box branch writes `OpSelect %uint` with `0xffffffff` (`-1`) into the same VGPRs; NIR erases `OpBitcast`, type inference marks the shared register and `bcsel` as `float`, and `nir_to_msl` prints any `float`-typed 32-bit constant in the IEEE-754 NaN range (`0x7f800001..0x7fffffff`, `0xff800001..0xffffffff`) as `(NAN)` (`0x7fc00000`) | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) return `0xffffffff` on the same machine. Do not weaken `vk_compute_test`'s expected BVH words |
922| `ps_cndmask_sign_mods` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x7fc00000, 0x7fc00000, 0x80000001, 0x7fc00000`, want `0xff800001, 0x7f800001, 0x80000001, 0x7f800001` | The same `nir_to_msl` NaN-constant path as `cs_bvh` above: the shader selects between `float` NaNs with sign and payload (`-NaN`, `+NaN`), and KosmicKrisp prints each such constant as `(NAN)` (`0x7fc00000`). Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; the same test passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine |
923| `ps_valu16_mad_sel` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x8003, 0xdb880000, 0x7fc00000, 0x80000000`, want `0x8003, 0xdb880000, 0xffffffff, 0x80000000` | Same cause: a value the shader writes as `0xffffffff` (`-1`) reaches the render target as `0x7fc00000` because `nir_to_msl` types the shared register as `float` and prints the NaN-range constant as `(NAN)`. Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine |
921| `cs_fma_fused` fails on a Mac with KosmicKrisp: word 7 reads `0x7352`, want `0x7351` | The f16 multiply-add (round to odd), computed at run time, comes out as if the product were rounded first: the exact product, 14988, is halfway between the f16 values 14984 (`0x7351`) and 14992 (`0x7352`), the addend is -2^-22, and one rounding gives `0x7351`. Measured on an Apple M3 with Mesa 26.3.1, 20 of 20 runs (the review of #1724). While the fixture's f16 operands were literals the constant was folded exactly, so the test passed there | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) give `0x7351` on the same machine. The f32 words KosmicKrisp splits are accepted under `--fma glsl`; the f16 word is not, since it does not use `Fma` | 924| `cs_fma_fused` fails on a Mac with KosmicKrisp: word 7 reads `0x7352`, want `0x7351` | The f16 multiply-add (round to odd), computed at run time, comes out as if the product were rounded first: the exact product, 14988, is halfway between the f16 values 14984 (`0x7351`) and 14992 (`0x7352`), the addend is -2^-22, and one rounding gives `0x7351`. Measured on an Apple M3 with Mesa 26.3.1, 20 of 20 runs (the review of #1724). While the fixture's f16 operands were literals the constant was folded exactly, so the test passed there | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) give `0x7351` on the same machine. The f32 words KosmicKrisp splits are accepted under `--fma glsl`; the f16 word is not, since it does not use `Fma` |
922| CMake stops with "needs the Windows SDK 10.0.26100 or newer", or MSVC reports `'Desc_1_2': is not a member of 'D3D12_VERSIONED_ROOT_SIGNATURE_DESC'` | A Windows SDK older than 10.0.26100 (10.0.22621 is the common one), which has no version 1.2 root signatures | `winget install Microsoft.WindowsSDK.10.0.26100`, or add it in the Visual Studio Installer, then delete `runtime/build` and configure again | 925| CMake stops with "needs the Windows SDK 10.0.26100 or newer", or MSVC reports `'Desc_1_2': is not a member of 'D3D12_VERSIONED_ROOT_SIGNATURE_DESC'` | A Windows SDK older than 10.0.26100 (10.0.22621 is the common one), which has no version 1.2 root signatures | `winget install Microsoft.WindowsSDK.10.0.26100`, or add it in the Visual Studio Installer, then delete `runtime/build` and configure again |
923| `scripts/build_runtime.ps1` stops at once: "The checkout path ... contains '%'" (`build_llvm_mc.ps1`: "-Temp ... contains '%'") | A `%` in the checkout's path (or in `-Temp`). cmd.exe expands `%...%` in the generated `_build.cmd` (twice on a `CALL` line), and even with that escaped, `cl` rejects a `%` in the path-valued `/D` definitions of the test targets (`D8038: invalid argument`) however it is quoted. Older scripts failed in configure or a few hundred steps into Ninja instead | Move or clone the checkout (or choose a `-Temp`) in a folder without `%` in its path | 926| `scripts/build_runtime.ps1` stops at once: "The checkout path ... contains '%'" (`build_llvm_mc.ps1`: "-Temp ... contains '%'") | A `%` in the checkout's path (or in `-Temp`). cmd.exe expands `%...%` in the generated `_build.cmd` (twice on a `CALL` line), and even with that escaped, `cl` rejects a `%` in the path-valued `/D` definitions of the test targets (`D8038: invalid argument`) however it is quoted. Older scripts failed in configure or a few hundred steps into Ninja instead | Move or clone the checkout (or choose a `-Temp`) in a folder without `%` in its path |