diff options
| author | NotRexed <therealnothingfn@gmail.com> | 2026-11-29 17:09:32 -0500 |
|---|---|---|
| committer | NotRexed <therealnothingfn@gmail.com> | 2026-11-29 17:09:32 -0500 |
| commit | 452d1d1b68aa2da94d5f0eff43ad0a6a83bbbadf (patch) | |
| tree | eb18b121fd8ea11c746b77abd3557cd1da160c24 /docs | |
| parent | dc64c3685ff833acfd45f29954a3b76f203cb406 (diff) | |
| parent | 32b9f4a3e0e58dd02d8ccddcec7ac8185a6d9138 (diff) | |
Merge remote-tracking branch 'origin/main' into next
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/README.md | 20 | ||||
| -rw-r--r-- | docs/boot_leads.md | 39 | ||||
| -rw-r--r-- | docs/d3d12_command_objects.md | 4 | ||||
| -rw-r--r-- | docs/d3d12_vulkan.md | 32 | ||||
| -rw-r--r-- | docs/d3d12_xs_surface.md | 4 | ||||
| -rw-r--r-- | docs/design.md | 2 | ||||
| -rw-r--r-- | docs/gdk_public_reference.md | 56 | ||||
| -rw-r--r-- | docs/runtime_ctest_hosts.md | 105 |
8 files changed, 246 insertions, 16 deletions
diff --git a/docs/README.md b/docs/README.md index 1bb2ea02e..54ad2e17a 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 | ||
| @@ -85,6 +87,7 @@ method, scope and caveats. No game data is included. | |||
| 85 | | [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. | |
| 86 | | [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. | |
| 87 | | [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. | | ||
| 88 | | [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 | |
| 89 | | [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. | |
| 90 | | [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). | |
| @@ -96,8 +99,11 @@ method, scope and caveats. No game data is included. | |||
| 96 | | [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` 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. | |
| 97 | | [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. | |
| 98 | | [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. | | ||
| 99 | | [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`). | |
| 100 | | [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. | | ||
| 101 | | [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. | |
| 102 | | [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. | |
| 103 | | [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. | |
| @@ -115,6 +121,18 @@ method, scope and caveats. No game data is included. | |||
| 115 | | [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. | |
| 116 | | [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. | |
| 117 | 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 | |||
| 118 | ## Other languages | 136 | ## Other languages |
| 119 | 137 | ||
| 120 | Community 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`). | 138 | Community 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_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 | ||
| 3 | Open leads that may move the retail boot further, each with where it lands in this repository and how to check it. | 3 | Leads that may move the retail boot further, each with where it lands in this repository and how to check it. |
| 4 | Every item is a **hypothesis**: it has not been measured against this package or run in this runtime. Confirm it on | 4 | Every lead started as a **hypothesis**. Its **Status** line says whether a merged pull request has answered it, an |
| 5 | your own copy or with a synthetic test before you build on it, and record the result in the document named under | 5 | open 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**. | 6 | package or run in this runtime: confirm it on your own copy or with a synthetic test before you build on it, and |
| 7 | record 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/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 2098e348b..98f91932e 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -4966,13 +4966,13 @@ to be recovered from call sites (or the NDA GDK headers, if a developer has acce | |||
| 4966 | | 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. | | 4966 | | 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. | |
| 4967 | | 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. | | 4967 | | 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. | |
| 4968 | | 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. | | 4968 | | 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. | |
| 4969 | | 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**. | | 4969 | | 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**. | |
| 4970 | | 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. | | 4970 | | 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. | |
| 4971 | | 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**. | | 4971 | | 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**. | |
| 4972 | | 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**. | | 4972 | | 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**. | |
| 4973 | | 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**. | | 4973 | | 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**. | |
| 4974 | | 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**. | | 4974 | | 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**. | |
| 4975 | | 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). | | 4975 | | 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). | |
| 4976 | | 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. | | 4976 | | 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. | |
| 4977 | | VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. | | 4977 | | VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. | |
| 4978 | | 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. | | 4978 | | 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. | |
| @@ -5418,6 +5418,25 @@ folded into the table below with the measurement basis noted per row; nothing is | |||
| 5418 | is wrapped. The public chain is a usable base for those methods, not a guess. | 5418 | is wrapped. The public chain is a usable base for those methods, not a guess. |
| 5419 | - The BVH builder receives the device and command lists from the caller; prior art runs it exactly that way. | 5419 | - The BVH builder receives the device and command lists from the caller; prior art runs it exactly that way. |
| 5420 | 5420 | ||
| 5421 | **Measured: the presentation slots 78, 79, 80 and 81 are called, on the device** (D3D12-PRESENT-SLOTS-MEASURED). | ||
| 5422 | All eight device sites load the one device pointer from the BSS global `0x148759D00` into `rcx` and call through | ||
| 5423 | `[[rcx] + offset]`; that is the same global the layer's known device calls use (e.g. `CreateCommittedResource`, | ||
| 5424 | slot 27, at `0x142481bce`), and many subsystems load it rip-relative, as they would a device singleton. The | ||
| 5425 | other `call [reg+offset]` sites at those offsets belong to other interfaces that share the PC slot numbers, so they are | ||
| 5426 | counted but not attributed. Arity and arguments are the register and stack words written before each site: | ||
| 5427 | |||
| 5428 | | slot | offset | raw sites | device sites | receiver | arguments (registers, then stack) | what it is | | ||
| 5429 | |---:|---|---:|---:|---|---|---| | ||
| 5430 | | 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. | | ||
| 5431 | | 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. | | ||
| 5432 | | 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. | | ||
| 5433 | | 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. | | ||
| 5434 | |||
| 5435 | The sites also confirm the order the samples use: interval, schedule, then a wait per frame; the statistics call reads | ||
| 5436 | a token that an earlier wait wrote. Flag 2 on the wait is the one XCL gives the "write the token even on timeout" | ||
| 5437 | meaning. `PresentX` itself is not in this set (it is a queue slot, §4.5); 78-81 are device slots beyond the public | ||
| 5438 | vtable order, as the prior art said. | ||
| 5439 | |||
| 5421 | **Corrects.** | 5440 | **Corrects.** |
| 5422 | 5441 | ||
| 5423 | - **Device creation.** `D3D12XboxCreateDevice` is the entry point. The 24-word params struct is only logged, so | 5442 | - **Device creation.** `D3D12XboxCreateDevice` is the entry point. The 24-word params struct is only logged, so |
| @@ -5438,8 +5457,7 @@ folded into the table below with the measurement basis noted per row; nothing is | |||
| 5438 | 5457 | ||
| 5439 | **Narrows.** | 5458 | **Narrows.** |
| 5440 | 5459 | ||
| 5441 | - 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 | 5460 | - 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**. |
| 5442 | unknown; the prior art explicitly stops before them. | ||
| 5443 | - Descriptor start-handle ABI is known; descriptor bytes and heap increments are still **Open**. Slot 15 is | 5461 | - Descriptor start-handle ABI is known; descriptor bytes and heap increments are still **Open**. Slot 15 is |
| 5444 | forwarded unchanged, but the actual increment values were not measured. | 5462 | forwarded unchanged, but the actual increment values were not measured. |
| 5445 | - Texture creation ABI and the `0x101` value are known; the tiled data layout, detile path and DCC remain | 5463 | - Texture creation ABI and the `0x101` value are known; the tiled data layout, detile path and DCC remain |
| @@ -5491,11 +5509,11 @@ nothing is copied from their trees. | |||
| 5491 | | # | Question | How to resolve | | 5509 | | # | Question | How to resolve | |
| 5492 | |---|---|---| | 5510 | |---|---|---| |
| 5493 | | 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. | | 5511 | | 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. | |
| 5494 | | 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. | | 5512 | | 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. | |
| 5495 | | 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. | | 5513 | | 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. | |
| 5496 | | 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. | | 5514 | | 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. | |
| 5497 | | 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. | | 5515 | | 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. | |
| 5498 | | 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. | | 5516 | | 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. | |
| 5499 | | 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. | | 5517 | | 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. | |
| 5500 | | 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). | | 5518 | | 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). | |
| 5501 | | 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. | | 5519 | | 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/design.md b/docs/design.md index d11c33206..fbc5ade1b 100644 --- a/docs/design.md +++ b/docs/design.md | |||
| @@ -495,7 +495,7 @@ How the generated SPIR-V expects the runtime to work: | |||
| 495 | | 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.** | | 495 | | 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.** | |
| 496 | | `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`. | | 496 | | `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`. | |
| 497 | | `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`. | | 497 | | `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`. | |
| 498 | | `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. | | 498 | | `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. | |
| 499 | | 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). | | 499 | | 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). | |
| 500 | | `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`). | | 500 | | `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`). | |
| 501 | | `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.** | | 501 | | `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/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 | |||
| 3 | How to use Microsoft's **public** GDK documentation and headers to implement the console APIs the game imports, | ||
| 4 | without copying Microsoft's files and without touching anything under NDA. A convention for contributors, not a | ||
| 5 | measurement. | ||
| 6 | |||
| 7 | ## The rule in one line | ||
| 8 | |||
| 9 | Read the public PC GDK reference and headers, then write in your own words only what a shim needs: names, values, | ||
| 10 | signatures 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 | |||
| 33 | 1. **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. | ||
| 38 | 2. **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. | ||
| 41 | 3. **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. | ||
| 44 | 4. **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/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 | |||
| 3 | The 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 | |||
| 5 | No 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 | |||
| 20 | The 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 | |||
| 24 | These 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 | |||
| 41 | The 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 | |||
| 55 | Each 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 | |||
| 77 | Two 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 | ||
| 79 | runs" 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 | |||
| 89 | Both 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 | ||
| 91 | heap 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 | ||
| 93 | host comparison in the test, which is what #1389 does. | ||
| 94 | |||
| 95 | The `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, | ||
| 99 | alignment 1024), finds no host-transfer memory type for it and the placed import fails; #1894 stages that upload. The | ||
| 100 | sub-page host buffer imports named above for this test ([#1458](https://github.com/ubiquitarianism/leonida/pull/1458)) | ||
| 101 | are a different path and are still open. | ||
| 102 | |||
| 103 | ## What follows | ||
| 104 | |||
| 105 | The 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)). | ||