WIP: feat(d3d12): a Direct3D 12 back end beside Vulkan, chosen with RX_D3D12=1 #2040

Draft
nyannoying wants to merge 212 commits from nyannoying/Longshot:feat/d3d12-renderer into main
Contributor

Summary

Longshot draws with Vulkan only. This adds a second renderer, longshot_d3d12.dll: a Direct3D 12 back end behind the
same seam as longshot_vk.dll (MkwVkHost and MkwVkRenderer in gpu/vk/vk_api.h). Vulkan stays the default.
RX_D3D12=1 (or HOS_D3D12=1) starts the D3D12 one; Vulkan starts instead when its DLL is missing or doesn't start
(host/rx_backend.c). It is for Windows, Intel Arc first: there D3D12 is what the driver and Intel's tools are made for,
and XeSS frame generation and XeLL exist only on D3D12.

Where it stands, on an Arc B580 (driver 32.0.101.9175), Castle Town's market at a 2560x1440 output:

  • 13.69 ms a frame (73 fps), where Vulkan ran 12.62 ms (79 fps) with the same settings: 1.1 ms behind.
  • The whole game plays: the title, the saves, every area visited so far, the scenes between them. The picture is
    Vulkan's.
  • The player's settings and the Insert menu work as on Vulkan, rows D3D12 can't do hidden.
  • Intel XeSS (upscaling), XeSS Frame Generation (up to 3 frames between two) and XeLL, chosen in the menu.
  • The preparation (RX_D3D12_PREPARE=1): all of the game's shaders translated ahead of play, about 15 minutes on
    20 threads, a 5.2 GB cache; play afterwards translates a handful.

How it works, in short (docs/d3d12.md has the design and every measurement behind it):

  • Shaders: Eden's translator with a D3D12 profile, then Mesa's spirv_to_dxil to DXIL, on worker threads, kept in a
    program cache. Global loads read the guest page table where a draw's bindings allow (RX_D3D12_GP_TABLE=4: each
    program translated both ways, the draw choosing).
  • The replay: the game's command stream replayed on its own thread, its command list calls and descriptor writes
    made on a second one (the recorder).
  • Memory: the game's pools are opened in place; the pools draws read have VRAM mirrors; storage buffers the game's
    atomics write live in VRAM copies, compared back with a shadow.
  • Textures: ASTC decoded on the GPU with main's decoder; sampled textures in shared heaps.
  • Pipelines: made on the workers too, the driver's blobs kept in a pipeline store, so no draw waits for a pipeline an
    earlier run made.
  • Mesh programs: Eden's compute fallback, batched. Native mesh shaders are there (RX_D3D12_MESH_NATIVE=1), off:
    slower on the B580.
  • Building it: the Windows game build makes longshot_d3d12.dll beside the Vulkan back end and places Mesa's
    spirv_to_dxil.dll and its licenses with it. The DLL is in this PR, third_party/mesa-spirv-to-dxil/bin (10.4 MB, the
    bytes its PROVENANCE.md pins, checked by tests/test_d3d12_game_build.py), so no build tools change.
    python -I scripts/dev.py d3d12 builds the back end alone.

Read first: docs/d3d12.md §1 and §10.1, host/rx_backend.c, gpu/d3d12/d3d_api.cpp, then gpu/d3d12/d3d_draw.cpp.

Related: #1619 (an earlier build on an Intel Arc iGPU). #2362 put Mesa's DLL into the build tools' archive; this PR
carries the DLL itself instead, so #2362 is not needed. #2286 replaces the builder: this back end's build moves into it
once that lands (my comment there).

How to try it (testers)

You need Windows 10 or 11, a Direct3D 12 GPU with shader model 6.6, and current drivers. With a build of this branch:

  1. Copy your saves (the game folder's user folder) somewhere safe.
  2. Check that the game folder has longshot_d3d12.dll and spirv_to_dxil.dll beside longshot.exe.
  3. Make a text file longshot_env.txt in the game folder with the line RX_D3D12=1. Without the line, the game runs on
    Vulkan as always.
  4. Start the game. It runs on D3D12 when the newest file in logs has lines starting d3d12:.

Optional, to skip the stutters of first visits: add the line RX_D3D12_PREPARE=1. The shaders are translated while the
game runs, about 15 minutes on a 20-thread CPU (longer with fewer cores), the CPU busy all that time. The game folder's
cache grows to about 5.2 GB, so have 6 GB free. The log says d3d12: the preparation: done at the end. Then delete the
line; the cache stays.

What to expect, and what to report:

  • Without the preparation: stutters the first time in each place, and the very first load of a save can stop for half
    a minute (the game looks frozen: wait).
  • Report your GPU, driver and Windows version; whether it started; any crash, freeze or black screen, and where; anything
    that looks wrong next to Vulkan at the same spot; how smooth it felt next to Vulkan.
  • Please don't post logs, screenshots or videos: they are made from the game. Single log lines are fine.

Testing

Tested: Windows 11 (build 29704), Intel Arc B580, driver 32.0.101.9175, RX_D3D12=1, a 2560x1440 output:

  • This head's renderer (the rebase on f9fb7449 changed only main's audio files), 2026-11-23: 6 runs of a save's first load
    and Castle Town's market, 325 s each, no device removed, the market's picture as expected; 6 more for the search
    loop's A/B, no device removed.
  • Earlier heads over the last days: from the title into Kokiri Forest, Zora's River and the areas after it, and the
    market, again and again; the Insert menu, XeSS, XeSS-FG (1 to 3 frames) and XeLL; V-Sync On, Off and Auto.
  • The preparation: done in 880 s, 69,431 programs; the route after it translated 17 more.
  • After that run: checks brought up to date, one clang warning in the menu's XeSS-FG notes fixed (a string's
    parentheses), the Intel XeLL row's docs line, and Mesa's DLL moved into the repository (the same bytes the runs used).
    None changes what the game runs.
  • Checks: the full suite (run_all.py --no-skip, spirv-val on the path) at 6bf20189: 966 passed, 45 failed: 44 fail on
    main too; tests/test_coverage_run.py fails here in scripts/coverage/cover.py reading tasklist's
    output (this PC's code page; the branch doesn't change that code). At the head, the checks that read the Mesa commit's
    files (run_all.py --changed): 117 passed, the 12 failures all main's.

Still to test:

  • Windows, an NVIDIA GPU and an AMD GPU: HOS_D3D12=1, from the title into the game, expecting the picture as on
    Vulkan and no device removed (@Beanstalk)
  • Arc B580: hours of play over many areas, expecting no device removed and no crash (by hand: the author)

Measurements

Verdict: D3D12 is 1.1 ms a frame behind Vulkan in the market on the B580 (13.69 against 12.62 ms). Vulkan on this
branch is not measured against main yet: before ready.

Setup: Windows 11 build 29704, Arc B580, driver 32.0.101.9175; the player's settings (output 2560x1440, the main pass at
1920x1080, HDR, no upscaler, no frame generation, uncapped); Castle Town's market, the frame time over 195 to 315 s of a
run, the caches warm.

Before: main @ nightly 745 After: this PR @ HEAD
Market: Vulkan 12.62 ms (79.2 fps) to measure
Market: D3D12 (RX_D3D12=1) no D3D12 on main 13.69 ms (73.0 fps; 2 runs, 13.61 and 13.76)

Where D3D12's time goes (GPU timings, RX_D3D12_GPU_TIMES): 11.5 ms of GPU work a frame against Vulkan's 9.1. The mesh
fallback costs 1.2 ms (native mesh shaders are slower still on this GPU), the atomics' copies back 1.2 ms.

Switches: RX_D3D12 ships off, so Vulkan stays the default. The RX_D3D12_* rows in gpu/vk/switches.def give each
one's kind and default: the diagnostics off, the kill switches leaving their part on, the attempts off
(RX_D3D12_MESH_NATIVE, RX_D3D12_PREPARE, RX_D3D12_SSBO_LOOP: +1.5 % frame time in play), and the tuning ones at the
defaults docs/d3d12.md explains, measured.

Risks

  • Off by default. Without RX_D3D12=1 nothing changes for players: the host loads longshot_vk.dll as before.
  • Code Vulkan runs too: the translator (gpu/vk/eden, gpu/vk/sirit) gains D3D12-only options, all off for Vulkan;
    the emitter fixtures check that Vulkan's SPIR-V is unchanged.
  • With RX_D3D12=1: a heap corruption on a translation worker during a cold first load, seen once in more than 10 cold
    loads, cause not found; the first visits stutter without the preparation.
  • Known issue: with RX_D3D12_GP_TABLE=4 (the default), the window glass in Castle Town's market draws white instead
    of dark leaded glass (Vulkan is right). One graphics program reads a small buffer a compute dispatch wrote earlier in the
    frame through the guest page table, while the written copy is still live in VRAM, so it reads the pool's older bytes.
    RX_D3D12_GP_TABLE_DRAWS=1 draws it right but costs +25 % frame time in the market, so it is not the default; the fix
    belongs in the rule that picks table or search per draw, and comes in a later commit.
  • New third-party parts: third_party/directx-headers (MIT), dxc-api (NCSA), mesa-spirv-to-dxil (MIT),
    spirv-cross (Apache-2.0 and MIT), upstream copies with their PROVENANCE.md. Mesa's spirv_to_dxil.dll (MIT,
    mesa-dist-win's 26.2.6 build) is the first DLL in the repository: 10.4 MB in its history, .gitignore letting this one
    file in. It goes beside the game with its licenses. DXC's DLLs are only for the native mesh shaders, off, and never shipped.
  • #2286: it deletes nx2/build.py and make_game.py, where this back end's game build lives; that part moves into
    longshot-build after it lands.
  • Turning it off: unset RX_D3D12. A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (rebased on f9fb7449, 2026-11-23)
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (the full suite as Testing says: no
    failure main lacks but tests/test_coverage_run.py, this PC's code page in code the branch doesn't change)
  • Measured against main, or Measurements says why there is nothing to measure. (this branch's Vulkan against main's:
    before ready)
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.
    (four new parts, upstream copies with their notes, Mesa's DLL as its release built it; the existing parts untouched,
    scripts/check_third_party.py passes)

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • The SPIR-V headers regenerated (a shader changed).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run; Linux: CI's build,
    the host change being Windows-only)
  • Screenshots of the same spot on main and here, for a change that shows on screen. (none for now: the author's
    call)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Longshot draws with Vulkan only. This adds a second renderer, `longshot_d3d12.dll`: a Direct3D 12 back end behind the same seam as `longshot_vk.dll` (`MkwVkHost` and `MkwVkRenderer` in `gpu/vk/vk_api.h`). Vulkan stays the default. `RX_D3D12=1` (or `HOS_D3D12=1`) starts the D3D12 one; Vulkan starts instead when its DLL is missing or doesn't start (`host/rx_backend.c`). It is for Windows, Intel Arc first: there D3D12 is what the driver and Intel's tools are made for, and XeSS frame generation and XeLL exist only on D3D12. Where it stands, on an Arc B580 (driver 32.0.101.9175), Castle Town's market at a 2560x1440 output: - **13.69 ms a frame (73 fps)**, where Vulkan ran 12.62 ms (79 fps) with the same settings: 1.1 ms behind. - The whole game plays: the title, the saves, every area visited so far, the scenes between them. The picture is Vulkan's. - The player's settings and the **Insert menu** work as on Vulkan, rows D3D12 can't do hidden. - **Intel XeSS** (upscaling), **XeSS Frame Generation** (up to 3 frames between two) and **XeLL**, chosen in the menu. - **The preparation** (`RX_D3D12_PREPARE=1`): all of the game's shaders translated ahead of play, about 15 minutes on 20 threads, a 5.2 GB cache; play afterwards translates a handful. How it works, in short (`docs/d3d12.md` has the design and every measurement behind it): - **Shaders:** Eden's translator with a D3D12 profile, then Mesa's `spirv_to_dxil` to DXIL, on worker threads, kept in a program cache. Global loads read the guest page table where a draw's bindings allow (`RX_D3D12_GP_TABLE=4`: each program translated both ways, the draw choosing). - **The replay:** the game's command stream replayed on its own thread, its command list calls and descriptor writes made on a second one (the recorder). - **Memory:** the game's pools are opened in place; the pools draws read have VRAM mirrors; storage buffers the game's atomics write live in VRAM copies, compared back with a shadow. - **Textures:** ASTC decoded on the GPU with main's decoder; sampled textures in shared heaps. - **Pipelines:** made on the workers too, the driver's blobs kept in a pipeline store, so no draw waits for a pipeline an earlier run made. - **Mesh programs:** Eden's compute fallback, batched. Native mesh shaders are there (`RX_D3D12_MESH_NATIVE=1`), off: slower on the B580. - **Building it:** the Windows game build makes `longshot_d3d12.dll` beside the Vulkan back end and places Mesa's `spirv_to_dxil.dll` and its licenses with it. The DLL is in this PR, `third_party/mesa-spirv-to-dxil/bin` (10.4 MB, the bytes its `PROVENANCE.md` pins, checked by `tests/test_d3d12_game_build.py`), so no build tools change. `python -I scripts/dev.py d3d12` builds the back end alone. Read first: `docs/d3d12.md` §1 and §10.1, `host/rx_backend.c`, `gpu/d3d12/d3d_api.cpp`, then `gpu/d3d12/d3d_draw.cpp`. Related: #1619 (an earlier build on an Intel Arc iGPU). #2362 put Mesa's DLL into the build tools' archive; this PR carries the DLL itself instead, so #2362 is not needed. #2286 replaces the builder: this back end's build moves into it once that lands (my comment there). ## How to try it (testers) You need Windows 10 or 11, a Direct3D 12 GPU with shader model 6.6, and current drivers. With a build of this branch: 1. Copy your saves (the game folder's `user` folder) somewhere safe. 2. Check that the game folder has `longshot_d3d12.dll` and `spirv_to_dxil.dll` beside `longshot.exe`. 3. Make a text file `longshot_env.txt` in the game folder with the line `RX_D3D12=1`. Without the line, the game runs on Vulkan as always. 4. Start the game. It runs on D3D12 when the newest file in `logs` has lines starting `d3d12:`. Optional, to skip the stutters of first visits: add the line `RX_D3D12_PREPARE=1`. The shaders are translated while the game runs, about 15 minutes on a 20-thread CPU (longer with fewer cores), the CPU busy all that time. The game folder's `cache` grows to about 5.2 GB, so have 6 GB free. The log says `d3d12: the preparation: done` at the end. Then delete the line; the cache stays. What to expect, and what to report: - Without the preparation: stutters the first time in each place, and the very first load of a save can stop for half a minute (the game looks frozen: wait). - Report your GPU, driver and Windows version; whether it started; any crash, freeze or black screen, and where; anything that looks wrong next to Vulkan at the same spot; how smooth it felt next to Vulkan. - Please don't post logs, screenshots or videos: they are made from the game. Single log lines are fine. ## Testing **Tested:** Windows 11 (build 29704), Intel Arc B580, driver 32.0.101.9175, `RX_D3D12=1`, a 2560x1440 output: - This head's renderer (the rebase on f9fb7449 changed only main's audio files), 2026-11-23: 6 runs of a save's first load and Castle Town's market, 325 s each, no device removed, the market's picture as expected; 6 more for the search loop's A/B, no device removed. - Earlier heads over the last days: from the title into Kokiri Forest, Zora's River and the areas after it, and the market, again and again; the Insert menu, XeSS, XeSS-FG (1 to 3 frames) and XeLL; V-Sync On, Off and Auto. - The preparation: done in 880 s, 69,431 programs; the route after it translated 17 more. - After that run: checks brought up to date, one clang warning in the menu's XeSS-FG notes fixed (a string's parentheses), the Intel XeLL row's docs line, and Mesa's DLL moved into the repository (the same bytes the runs used). None changes what the game runs. - Checks: the full suite (`run_all.py --no-skip`, spirv-val on the path) at 6bf20189: 966 passed, 45 failed: 44 fail on main too; `tests/test_coverage_run.py` fails here in `scripts/coverage/cover.py` reading `tasklist`'s output (this PC's code page; the branch doesn't change that code). At the head, the checks that read the Mesa commit's files (`run_all.py --changed`): 117 passed, the 12 failures all main's. **Still to test:** - Windows, an NVIDIA GPU and an AMD GPU: `HOS_D3D12=1`, from the title into the game, expecting the picture as on Vulkan and no device removed (`@Beanstalk`) - Arc B580: hours of play over many areas, expecting no device removed and no crash (by hand: the author) ## Measurements **Verdict:** D3D12 is 1.1 ms a frame behind Vulkan in the market on the B580 (13.69 against 12.62 ms). Vulkan on this branch is not measured against main yet: before ready. Setup: Windows 11 build 29704, Arc B580, driver 32.0.101.9175; the player's settings (output 2560x1440, the main pass at 1920x1080, HDR, no upscaler, no frame generation, uncapped); Castle Town's market, the frame time over 195 to 315 s of a run, the caches warm. | | Before: main @ nightly 745 | After: this PR @ HEAD | |---|---|---| | Market: Vulkan | 12.62 ms (79.2 fps) | to measure | | Market: D3D12 (`RX_D3D12=1`) | no D3D12 on main | 13.69 ms (73.0 fps; 2 runs, 13.61 and 13.76) | Where D3D12's time goes (GPU timings, `RX_D3D12_GPU_TIMES`): 11.5 ms of GPU work a frame against Vulkan's 9.1. The mesh fallback costs 1.2 ms (native mesh shaders are slower still on this GPU), the atomics' copies back 1.2 ms. Switches: `RX_D3D12` ships off, so Vulkan stays the default. The `RX_D3D12_*` rows in `gpu/vk/switches.def` give each one's kind and default: the diagnostics off, the kill switches leaving their part on, the attempts off (`RX_D3D12_MESH_NATIVE`, `RX_D3D12_PREPARE`, `RX_D3D12_SSBO_LOOP`: +1.5 % frame time in play), and the tuning ones at the defaults `docs/d3d12.md` explains, measured. ## Risks - **Off by default.** Without `RX_D3D12=1` nothing changes for players: the host loads `longshot_vk.dll` as before. - **Code Vulkan runs too:** the translator (`gpu/vk/eden`, `gpu/vk/sirit`) gains D3D12-only options, all off for Vulkan; the emitter fixtures check that Vulkan's SPIR-V is unchanged. - **With `RX_D3D12=1`:** a heap corruption on a translation worker during a cold first load, seen once in more than 10 cold loads, cause not found; the first visits stutter without the preparation. - **Known issue:** with `RX_D3D12_GP_TABLE=4` (the default), the window glass in Castle Town's market draws white instead of dark leaded glass (Vulkan is right). One graphics program reads a small buffer a compute dispatch wrote earlier in the frame through the guest page table, while the written copy is still live in VRAM, so it reads the pool's older bytes. `RX_D3D12_GP_TABLE_DRAWS=1` draws it right but costs +25 % frame time in the market, so it is not the default; the fix belongs in the rule that picks table or search per draw, and comes in a later commit. - **New third-party parts:** `third_party/directx-headers` (MIT), `dxc-api` (NCSA), `mesa-spirv-to-dxil` (MIT), `spirv-cross` (Apache-2.0 and MIT), upstream copies with their `PROVENANCE.md`. Mesa's `spirv_to_dxil.dll` (MIT, mesa-dist-win's 26.2.6 build) is the first DLL in the repository: 10.4 MB in its history, `.gitignore` letting this one file in. It goes beside the game with its licenses. DXC's DLLs are only for the native mesh shaders, off, and never shipped. - **#2286:** it deletes `nx2/build.py` and `make_game.py`, where this back end's game build lives; that part moves into `longshot-build` after it lands. - **Turning it off:** unset `RX_D3D12`. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. (rebased on f9fb7449, 2026-11-23) - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (the full suite as Testing says: no failure main lacks but `tests/test_coverage_run.py`, this PC's code page in code the branch doesn't change) - [ ] Measured against `main`, or Measurements says why there is nothing to measure. (this branch's Vulkan against main's: before ready) - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. (four new parts, upstream copies with their notes, Mesa's DLL as its release built it; the existing parts untouched, `scripts/check_third_party.py` passes) ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] The SPIR-V headers regenerated (a shader changed). - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run; Linux: CI's build, the host change being Windows-only) - [ ] Screenshots of the same spot on `main` and here, for a change that shows on screen. (none for now: the author's call) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gpu/d3d12/bench measures the D3D12 back end's shader-route choice on this PC: a sample of programs from the
Vulkan back end's program cache (progcache.py), their SPIR-V turned into DXIL by Mesa's spirv_to_dxil (signed with
DXC's dxil.dll) and by SPIRV-Cross + DXC, then each stage in a pipeline of its own on the GPU, timed (dxbench.cpp).
run.py goes on past a crash or a hang at a job; summarize.py prints success, reasons and times per route and stage.

Everything it reads and writes is made from the game and stays on the PC; nothing of it is in this commit.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/d3d12.md plans longshot_d3d12.dll, a second back end behind the seam that Vulkan keeps: modules, shader path,
binding model, memory, sync, mesh path, present and upscalers, milestones.

The shader route is Mesa's spirv_to_dxil over Eden's SPIR-V, measured with gpu/d3d12/bench on an Arc B580: 131 of
140 sampled non-mesh stages became DXIL and every one built a pipeline; SPIRV-Cross + DXC managed 9 of 167. Mesh
programs take Eden's compute fallback first. DXC takes [WaveSize] on compute only (checked), so the D3D12 profile
emits warp ops defined at 16 lanes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
longshot_d3d12.dll fills the renderer table the Vulkan back end fills (gpu/vk/vk_api.h) and host/rx_backend.c starts
it in place of Vulkan with RX_D3D12=1, falling back to Vulkan when it is missing or does not start.

- A device on the high-performance adapter, one direct queue and its timeline, DRED always, and the D3D12 debug
  layer with RX_D3D12_DEBUG (2: GPU-based validation).
- The op stream replayed on the submitting thread, as Vulkan's RX_VK_ASYNC=0: a queue whose event wait does not hold
  stops there and goes on as Vulkan's does; event signals, buffer updates, copies and fills reach memory once the GPU
  passed the work before them, in fence order; counter reports and render conditions in stream order.
- Render targets and their clears, a flip-model swapchain the presented picture is copied into, and the control
  bridge's frame counts and shots (a PNG writer of its own for now).
- ReadTexels and WriteTexels as Vulkan's CPU copies.
- scripts/dev_build.py d3d12 builds the DLL alone (gpu/d3d12/build.py) and checks its export.

Draws come in M2. Not yet run in the game.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
llvm-mingw's d3d12.h stops at ID3D12Device9. The back end needs ID3D12Device13's OpenExistingHeapFromAddress1
(guest memory opened in place), enhanced barriers and the GPU upload heap (docs/d3d12.md). Kept: d3d12.h,
d3d12sdklayers.h, d3dcommon.h, dxgicommon.h, dxgiformat.h and dxguids/dxguids.h, with the licence: the tag's
archive's files with LF line endings for its CRLF (PROVENANCE.md names the archive's SHA-256 and the blob ids
with CRLF put back).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first runs of the game on longshot_d3d12.dll (RX_D3D12=1, the debug layer on): it boots through its logo to the
title menu in 27 s and presents at 240 fps, with no device loss and no debug-layer messages. A at the title starts
the load into the game, which does not finish without the draws and dispatches (M2).

- The control bridge gets the draws recorded (frame_info), drawn or not, so its state follows the game: intro at
  2 draws a frame, menu at 16. It stayed at intro with 0.
- A present or a long fence wait drains the stopped queues as the Vulkan back end's drain does: the waits that
  hold first, then the oldest submit past its wait, and again. They were all forced at once, in the map's order.
- Built against third_party/directx-headers in place of llvm-mingw's d3d12.h (the struct-returning methods
  through cpu_start, gpu_start and desc_of under MinGW).
- The debug layer's speed hints for clears to another value than the optimized one (820, 821; over 1000 in two
  minutes) and its note on CheckFeatureSupport (989) are not stored.

Tested in the game: Intel Arc B580, driver 32.0.101.9175, Windows 11 build 29704, a base of 544229a2 with this
branch's host; three runs through the control bridge.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gpu/d3d12/bench/dxprobe.cpp asks this PC's GPU and OS runtime what docs/d3d12.md left to M1. It reads nothing from the
game. On the B580, driver 32.0.101.9175, runtime 6.2.29704:

- The BYPASS hash: DXIL nothing validated (dxc -Vd), its hash set to sixteen 0x01 bytes, makes a compute pipeline
  that runs right. A zero hash and sixteen 0x02 bytes are refused. spirv_to_dxil's DXIL needs no dxil.dll.
- OpenExistingHeapFromAddress1 on a committed part of a 4 GB reserve, as the host's guest window: a CUSTOM heap
  (write-back, system memory, shader atomics allowed) with a placed buffer when the start is 64 KB aligned. A 4 KB
  start opens but takes no buffer, and a range reaching reserved pages is refused. Words go both ways intact;
  copies run at 10.3 GB/s into VRAM and 11.0 GB/s out; 256 MB opens in 7-27 ms, 1 GB in 30-107 ms.

The plan's sections 1, 3.5, 5 and 11 say so.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gpu/d3d12/build.py compiles Eden's shader recompiler and sirit (163 files) into longshot_d3d12.dll with the Vulkan back
end's third-party flags and include order (nx2/build.py vk_sources, tp_vflags), to objects of their own in obj/tp. An
object depends on its headers and on a file of its flags, not on the script: an edit that leaves the translator's flags
alone compiles none of its files again. The SPIR-V headers come from RX_CPM (--cpm), as for the Vulkan back end.

third_party/mesa-spirv-to-dxil: Mesa's spirv_to_dxil.h and dxil_versions.h (MIT), tag mesa-26.2.6, unmodified. The back
end loads spirv_to_dxil.dll at run time; nothing of Mesa's is linked.

A cold build here: 168 files in 25 s, 3.9 MB, no symbol missing.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
M2, step 2 (docs/d3d12.md section 3). d3d_shader.cpp reads a bound NVN2
program and lowers it to Maxwell as the Vulkan back end does, translates
it with Eden's recompiler and a D3D12 profile, gives each descriptor a
register of its own class (none overlapping: an array takes as many as it
has elements), then makes DXIL with Mesa's spirv_to_dxil, loaded at run
time, its hash the BYPASS value. The DXIL's own resource list (PSV0) is
checked against the registers given; the vertex stage's generic outputs
the fragment stage does not read are left out of both, so the two
signatures declare the same varyings.

d3d_bank.cpp is vk_bank.cpp's texture and sampler registrations and
driver constant banks; d3d_memory.cpp the pool table. The device keeps
what the translation may use (Device::caps). Nothing calls it yet: the
draws come next.

New switches: RX_D3D12_MESA, RX_D3D12_DUMP_SPV, RX_D3D12_LOG_SIGS.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
M2's step 3 (docs/d3d12.md, sections 4 and 10): the replay keeps the op stream's
bindings and fixed-function state, and its draws, dispatches and barriers reach
the device.

- d3d_replay.cpp: the state ops as the Vulkan replay reads them, and NOP_DRAW,
  NOP_DRAW_IDX, NOP_DISPATCH and NOP_BARRIER to d3d_draw.cpp. Indirect and mesh
  draws are counted as left out (M3).
- d3d_draw.cpp: one root signature for graphics and one for compute (the push
  block and Mesa's runtime data as root constants, then per stage a table per
  register class); a 256 MB upload ring for constant, vertex and index buffers;
  a ring of shader-visible views; sampler tables shared by content; pipelines
  cached by the program and the fixed-function state. Quads, polygons, fans and
  line loops get index lists made on the CPU, 8-bit indices are widened. A draw
  takes everything from the rings before it records, and takes it again when a
  full ring sent the open list to the GPU on the way.
- d3d_pipeline.cpp: the NVN state as D3D12's blend, rasterizer, depth-stencil,
  input layout and samplers (Vulkan's build_graphics and sampler_make).
- d3d_memory.cpp: the uniform buffer updates the GPU's timeline has not written
  yet, on top of guest memory for the draws' copies.
- Registers: each class in a space of its own. Mesa's spirv_to_dxil
  (mesa-26.2.6) crashed on a vertex stage with a uniform buffer and a storage
  buffer at one set and binding, as registers of two classes from 0 are
  (reproduced outside the game with the bench, and gone with either moved).
- Heap indexing allowed, view slot 0 a null raw UAV: Mesa lowers a SPIR-V
  pointer to ResourceDescriptorHeap[address >> 32]; Eden's guest pages pointer
  is 0 for now, and its shaders skip those reads while it is.

Textures and texel buffers are still null views (step 4). In the game on the
B580 (Windows 11, driver 32.0.101.9175, debug layer on): the title menu at about
230 fps, 16 draws a frame, no crash, no pipeline refused, every vertex and
fragment stage linked; the picture is black while nothing is sampled.

Checks: python -I -B tests/run_all.py with llvm-mingw on PATH, 618 passed,
50 failed; none of the failures reads a file this branch changes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The D3D12 back end now draws the title screen on the B580: the movie, the logo
and the menu's entries, at 230-240 fps.

- Textures: sampled textures are uploaded from guest memory (ASTC decoded,
  three-component formats widened) and again when the CPU writes them. Those
  in virtual pools are checked page by page through their mapping. A texture
  the GPU copied into after the render targets at its address is current.
- Render targets are bound through the game's views of them (format and
  layers): an sRGB view of a UNORM target encodes what is drawn, which the
  final picture needs. Colour targets of one sample are storage images too.
- Texture copies run on the GPU: buffer to texture, texture to texture and
  multisample resolves (the movie's frames arrive as buffer copies).
- Storage buffers: raw UAVs of snapshots of the guest memory they name, in a
  ring in the GPU upload heap. The menu's vertex stages read their transforms
  through them; without them every quad collapsed to a point.
- The movie's upscale network does not translate (cooperative matrices): a
  linear upscale of its input stands in, as the Vulkan back end's stand-in
  (RX_D3D12_NO_UPSCALE_STUB=1 leaves it out).
- Diagnostics: RX_D3D12_LOG_DRAWS=<present> logs one frame's draws and
  dispatches with what they bind and why one is left out; RX_D3D12_IR=<folder>
  writes each translated stage's IR.

Checks: python -I -B tests/run_all.py --changed: 49 pass, 41 skipped; the 7
failures are tools missing on this PC (a C compiler, lz4) and two already on
main. tests/test_switch_table.py: only main's RX_VK_PGO_FILE row.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The D3D12 back end now loads a save into play on the B580 and draws the sky,
the far scenery and the HUD in the right colours. The world's near geometry
and its shadows are still missing: they are mesh draws (next).

- The gameplay upscale network does not translate either (its matrix
  multiplies). Its output, an R11G11B10F image, takes the Vulkan back end's
  gameplay stand-in (shaders/taau_upscale.comp: FXAA on the network's input,
  squared back from its square-root encoding), with no history bound. Without
  it the frame's whole 3D picture stayed black. The movie keeps its linear one.
- D3D12 has no RGB9E5 UAV: a storage image of it is kept as R11G11B10F (as the
  Vulkan back end keeps it in a B10G11R11 image), and what samples it as
  RGB9E5 then reads that. The network's input was a null view before.
- ASTC is decoded on the worker pool (the decoder's own parallel path): the
  load into play spent 24 s decoding on one thread, now 2.3 s.
- Diagnostics: every 5 s that had new programs or pipelines, or a second of
  replay, one line says where the replay's time went (translation, pipelines,
  ring waits, storage snapshots, uploads, ASTC) and what it replayed (draws,
  dispatches, mesh and indirect draws, left out). Translations and pipelines
  over 250 ms are logged. The draw log also logs the targets, clears, copies,
  and the presented texture; RX_D3D12_LOG_DRAWS_BUSY=<draws> takes the frame
  five presents after the first one with that many draws, and
  RX_D3D12_LOG_DRAWS_MAX sets how many it logs.

Measured at the save (hedge scene): 3-4 fps; about 2,000 draws a frame, 90 of
them mesh draws; the replay is busy 97% of the time, 60% of it copying storage
buffer snapshots (15,000 a second). Most of the load stall is translation
(about 19 s each run: there is no cache yet) and pipelines made the first time
(34 s; the driver's cache keeps them for the next run).

Checks: python -I -B tests/run_all.py --changed main: 576 pass, 98 skipped;
none of the 47 failures reads a changed file but tests/test_switch_table.py,
whose only complaint is main's RX_VK_PGO_FILE row.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Storage buffers no longer copy guest memory at each draw: the game's memory
pools are opened in place, and the dispatches whose group counts a GPU pass
writes now run.

- Each memory pool the game makes is opened as a D3D12 heap where it is
  (ID3D12Device13::OpenExistingHeapFromAddress1, rounded out to 64 KB, its
  reserved pages committed first), with one buffer placed over all of it.
  A storage buffer in a pool is a raw UAV into that buffer: its loads read
  memory as it is when the GPU runs, and its stores land in guest memory.
  guest_imported says so for those ranges, so the host keeps their pages.
  It takes the GPU addresses below 1 TB, where a pool's is its guest address.
  RX_D3D12_NO_INPLACE=1 keeps the copies, for A/B tests.
- Buffers' states are tracked per command list: a pool's buffer decays to
  COMMON when its list has run, its first use promotes it, and a later use
  another way takes a transition.
- NOP_DISPATCH_INDIRECT: the three group counts are copied from the pool on
  the GPU, twice, into a slot that a command signature reads (the runtime
  data's counts, then the dispatch), so what an earlier pass wrote is what
  runs. They were left out before.
- Cube maps and cube map arrays bind as colour targets (their level 0).

Measured at the save (hedge scene), 5 s windows: 3.6 fps before, 4.9 after.
Storage copies went from 76,000 (3.2 s of replay, 30 GB) to 850 (85 ms);
84,000 storage buffers in place take 20 ms. The replay now waits for the GPU
(ring space: 3.7 s of 5), so the GPU's time is next. Draws and dispatches
left out: 2,610 before the indirect dispatches, 2,255 after. The world's near
geometry is still missing: it is mesh draws (next).

Checks: python -I -B tests/run_all.py --changed main: 577 pass, 98 skipped;
none of the 46 failures reads a changed file but tests/test_switch_table.py,
whose only complaint is main's RX_VK_PGO_FILE row.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The world's near geometry draws, and the lighting's froxel volumes are
bound: the hedge scene is no longer black.

- NOP_DRAW_MESH runs the mesh program as the Vulkan back end does on a GPU
  without mesh shaders (Eden's compute fallback, docs/d3d12.md section 7):
  the task stage (if any) and the mesh stage as compute dispatches that write
  their outputs to a 64 MB records buffer, a record a primitive corner, then
  a vertex stage made for the program draws them with an indirect draw, a
  vertex a record. The stages reach the records and the payloads through
  pointers in the push block (Mesa's: a heap index above a byte offset), to
  views at fixed heap slots. D3D12 reads no buffer as indirect arguments
  while a view of it is in use, so the header's counts are copied into the
  indirect ring before each ExecuteIndirect. Direct mesh draws and indirect
  ones ({count, first} where a GPU pass wrote them, in a pool opened in
  place) run; those with a draw count stay out, as Vulkan's fallback leaves
  them. RX_D3D12_NO_MESH=1 leaves mesh draws out, for A/B tests.
- An indirect dispatch's pool is back in UNORDERED_ACCESS once its group
  counts are copied out (it stayed in COPY_SOURCE while the shader used its
  storage buffers).
- Points: D3D12 draws a point as a pixel, with no sprite coordinate. Mesa's
  spirv_to_dxil made PointCoord a varying no vertex stage writes, and 3
  pipelines did not link (E_INVALIDARG; the debug layer's vertex-pixel
  linkage error). Eden's profile gains has_no_point_coord (off for Vulkan):
  no PointCoord input, and its reads are the pixel's centre, (0.5, 0.5).
- 3D storage images: a 3D texture a compute pass stores to is a 3D render
  target (UAV, RTV and SRV of its slices). The lighting's froxel volumes
  were not bound, and the scene came out black behind the fog.

Measured at the save (hedge scene): 52 mesh draws a frame, all drawn; 55
mesh programs translated, none failed; no pipeline fails and the debug layer
reports no error (RX_D3D12_DEBUG=1). Draws and dispatches left out in 5 s:
2,255 before, 413 after. 4.6 to 5.0 fps, as before: the replay waits on the
GPU. With RX_D3D12_NO_MESH=1 the scene is as black as before and the trees'
branches are gone. Still too dark: the 12288 x 12288 shadow map is a depth
texture no draw makes, left out (next).

Checks: python -I -B tests/run_all.py --changed main: 575 pass, 98 skipped.
46 of the 48 failures fail on the last commit too (tests/test_switch_table.py
only for main's RX_VK_PGO_FILE row). Of the other two,
tests/test_longshot_ctl.py passes alone, and tests/test_coverage_run.py fails
in scripts/coverage/cover.py, which this does not touch.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The gameplay frame at the save is lit: the upscaler's input was a fifth as
bright as Vulkan's, and the queues stopped at a wait were made to go on
before the game signalled them. What still draws black (the opaque lit
surfaces: NaNs from vertex normals read as zeros) is the next commit.

- Sync (docs/d3d12.md section 6): a present that comes while a queue is
  stopped at a wait for an event is held up to 50 ms for the game's signal
  (RX_D3D12_HOLD_MS) before that queue is made to go on. A fence wait makes
  stopped queues go on only when the fence needs their work (after 3 ms).
  Past 50 ms a stopped queue is made to go on unless a thread of the game's
  waits for the GPU on other work (up to RX_D3D12_HOLD_GPU_MS, 1000 ms).
- Castable targets: R11G11B10F and RGBA8 render targets that take storage
  are made with relaxed format casting (CreateCommittedResource3, a cast
  list, COMMON layout) and are also viewed as R32_UINT and RGB9E5, for the
  32-bit integer stores the game makes over them. Those stores were left
  out, and the frame was a fifth as bright (mean luma 18, then 68).
  RX_D3D12_NO_CASTING=1 makes them as before.
- Depth textures no draw made (the 12288 x 12288 shadow map): D16 and D32F
  are uploaded as R16_UNORM and R32_FLOAT texels, as the Vulkan back end
  uploads them; states are tracked per level, layer and plane.
- Memory: guest memory's page table, through which Eden's shaders follow a
  pointer no bound buffer holds into the pools opened in place
  (RX_D3D12_NO_FOLLOW=1: none, as before). A dispatch whose atomics write a
  storage buffer of a pool opened in place (4 MB at most) runs on a copy in
  VRAM, copied from the pool before and back after, not across PCIe
  (RX_D3D12_NO_ATOMIC_BOUNCE=1: in place). A storage buffer table's bare
  pointer (no size word) is bound to its pool's end, as the Vulkan back end
  binds it.
- Tools (docs/d3d12-tools.md, next): RX_D3D12_GPU_TIMES (each pass's GPU
  time), RX_D3D12_MARKERS (PIX events for PIX, RenderDoc and DRED),
  RX_D3D12_PIX and RX_D3D12_RENDERDOC (a capture of the logged frame),
  RX_D3D12_DRED, RX_D3D12_DUMP_TARGETS and RX_D3D12_DUMP_AFTER (the logged
  frame's targets as DDS files, after chosen draws too), RX_D3D12_DUMP_DXIL,
  RX_D3D12_WATCH and RX_D3D12_WATCH_WRITES (which work changes memory),
  RX_D3D12_BLOCKS and RX_D3D12_PROBE (a shader's branches and values, by
  thread) and RX_D3D12_BLOCKS_NAN (the first NaN or infinity a fragment
  shader makes, by pixel: how the next commit's bug was found).
  RX_D3D12_LOG_DRAWS_BUSY takes N:after.

Measured at the save (hedge scene, 1920x1080): no wait for an event went
past without its signal (at presents, in fence waits, or held too long).

Checks: python -I -B tests/run_all.py --changed main: 578 pass, 98 skipped,
46 fail. None of the 46 reads a file this changes, except
tests/test_switch_table.py, which fails for main's RX_VK_PGO_FILE row (the
new rows pass it); the others fail on this PC for its tools (no Tooling
checkout beside this one, POSIX calls under llvm-mingw).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Walls, ground and characters at the save drew black: every lit opaque
surface's pixels were NaN, which the colour targets' NaN guard writes as 0.

Cause: the game stores those meshes' normals as NVN's RGB10A2SN, and D3D12
has no signed normalized 10:10:10:2 input format. The input layout read
such an attribute as the constant (0, 0, 0, 1); the vertex stage normalized
a normal of zeros (inversesqrt(0) * 0), and the pixel stage's first NaN
came from that normal (RX_D3D12_BLOCKS_NAN: one value, every pixel).

- The input layout reads the four fields as unsigned integers
  (DXGI_FORMAT_R10G10B10A2_UINT); without a buffer, as unsigned (0, 0, 0, 1).
- unpack_patch (d3d_shader.cpp) rewrites Eden's SPIR-V for the vertex stage:
  the attribute's variable becomes four 32-bit unsigned integers, and each
  load of a component (by a constant index, or the indexed load's dynamic
  one) becomes an unsigned load and the decode: the field sign-extended
  (10 bits for x, y and z, 2 for w), over 2^(bits-1) - 1, -1 at least, as
  Vulkan's A2B10G10R10_SNORM_PACK32 reads it. A stage that reads the
  attribute some other way is left as it was, and logged.
- The program key takes the decode, so a vertex stage reading another
  format at that location is a program of its own.

Measured at the save (1920x1080, 2560x1440 window): mean luma 102 against
the Vulkan back end's 100 at the same spot, 0 % black pixels (was black on
the walls, the ground and Link). No stage logged as left undecoded, no
pipeline failed; 10.8 to 11.7 fps (4.6 to 5.0 two commits back).

tests/test_d3d12_snorm_attributes.py: the patch, cut out of its source, on
vertex stages made as Eden makes them; every field's decode, by constant and
by dynamic index, against Vulkan's rule; a stage that loads the whole
attribute is refused and left as it was; the format, constant row, key and
call read from the sources. It fails on each of 7 mutations of the decode
(shift, clamp, arithmetic shift, w's width, the dynamic index's test, the
denominator, outputs at the same location). spirv-val checks the patched
module where it is installed (not on this PC).

Checks: python -I -B tests/run_all.py --changed main: as the commit before,
and tests/test_d3d12_snorm_attributes.py passes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/d3d12.md, for what the last commits built:
- Memory (section 5): the page table, built for the pools opened in
  place; a raw view's reach (2^27 words: a view per 512 MB of a pool, not
  per 4 GB); bare pointers bound to their pool's end; atomics bounced
  through VRAM.
- Sync (section 6): queues stopped at a wait held for the game's signal,
  by rule (at a present, in a fence wait, past 50 ms), with their
  switches. The M1 rules for stopped queues are this section's now.
- Textures (section 8): castable targets, depth textures no draw made,
  and the decode of 10:10:10:2 attributes.
- Milestones (section 10): what M3 adds, and what it does on the B580.

docs/d3d12-tools.md (new; switches.def's rows name it): which tool
answers what; the renderer's own diagnostics; Windows' debug layer (how
to install it, what it found here, what is left out and why); DRED; PIX
(what pixtool 2610.28 does and does not, and its limit: under its
capturer the pools are copies, so a capture is not the game's frame);
RenderDoc (set up, not run in the game yet); the shader and system tools;
and comparing a frame with the Vulkan back end's by guest address.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At the save a frame was the replay's recording on the game's submitting
thread, then the GPU's work, in turn: each submit's command list went to
the GPU only at the submit's end, and the game submits most of a frame
at once. The bounce ring (VRAM copies of the storage buffers a
dispatch's atomics write) also made the replay wait for the GPU twice a
frame: about 43 MB a frame went through 32 MB.

- send_if_long (d3d_draw.cpp, after each op the replay records): the open
  list goes to the GPU once it holds RX_D3D12_SEND_EVERY (128) draws and
  dispatches, so the GPU runs a long submit's first part while the rest
  is recorded. 0: at each submit's end only, as before.
- The bounce ring is 256 MB (was 32).
- The replay's 5-second line ends with the rings: what each handed out,
  its waits for the GPU and the sends of the open list it forced, and
  the sampler heap's resets (how the bounce ring's waits were found).
- docs/d3d12.md (sections 5, 6 and 10) and docs/d3d12-tools.md say so.

Measured at the save (hedge scene, 1920x1080 in a 2560x1440 window,
--mode timing, frames from 90 to 116 s; GPU from RX_D3D12_GPU_TIMES):

                          fps   replay, 5 s  GPU a frame  lists a frame
  before                 11.3   3545 ms      46.1 ms       5.0
  bounce ring 256 MB     11.8   2450 ms      45.5 ms       4.0
  + every 128 (default)  16.4   3313 ms      46.3 ms      15.8
  + every 32             16.3   3509 ms      46.4 ms      58.0
  + every 256            16.0   3183 ms      45.8 ms       9.3

The ring's waits went from 112 in 5 s (1.1 s) to none. Every 32 is no
faster than 128 and its longest replay run is 151 ms (128: 31 ms).
RX_D3D12_SEND_EVERY=0 measures as the 256 MB ring alone (11.8 fps).
The picture at the save is as before: mean luma 103 and 100 in two
shots (Vulkan: 100), no black pixels.

Next at the save: 46 ms of GPU work and 40 ms of replay a frame; the
replay copies about 177 MB of vertex and index data a frame into the
upload ring.

Checks: python -I -B tests/run_all.py --changed main: the 46 failures of
the commit before, and two more that fail on this PC's state and pass
alone or on another run (test_longshot_ctl.py, a relaunch's timing;
test_coverage_run.py, tasklist's German output with no game running).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A profile of the replay thread at the save (the host's HOS_SAMPLE_ALL,
named through the DLL's symbol table) had a quarter of its time in one
memcpy: the vertex streams copied into the upload ring. Each stream per
vertex was copied from its start to the last vertex the draw reads, and
the game draws from large buffers by their base vertex: 9.3 GB in 5 s
copied for 1.2 GB the draws read.

- stream_copy (d3d_draw.cpp): a stream per vertex from the first vertex
  the draw reads (its base plus its least index; read_indices finds it
  with the largest) to its last; one per instance from its start, as
  before.
- draw_one moves the draw's base back by that first vertex
  (BaseVertexLocation, StartVertexLocation), so each index reads its
  element. The vertex stage's index does not move: it is SV_VertexID,
  which no base moves, plus the runtime data's first vertex, the draw's
  base as before.
- ub_read takes no lock of its own: the uniform buffer updates it lays
  over memory are read and changed under replay_mu only. The lock had a
  tenth of the replay thread's samples, and 3 % of its time.

Measured at the save (hedge scene, 1920x1080 in a 2560x1440 window,
--mode timing, frames from 90 to 116 s):

                          fps   replay, 5 s   upload ring, 5 s  GPU a frame
  before                 16.4   3313 ms       14.5 GB            46.3 ms
  from the first vertex  18.6   2653-2698 ms   7.2 GB            45.0 ms
  + no lock in ub_read   18.6   2570-2587 ms   6.6 GB            45.5 ms

The picture is as before (mean luma 103 in the shot at 105 s, no black
pixels; the geometry whole). The frame is the GPU's now: 45 ms of GPU
work in a 54 ms frame, and the game's thread waits for the GPU about
15 ms a frame. Copying the storage a dispatch only reads into VRAM first
(an experiment, not kept) changed no dispatch's time.

tests/test_d3d12_vertex_copy.py: stream_copy, cut out of its source, on
20000 draws made up there (each index reads the same element in the copy
as in the stream, inside it), the bound size, kMaxCopy, instanced
streams and the edges; the wiring read from the sources. It fails on
each of 7 mutations of stream_copy.

docs: d3d12.md section 10's performance, d3d12-tools.md's CPU samples
(and what a lock's samples overstate).

Checks: python -I -B tests/run_all.py --changed main: the failures of the
commit before (test_coverage_run.py fails on this PC's German tasklist
output), and the new check passes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A dispatch whose atomics write a storage buffer runs on a copy in VRAM
(the bounce). Each copy went back to its pool after its dispatch: at the
save the same ranges were bounced up to 9 times in a row, about 38 MB
each way a frame, 12.4 ms of the GPU's 45.

The copy now stays live: the next dispatches that bounce the range, and
the storage buffers and indirect arguments inside it, use the copy. It
goes back when something could reach the pool there instead (a view or
indirect arguments over part of it, a stage with global memory that
binds no storage buffer holding all of it, the watches) and at the end
of the command list. 42 ms, 19.7 fps (18.5 with RX_D3D12_LIVE_BOUNCE=0
in the same build).

The dispatches whose atomics write 6 to 15 MB took 15 ms in place, and
under 1 on copies, for 11 ms more of copies: the cap goes from 4 to
16 MB (RX_D3D12_BOUNCE_CAP_MB). 37 to 38 ms, 20.4 to 21.9 fps between
compile stalls; the picture at the save as before (mean luma 98 to 100,
no black pixels).

The bounce's copies are timed passes of their own, and the replay's
rings line says what went back. tests/test_d3d12_live_bounce.py runs
LiveSet on random programs against a replay with no bounce; each of 15
mutations fails it. tests/run_all.py: no new failures.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At the save the game turns between 2 or 3 sets of the buffers its atomics
write: 55 ranges, 60 MB a frame, each bounced in one of the 3 frames before,
and of the 69 MB copied into VRAM a frame the CPU had written 0.12 MB since
the range's copy before. Sending fewer copies back early saved at most 1 ms.

A bounced range's copy now stays in VRAM after it goes back to its pool, as
the range's home (RX_D3D12_BOUNCE_HOMES, 256 MB; 0 keeps none). The next draw
or dispatch with a storage buffer inside the range makes it live again in
live_prepare, before its views are bound, with only the pages the CPU wrote
since copied in (memory_written_runs, from the page stamps of each submit's
start); a home no view wrote goes back with no copy. A storage buffer written
in place over part of a home gives it up; homes no frame took for 120 frames,
and those used least lately when the room runs out, give their VRAM back once
the GPU passed the last list that used them.

At the save (--mode timing): copies into VRAM 9.7 -> 0.27 ms a frame, GPU
38 -> 28.4 ms a frame, 24.4 to 26.8 fps between compile stalls (about 21
before; the Vulkan back end: 27.3). Picture as before (mean luma 99.6).

tests/test_d3d12_bounce_homes.py runs LiveSet, the homes and
memory_written_runs on random dispatches and two-stage draws between lists,
CPU writes and frames, against a replay with no copies. It found a home taken
while the views were bound, over part of a view bound to the pool before it;
homes are taken in live_prepare since. It fails on each of 14 mutations.
python -I -B tests/run_all.py: 580 passed, 47 failed as before this change
(the same environment checks, and switches.def's RX_VK_PGO_FILE row).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At the save, translation held play still for 38 s after loading, in every run: 527 programs, 33 s
of translation. gpu/d3d12/d3d_progcache.cpp keeps each program translate_into and
translate_mesh_into make in the game folder's cache/longshot_d3d12_programs.bin, and program_for
reads a key's records at the key's first want, each once.

- A record: each stage's DXIL, Eden's Shader::Info (as it lies, its containers written on their
  own), its registers and own constants, and the texture answers its variant was made for. It is
  read within its bytes: one cut short, damaged, or with a count past its bytes reads as none, and
  the program is translated again.
- The file's stamp (translator_stamp): the translator's sources (build.py shader_stamp, now with
  the back end's translation files and the cache's own), Mesa's version and DLL, what the
  translator is told of the GPU and the environment (the caps the profile reads, the depth mode,
  translator_init's settings, every RX_VK_ and EDEN_ switch), and the C++ library's layouts. A file
  of another stamp is started again; a record a run's end cut short is cut off.
- Off while a switch patches or dumps the translation (RX_D3D12_BLOCKS, PROBE, IR, DUMP_SPV,
  DUMP_DXIL), and with RX_D3D12_NO_PROGRAM_CACHE=1 (its row in switches.def).
- The replay's line counts the programs read from the cache.

Measured at the save, the cache empty and then full: the second run read 476 programs in 23 ms and
translated 1 (0.17 s). The 38 s standing still after loading became 10 s of slow frames (19 and
8 fps), the texture uploads (5.5 s, 4.6 of it ASTC decodes). After them 23.4 to 25.9 fps, as
before, and the same picture.

Checks: tests/test_d3d12_program_cache.py, new: the records against Eden's own shader_info.h
(random programs read back and written again to the same bytes; cut, longer and damaged records
behind a guard page; descriptor counts), the file (listed, read once, cut back after a run's end,
started again for another stamp, magic or layout), that Shader::Info's other members are plain
data, that every member of Stage and Program is kept, program_for's wiring and the stamp's inputs.
32 mutations of the cache, the stamp and their wiring all fail it. tests/test_switch_table.py
takes RX_VK_ as a prefix, as the Vulkan stamp's families. python -I -B tests/run_all.py: 581
passed, 47 failed, the 47 that failed before.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At a first visit to an area the replay stood still for 80 to 120 s: each translation and pipeline was made
where a draw first needed it, one at a time, and Mesa's DXIL was 93 % of a translation's time.

- d3d_jobs.cpp: RX_D3D12_WORKERS threads (half the CPU's, 8 at most, below the game's threads). A job runs
  once: on a worker, oldest first, or on the thread that waits for it while no worker has started it.
- A translation is split: Eden's front end stays on the replay's thread (it reads the bound state and guest
  memory), its SPIR-V and Mesa's DXIL go to a worker (translate_back), which then keeps the program in the
  cache. Pipelines are made on workers from copies of their descriptions.
- A draw whose program or pipeline is still being made is left out only by the Vulkan back end's rule
  (RX_VK_PIPE_SKIP=1): no stage writes memory and a target holds an earlier frame's picture. Every other
  draw, every dispatch and mesh draw waits. RX_D3D12_PIPE_SKIP=0 has every draw wait.
- The replay's line splits a translation's time (front end, SPIR-V, DXIL) and gives the waits and the
  draws left out.

Measured at the save with the program cache off: loading took 38.9 s instead of 46.5 s, and the first 5 s
after it ran at 27.8 fps instead of 12.8. The first 11 s did not change: dispatches wait for their compute
programs (5 s) and mesh programs are still translated on the replay's thread (2 s). The picture after
loading was right; no device removal.

tests/test_d3d12_workers.py builds d3d_jobs.cpp and runs it with 0, 1, 3 and 8 workers, runs
may_leave_out on made-up programs and targets, and reads the wiring from the sources; each of 8 seeded
breakages fails it. tests/run_all.py: no new failures (the 47 failing on this PC before fail as before).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At a first visit to the Deku Tree the replay still stood still for about 23 s after the workers: it
waited for the compute pipelines of mesh draws' task and mesh stages (about 7.5 s), and dispatches
waited for theirs (2 s each for two of them, made on the replay's thread when no worker had started
them yet). The Vulkan back end leaves those out while they are made; this does the same.

- Dispatches (the Vulkan back end's dispatch, RX_VK_COMPUTE_WAIT off): a dispatch's pipeline goes ahead
  of the jobs queued, and the dispatch that started it waits up to 50 ms for it, without making it on
  the replay's thread (job_wait_for). While it is made, the program's dispatches are left out.
  RX_D3D12_COMPUTE_WAIT=1 has every dispatch wait, as before. Translations are still waited for.
- Mesh draws (fallback_pipelines_ready): the task and mesh stages' pipelines are a dispatch's, and the
  draw is left out while they are made; its own pipeline follows the rule for draws.
- The depth hold (fallback_list_hold): a culled list's depth-only mesh draw is left out while its colour
  draw (the same indirect arguments) was left out in the last 120 presents, so the sky does not show
  through the grass. RX_D3D12_FALLBACK_DEPTH_HOLD=0 turns it off.
- The replay's line counts the dispatches and mesh draws left out.

Measured in the game at a first visit to Zora River (about 310 programs not in the cache), after
loading the save: two compute pipelines took 6.7 s and 3.7 s to make on the workers; the replay waited
0.2 s and 0.1 s for pipelines in those 5 s windows and left out 130 dispatches meanwhile, where the
Deku Tree's first visit before this change stopped for 2 s at each of two such pipelines. 241 mesh
draws were left out in the first 25 s. The arrival still held the replay for 7.8 s in one run: 1.7 s
of waits for graphics pipelines, 1.7 s of texture uploads (1.4 s of ASTC decodes in them), 1.5 s of
Eden's front end, and the mesh programs translated on the replay's thread. Then 21 fps there.

The device was removed about 15 s after walking on (DRED: a page fault in an indexed draw), as in a
walk before this change; no picture was checked, the shots came after it. That fault is next.

tests/test_d3d12_workers.py also runs the urgent lane and job_wait_for, runs compute_pipe_ready and
mesh_pipes_ready on jobs held on the workers, runs mesh_role and the hold, each with its switch both
ways, and reads the new wiring from the sources; each of 24 seeded breakages fails it.
tests/run_all.py: no new failures (the 47 failing on this PC before fail as before).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/test_d3d12_pool_open_race.py cuts open_pool, commit_reserved and inplace_covers (and
not_committed, where the source has it) out of gpu/d3d12/d3d_memory.cpp and runs them on a made-up
guest window of reserved and committed pages. What the game does while a heap is opened is modelled
in the stand-in for OpenExistingHeapFromAddress1, which takes the pages as they are then:

- the game frees a page of the pool's 64 KB rounding as it opens: no hole, the page zeroed;
- a free the host checked before the open decommits a page during it: no heap kept with a hole;
- a page decommitted at every open: no heap kept with a hole;
- a page freed in an open pool is zeroed, one outside every pool decommitted.

It fails here: a pool counts as covered only once it is open, so a page freed while it opens is
decommitted and the heap takes it as a hole (the debug layer's error 1112). The next commit fixes it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The game frees pages beside its pools as it makes them, on its own threads: host/hos_mem.c's
FreeMemoryPages asks the back end (inplace_covers) and decommits a page unless a pool opened in place
covers it. A pool counted only once it was open, so a page of its 64 KB rounding freed while
open_pool ran was decommitted after commit_reserved: the heap took it as a hole (the debug layer's
error 1112, "protection 0"), and a draw reading it later removed the device with a page fault (three
walks of three at Zora River, 15 to 40 s after walking on).

- open_pool notes the pool it opens (opening_lo, opening_hi) before it commits its pages, and
  inplace_covers counts it from then: a page the game frees meanwhile is zeroed, not decommitted.
- A free the host checked before that may still decommit a page after the commit: open_pool looks
  for pages not committed once the heap is open (not_committed), and opens it again over them, three
  times at most, never keeping a heap with a hole. Both are logged, 20 times each at most.

In the game, with the debug layer: no error 1112 since, and the faults 15 to 40 s after walking on
are gone. The device was still removed later on the same walk, by another page fault (next).

tests/test_d3d12_pool_open_race.py passes; each of 4 seeded breakages of the fix fails it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three fixes found walking to Zora's River on the B580, and the diagnostics that found them:

- Sampled textures are held to the Vulkan back end's VRAM budget (docs/d3d12.md 8.1, textures_frame;
  RX_D3D12_TEXTURE_BUDGET_MB). Unbounded, Zora's River took 17 GB of the 12 GB card's VRAM and ran at 12-15 fps; with the
  budget about 9.3 GB and 21-31 fps.
- A draw that samples the depth target it tests against binds a read-only view of it, the target in DEPTH_READ and a
  shader-resource state (8.2; RX_D3D12_NO_DEPTH_READ_ONLY=1 binds it writable as before).
- A queue stopped at a wait collects what the CPU wrote while it was stopped before it goes on (6;
  tests/test_d3d12_resume_collects.py): the bounce's homes and the textures kept the frame before's values.
- dxprobe freed: a heap opened in place over pages the host discards stays coherent (5, Freed pages).
- Diagnostics: a removed device's report names the operations around the first unfinished one in each list, the marks
  with what each draw binds (RX_D3D12_MARKERS=3), and the back end's buffers around a fault's address; RX_D3D12_SERIAL,
  RX_D3D12_COPY_STRESS, RX_D3D12_HOME_CHECK, RX_D3D12_HOME_TRACE and RX_D3D12_BORDER_COLORS; the video memory every 150
  presents.

Checks: tests/run_all.py's D3D12 checks pass (clang, llvm-mingw); test_switch_table fails as before on RX_VK_PGO_FILE,
which this change does not touch.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the Intel Arc B580 a draw recorded after a copy in the same command list faulted now and then, and the device was lost
(DRED: a page fault in that draw, at an address no resource holds). In Zora's River it was lost about 190 s into the walk
route, each run in the first draw after the bounce's copies back; with a 256-byte copy before each draw with global memory
(RX_D3D12_COPY_STRESS=2), in 12 runs of 12.

tests/test_d3d12_copy_split.py cuts take_all and live_back out of gpu/d3d12/d3d_draw.cpp and runs them on a stand-in
command list that keeps each list's operations. It fails here: the draw after the copies back, and a draw whose take
uploads a texture, are recorded on the copy's list.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the Intel Arc B580 (driver 32.0.101.9175, OS build 29704) a draw recorded after a copy or a resolve in the same command
list faulted now and then, and the device was lost: DRED gave a page fault in the first draw after the copy, at an address
no resource holds. In Zora's River it happened in some runs 190 s into the walk route; with a 256-byte copy before each draw
with global memory (RX_D3D12_COPY_STRESS=2), in 12 runs of 12, 10 of them within 85 s.

Each copy and resolve the replay records marks the open list (list_copied), and a draw's take (take_all) sends the open
list first when it holds one since its last draw (copy_split); a take that records a copy itself (a texture's upload) is
made again on the next list. RX_D3D12_NO_COPY_SPLIT=1 records the draw on the copy's list, as before. The mesh fallback's
draws (a copy of their arguments between the dispatches and the draw) never faulted and are not split.

It did not help to put a UAV or an aliasing barrier after the copy, to unbind the targets and bind them again, to set the
heaps and the root signature again before each draw, or to send the bounce's copies back after each dispatch
(RX_D3D12_LIVE_BOUNCE=0).

Measured on the B580:
- the stress repro, lost in 12 runs of 12 before: with the list sent after the copy it ran its 240 s, twice;
- the walk route with no switches ran its 240 s, past the point it was lost, twice;
- at the save about 16 lists a frame are sent for a copy: 31.2-32.4 fps with the split, 31.2-31.4 fps without
  (RX_D3D12_MARKERS=2 both), and the bounce copied as much back (11.4 GB in 5 s).

Checks: tests/test_d3d12_copy_split.py passes, with and without RX_D3D12_NO_COPY_SPLIT=1. tests/run_all.py: 585 pass; the
47 that fail are the 47 that failed before (test_switch_table on RX_VK_PGO_FILE, which this does not touch).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
D3D12 has no ASTC formats, so ASTC textures are decoded to RGBA8. On the CPU (suyu's decoder, on its workers) that was
most of each pause as an area's textures loaded: on the walk route, 3.3 s of decoding in the 5 s after the save loaded,
1.9 s after the teleport to Zora's River, 1.5 s at the next area, and the game at 4.5 fps for 5 s after the save loaded.

The Vulkan back end's decoder (Eden's astc_decoder.comp, as SPIR-V in gpu/vk/host_shaders/) is translated once, as the
back end's own programs are (builtin_program); its read-only input loses its NonWritable decorations first, or Mesa
makes it an SRV and its registers no longer match the root signature's UAV table. A texture it takes is made with
unordered access (astc_fits: ASTC in block-linear storage, 2D, a layer's levels within 32 MB). Its upload (upload_astc)
copies the storage as the game laid it out into the upload ring, a run of layers at a time, and from there into a 32 MB
buffer in VRAM (an upload heap takes no UAV); then the decoder runs for each level, 8 x 8 blocks a group and a layer a z
(astc_decode), reading the GOBs as they are, with the Vulkan back end's push constants. A linear or 3D ASTC texture and
a buffer-to-texture copy of ASTC blocks are decoded on the CPU, as before. RX_D3D12_ASTC_CPU=1 decodes them all on the
CPU.

Measured on the B580 (driver 32.0.101.9175, OS build 29704), the walk route, the longest the replay thread was held in a
5 s window, on the CPU against on the GPU:
- after the save loaded: 2.4-2.5 s against 0.39 s (the game at 4.5 fps for those 5 s before, 30.6-31.9 fps now);
- after the teleport to Zora's River: 2.2-2.3 s against 0.35 s;
- at the next area: 1.1 s against 0.15 s;
- in Zora's River 23.2-24.3 fps (21.8-22.9 before), at the save 32.4-32.9 fps (32.0-32.1 before), a run each; the frames
  at 60, 120, 180 and 232 s match the CPU decoder's;
- the decoder costs 0.55 s once, at the title, as its first texture comes: 0.1 s to translate it, the rest to make its
  pipeline.

Checks: tests/test_d3d12_astc_gpu.py (new) cuts astc_stride, astc_fits and upload_astc out of gpu/d3d12/d3d_texture.cpp
and runs them on a stand-in of the block-linear layout: a 2D texture's 11 levels with the Vulkan back end's push
constants, a 90-layer array in runs of 32 MB or less, a cube in one run, the textures it refuses, and a full ring or a
decoder that refuses. Each of 7 mutations of upload_astc and astc_fits fails it. tests/run_all.py: 586 pass; the 47 that
fail are the 47 that failed before (test_switch_table on RX_VK_PGO_FILE, which this does not touch).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
In Zora's River the replay thread was on the CPU 84 % of the time, and 60 % of that went to the tables of a draw's
stages: each draw made its driver banks (c0, c2) whole, 0xA00 bytes a word at a time, and copied each uniform buffer
whole as bound, up to 64 KB (the upload ring took 10 GB in 5 s). 13 % of the replay's samples went to making the banks
and 9 % to copying uniform buffers.

A draw now copies a constant buffer as far as its stage reads it, as the Vulkan back end does (cbuf_used: Eden's count
of the bytes a constant buffer's reads reach, and the descriptor words a global fallback reads past it). The driver
banks are kept for the open command list (driver_bank, BankCache): a bank made from the same bindings takes the last
one's place in the ring again. A graphics stage's c2 is made from its textures, samplers and images and its c0 from its
storage buffers, so they stand while those do: State's tex_gen and ssbo_gen are what bind_gen was when they last
changed, and bind_gen takes its values from one clock for every queue's state. Compute's, task's and mesh's banks stand
while nothing was bound anew (and compute's grid is the same). A bank made again that comes out the same takes the last
one's place too, kept for as many bytes as it was checked for. A list sent gives its room in the ring back, so nothing
is kept past one. stage_tables keeps its two vectors from draw to draw. RX_D3D12_WHOLE_CBUFS=1 copies each whole and
RX_D3D12_NO_BANK_CACHE=1 makes each bank for each draw, as before. docs/d3d12.md section 4.1.

Measured on the B580 (driver 32.0.101.9175, OS build 29704), the walk route, a 5 s window each, before and after:
- Zora's River: 27.4-28.4 fps (23.2-24.3), the replay thread 3.6 s of each 5 (4.2), the upload ring 5.3 GB (10.2);
- the save: 34.5-34.6 fps (32.4-32.9), 2.5 s of replay (3.0);
- the area after the river: 23.9-25.4 fps (16.8-18.7);
- apart, in Zora's River: copies whole with the banks kept 24.6-25.7 fps, banks made for each draw 26.6-28.2;
- of the banks the draws take, 83 % are kept ones; no device lost in four runs; the frames at 60, 110-140, 180 and 232 s
  show what the runs before showed.

Checks: tests/test_d3d12_cbufs.py (new) cuts cbuf_used, driver_bank and constant_buffer out of gpu/d3d12/d3d_draw.cpp
and runs them on a ring that writes over a list's room once it is sent; after each call the bytes at the place given
must be the bank the state makes now, in room the open list took. It covers the sizes, banks kept and not kept (a list
sent, another queue's state, a state never bound, a compute grid that changed, a longer read after a shorter check),
both switches, and reads the replay's generations from gpu/d3d12/d3d_replay.cpp and gpu/d3d12/d3d_bank.cpp. Each of 14
mutations of the code fails it. tests/run_all.py: 587 pass; the 47 that fail are the 47 that failed before
(test_switch_table on RX_VK_PGO_FILE, which this does not touch).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
In Zora's River the lock calls were 12 % of the replay thread's time on the CPU. A draw looks up each texture and
sampler it binds under the registrations' lock (sampler_of 4 %, texture_of 2.5 %) and the pool of each storage buffer it
binds in place under three shared locks (3 %, 750 000 views in 5 s); each view in place was timed and added to the
replay's line under its lock (work_add, two clock reads a view), and a compute bank asked for its layout under a lock
for each of its words (cs_layout).

Each texture and sampler id now has a version that each registration of it moves (a sampler's only when its contents
change), as the Vulkan back end's slot versions. texture_of and sampler_of answer from the thread's own copy while the
id's version is the copy's, and take the lock to copy it again when it is not. inplace_buffer keeps the thread's last
pool while the host's maps generation and the opened pools' generation stay, and pools_refresh checks the maps
generation without its lock. The views in place are counted for the replay's line in one go at its end, one in 16 timed.
cs_layout keeps the thread's last program's. RX_D3D12_LOCKED_LOOKUPS=1 takes the locks for each lookup, as before.
docs/d3d12.md section 4.2.

Measured on the B580 (driver 32.0.101.9175, OS build 29704), the walk route with the CPU sampler on, a 5 s window each, before and after:
- Zora's River: the lock calls 1.6 % of the replay thread's time on the CPU (12 %), the replay thread 3.3-3.45 s of each
  5 (3.6-3.7), 28.2-29.0 fps (27.4-28.5);
- the frame there is the GPU's now: the game waits for it 0.55-0.6 s in 5 (0.27-0.29), and the GPU takes 31.5 ms a frame
  (RX_D3D12_GPU_TIMES), 7 of them the bounce's copies back to the pools;
- no device lost; the program cache was made again once (d3d_bank.cpp is in its stamp).

Checks: tests/test_d3d12_lookups.py (new) cuts the registrations, texture_of, sampler_of, pools_refresh and
inplace_buffer out of gpu/d3d12/d3d_bank.cpp and d3d_memory.cpp and runs them on stand-ins for the host and the opened
pools: ids registered again, two ids at one place of a thread's copies, three threads registering and looking up at once
(whole registrations, never an older round than one got before, the last one at the end), a pool grown at the same
start, a newer opening of a pool, both modes. Each of 9 mutations of the code fails it.
tests/test_d3d12_program_cache.py names RX_D3D12_LOCKED_LOOKUPS as a switch that changes no translation.
tests/run_all.py: 588 pass; the 47 that fail are the 47 that failed before (test_switch_table on RX_VK_PGO_FILE, which
this does not touch).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
In Zora's River the frame was the GPU's, 31.5 ms of it, and 7 ms of those were the bounce's homes going back to their
pools whole: 68 MB a frame across PCIe into system memory. The views had changed 1.4 MB of it, 2.8 MB in blocks of 256
bytes (RX_D3D12_BACK_CENSUS, a diagnosis this adds: each range that goes back in one frame copied out before and after,
and compared once the GPU ran it).

Beside the homes' VRAM a shadow of the same size now holds each home as its pool has it: a new home and the pages a take
copies in are copied there too, and what goes back. A home a view wrote is compared with its shadow on the GPU as it
goes back (gpu/d3d12/shaders/back_diff.comp, through builtin_program as the ASTC decoder): each block of 256 bytes from
the range's start where they differ is written whole to the pool and to the shadow, the others are left as the pool has
them. Its three views come from sets kept in the view heap's reserved part, each taken again once the GPU passed the
list that used it, not from the view ring, whose take may send the open list while the copies back run as it is sent; a
home whose set the open list still holds goes back whole. A word the CPU writes under a live home now survives unless
the views changed its block, so a compared home keeps its take's generation and the next take copies those pages in.
RX_D3D12_WHOLE_BACK=1 sends each home back whole and keeps no shadows, as before. docs/d3d12.md section 5.1.

Measured on the B580 (driver 32.0.101.9175, OS build 29704), the walk route, a 5 s window each, against
RX_D3D12_WHOLE_BACK=1 in the same build:
- at the save in Kokiri Forest 43.3-43.5 fps (33.2-33.9);
- Zora's River 32.1-32.8 fps (28.0-29.0): the GPU 26.6 ms a frame (31.5), the pass that sends the homes back 2.1 ms
  (7.0);
- the area after it 44.5-46.6 fps (37.9-38.9), the next 51.3-54.7 (41.4-42.9);
- the homes compared with their pools at each take (RX_D3D12_HOME_CHECK): 168 257, of them one differs, in a page the
  CPU wrote after the take, as on the whole path; no device lost;
- 256 MB more of VRAM for the shadows; lists sent before a draw for a copy 2300 in 5 s (3400) after the river.

Checks: tests/test_d3d12_back_diff.py (new) compiles back_diff.comp's own main() as C++ and runs it as the GPU would, a
thread an invocation and a barrier for barrier(), on ranges of one word to several groups: the blocks that differ reach
the pool and the shadow whole, nothing else changes. It checks back_diffs' count, views and groups against the shader,
and the header against the shader (its hash; byte for byte with glslang 16.6.0). Each of 9 mutations of the shader and
of back_diffs fails it. tests/test_d3d12_bounce_homes.py's model now keeps the shadows, compares the homes as they go
back (1 in 8 whole, as when no set of views is free; a third of the rounds as RX_D3D12_WHOLE_BACK=1), and lets the CPU
write while the list is open: what it wrote under a live copy is lost only where the copy went back over it. Each of 7
mutations of the model's rule (the generation moved, a shadow copy left out, the pool compared instead) fails it.
tests/test_d3d12_copy_split.py stands in for the comparison. tests/run_all.py: 589 passed, 47 failed, 98 skipped; the 47
failed before the change too, none of them a Direct3D 12 check.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Where the device has mesh shader tier 1 and DXC's dxcompiler.dll is beside the back end (RX_D3D12_DXC names another), a
mesh program is translated twice: Eden's compute fallback, then its task and mesh stages as D3D12's amplification and
mesh shaders. Eden's SPIR-V with Profile::hlsl_mesh goes to HLSL by SPIRV-Cross (shader model 6.5,
third_party/spirv-cross, vulkan-sdk-1.4.363.0) and to DXIL by DXC (third_party/dxc-api's dxcapi.h, the DLL loaded at run
time); the fragment stage stays Mesa's. hlsl_mesh: no descriptor arrays (a constant buffer is one uvec4 array), the
payload a struct, OpIAddCarry written out, the mesh stage's generics at the locations the fragment stage reads them
(RuntimeInfo::mesh_output_locations), and the guest's 32-lane warp as the workgroup (emit_spirv_warp.cpp: votes, ballots
and shuffles through workgroup memory and a barrier, only where every thread reaches it). An indirect draw's
{count, first} is copied to {first, count, 1, 1} for a command signature that sets the first task workgroup. The program
cache keeps the native half, stamped with DXC's version. docs/d3d12.md section 7.1.

With RX_D3D12_MESH_NATIVE=1 a draw takes the native route once it is made. On the walk route (B580, driver
32.0.101.9175, OS build 29704) 4 of 49 mesh programs translated natively, and the first native indirect draw in Kokiri
Forest hung the GPU: DRED said the device hung, with no page fault, and RX_D3D12_MARKERS=2 named the draw. Of the 45
that fell back, 40 stop at an OpAccessChain with an undefined operand, 3 at a warp operation in divergent control flow,
2 at SPIRV-Cross's lack of variable pointers in HLSL. So the switch is off: every mesh program is drawn by the fallback,
as before. Profile::hlsl_mesh is off for the Vulkan back end, whose SPIR-V these changes leave as it was (not checked
with a Vulkan run); sirit's error for a null operand names the op.

Bench: dxprobe meshlanes and dxbench meshrun measure the lanes the B580 runs amplification and mesh shaders with.

Checks: tests/test_d3d12_program_cache.py stamps d3d_hlsl.cpp and .h, and RX_D3D12_DXC. scripts/check_third_party.py: 17
parts as their notes say. tests/run_all.py, with the next commit: 589 passed, 47 failed, 98 skipped; the same 47 fail on
the commit before, none of them a Direct3D 12 check.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A review of what the back end's diagnostics and the tools beside them can observe, on the B580 (driver 32.0.101.9175,
OS build 29704) on the walk route. docs/d3d12-tools.md now has each tool's verified results, limits and procedure, and
a section 9 of what none of them shows yet, the ones that matter most first:
- The GPU is busy 81 to 87 % of each frame (RX_D3D12_GPU_TIMES) and idle 2.6 to 4.8 ms of it, for no known reason.
  Per-draw GPU time and the GPU's timeline are the blind spots that matter most; each is about an hour to build.
- PIX timing captures need elevation here: the kernel trace is denied to this account although it is in Performance
  Log Users, and pixtool waits without a word. The procedure for an elevated capture is written down; not run (UAC).
- RenderDoc 1.47 captures the frame with the pools opened in place and replays it, shader model 6.6's heap-indexed
  views included: shader stepping, pixel history and descriptors work. Its replay differs from the game's own dump in
  19 to 35 of 83 targets (the lit and post-processed images, the fog's volumes), its GPU times are over 13 times the
  game's, and loaded it costs frames (31.8 against 37.5 fps). gpu/d3d12/bench/rdc_check.py and rdc_compare.py check a
  capture against RX_D3D12_DUMP_TARGETS. While RenderDoc is in the process the pools stay mapped (open_pool), so that a
  capture takes the game's CPU writes into them at each submit: 79 at the save, none before.
- GPU-based validation: RX_D3D12_DEBUG=3 validates the draw log's frame alone, the other lists' shaders patched to
  track resource states only and made with each pipeline (PipelineStateCreateFlags). =2 never reaches play (0.1 fps
  from the save's loading on; its shaders made with each pipeline instead, 0 fps); =3 does, at 4 to 10 fps, and then
  the layer crashes at the validated frame's first SetPipelineState, in CreatePatchedShaderBytecode (named with
  Microsoft's public symbols). At the loading it found textures read in the RENDER_TARGET layout (error 1358):
  docs/d3d12.md section 11.
- PresentMon unelevated sees no presents, the game's or any other's.

Checks: tests/test_d3d12_pool_open_race.py stands in for the pool's Map and diag_maps_pools. tests/run_all.py: 589
passed, 47 failed, 98 skipped; the same 47 fail at 5e7d84ab, none of them a Direct3D 12 check (test_switch_table's is
RX_VK_PGO_FILE's row).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A PIX timing capture of the game, taken by an elevated pixtool while the game runs unelevated
(gpu/d3d12/bench/pix_timing.ps1), read through PIX's MCP server (gpu/d3d12/bench/pix_read.py):
the GPU idles only between submits, while the next one is still being recorded
(docs/d3d12-tools.md section 5.1). The GPU's timeline leaves the list of what no tool shows.

In Castle Town's market the frame is the CPU's: 19.5 to 22.5 fps, the GPU busy half of each
frame, the replay 4.15 s in 5, the presentation thread waiting for the replay's lock 43 % of its
time (docs/d3d12.md section 10.1).

Checks: python -I -B tests/run_all.py, 589 passed, 47 failed, 98 skipped; the same 47 fail on
f0f9a048 (toolchain and Vulkan-header checks of the merge base on this PC).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw's 16- and 32-bit indices go into the upload ring as the game's buffer has them (scan_indices,
upload_scanned): one pass finds their largest and least, and a restart value that is not D3D12's is changed
on the way. Before, read_indices widened each into a vector of 32-bit ones and upload_indices narrowed them
again: in Castle Town's market read_indices was a tenth of the replay thread's time on the CPU. 8-bit indices
and the ones the back end makes (quads, fans, loops) still go that way. RX_D3D12_NO_INDEX_SCAN=1: every draw's.

Measured in the market on the B580, both in one session from one build: 24.3-26.5 fps against 21.4-23.5 with
the switch; 11.1 us of replay for each indexed draw (12.7).

RX_D3D12_COPY_CENSUS=1 counts what the draws copy (vertex streams, indices, uniform buffers), how much of it the
same list or frame copied before, and the draws whose geometry lies in pools opened in place: in the market,
91 % of the uniform buffers' bytes are copied again in the same list, and 97 % of the draws could read their
geometry where it is (docs/d3d12.md section 4.1). section 10.1's split of ub_read's copies is corrected.

tests/test_d3d12_index_scan.py runs the old and new functions side by side on 30,000 index buffers; the
constant-buffer check's harness gets the census's stub. python -I -B tests/run_all.py: 589 passed, 48 failed
(the 47 that fail on 58baaced in this environment, and test_d3d12_cbufs.py, fixed here and passing).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dxprobe views times making each kind of view the replay makes (a constant buffer's, a texture's SRV, a null
SRV, a raw buffer's UAV) into a shader-visible heap and a CPU one, against copying one made before
(CopyDescriptorsSimple). On the B580 (driver 32.0.101.9175): 13.8, 72.5, 30.6 and 42.7 ns to make, 5.9 to copy.
It reads nothing from the game.

docs/d3d12.md section 4 described a plan the code did not follow (root CBVs for c0 to c2, SRVs made at
registration and copied): it now says what the code does (four tables a stage, every view made for its draw
into the shader-visible ring), with the probe's numbers. meshlanes' two results start at 0.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw whose index buffer and vertex streams all lie in pools opened in place, under no live copy of
the bounce, reads them there, as the Vulkan back end does (geometry_in_place): its index and vertex
buffer views point into the pools, which take the vertex-and-index read state in the open list.
Indices go in place only when D3D12's restart value needs no change in them (recut's rule). A draw
whose own views put one of its pools in another state gives in place up and copies, as do the draws
with anything outside the pools. RX_D3D12_COPY_GEOMETRY=1 copies every draw's geometry, as before.

Measured in Castle Town's market, both in one session from one build, 20 windows of 5 s each:
26.4-29.6 fps, 28.4 on average, against 22.6-25.5 and 24.2 with RX_D3D12_COPY_GEOMETRY=1; the upload
ring 4.8 GB in 5 s (10.2); 9.0 us of replay for each indexed draw (11.0). 97.5 % of the draws read
their geometry in place. The pictures at the same spot match both ways (docs/d3d12.md section 4.1).

tests/test_d3d12_geometry_in_place.py runs 40,000 made-up draws against stand-in pools: in place
when, and only when, the rule says; the index buffer's bytes those upload_scanned would copy; the
views right, each pool listed once; and the draw's wiring, read from the source.
Checks: python -I -B tests/run_all.py, 591 passed, 47 failed, 98 skipped: the same 47 fail on
7bc0225b in this environment.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
214b92a1 made Eden's SPIR-V emitter read the profile's hlsl_mesh in the DrawParameters block and
keep cf_depth and cf_early_exit in the Unreachable case. nx2/test_draw_parameters.py and
tests/test_mesh_unreachable_outputs.py cut those blocks into stand-in contexts that had neither, so
both stopped building ("no member named 'profile' in 'Ctx'", "no member named 'cf_early_exit'").
They skip on Windows (they need spirv-val), which is why this PC's runs did not show it; a Linux run
of the whole suite did. The stand-ins now have the members, off, as for the Vulkan back end's
programs.

Checks, with spirv-val (SPIRV-Tools v2026.4) and the SPIR-V and Vulkan headers on this PC: both
fixtures pass; python -I -B tests/run_all.py --no-skip fails no check here that passes on the merge
base 544229a2 (75 failed here, 76 there: the same names, and test_longshot_ctl.py there only).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
third_party/mesa-spirv-to-dxil/PROVENANCE.md named the DLL's release archive but gave no URL and no
hash. It now gives mesa-dist-win 26.2.6's mesa3d-26.2.6-release-msvc.7z by URL and SHA-256 (the
digest the release gives it, and the download's), and its x64/spirv_to_dxil.dll by size and SHA-256:
the one this PC's game folder has, byte for byte. docs/d3d12.md section 10.1 says the back end needs
it beside the game. python -I scripts/check_third_party.py: 17 parts as their notes say.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A uniform buffer's copy in the upload ring (the range its stage reads) is given to the open list's
later bindings of the same range, the same address and size, from any stage (cbuf_copy_slot), while
nothing wrote over it since it was made: no CPU write collected over it (storage_written_since), no
write of the op stream's (a uniform update, a copy, a clear, a counter's report: homes_stream_write),
no write the retirer made once the GPU passed the work before it (a copy, a clear, an event's word:
cbuf_retired_write), and for a virtual pool no change in its pages' mapping. A list sent ends them.
A draw RX_D3D12_HOME_CHECK watches copies its own. RX_D3D12_CBUF_DEDUP=0 copies every binding, as
before; =2 copies every binding and counts the copies that differ from the list's first.

Measured in Castle Town's market, standing at its gate, three runs each from one build, the 85 s
after arriving: 27.6-29.4 fps, 28.4 on average, against 27.7-27.9 and 27.8 with the dedup off; 8.8 us
of replay for each draw (9.2). 66 % of the bindings are given an earlier copy, 3.7-4.1 GB in 5 s not
copied. With =2, of about 1.4 million compared in 5 s, 0-223 differ, all in the last 41 bytes of one
12.7 KB range and none after a retirer's write: writes no copy made at record time sees, on or off.
The pictures at the same spot match both ways (docs/d3d12.md section 4.1).

tests/test_d3d12_cbufs.py runs the dedup against stand-ins of guest memory, its write stamps and a
virtual pool: each kind of write over a range and beside it, the rings of stream and retired writes
full, a watched draw, a list sent, 5000 ranges, 6000 random operations against an oracle of guest
memory, in each mode; and the wiring, read from the source: every op that writes guest memory tells
homes_stream_write, and the retirer tells cbuf_retired_write.
Checks: python -I -B tests/run_all.py, 591 passed, 47 failed, 98 skipped: the same 47 checks as in
this branch's earlier runs in this environment, none of them of gpu/d3d12.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/test_d3d12_dead_targets.py cuts gpu/d3d12/d3d_texture.cpp's frame out of the source (texture_stats up to
textures_line: textures_frame, and the code that lets dead targets go when it is there), with target_rendered,
target_sampled, same and target_slices, and runs it on stand-ins for target_for, the views' heaps, the GPU's timeline and
the queues' bindings. Each target let go is checked against the check's own record of its uses and of every draw: let go
only at a present's end, drawn over since its last use (from another start, over an eighth of it or more; from its own
start, 60 presents unused), the GPU past the list of the frame that last used it, bound by no queue, of one level and
layer, no dump asked for, its views back in their heaps. The cases:
  - OoT's scratch heap: 6 targets a frame at offsets that move each frame, each pass sampling the one before, 400 frames
    with the GPU a frame behind: 4 frames' worth held at most; the picture's own target and one used in 10 frames only,
    which nothing drew over, kept;
  - drawn over from its start a frame later: kept 59 presents unused, gone at the 60th; a shadow map drawn every 8
    presents where another target is drawn each frame: made once, gone 60 presents after its last draw; drawn once and
    sampled 100 presents: kept 60 presents from its last sample;
  - drawn over in the frame that last used it: stays; from another start, less than an eighth of it: stays, an eighth:
    goes; a smaller target inside it: stays;
  - the GPU stalled before the frame that last used it: kept until it ran that frame;
  - drawn into after a present while still bound, with no new binding, or sampled in the frame another was drawn over it
    in: kept until the GPU ran that frame;
  - bound by a queue, an array's, a cube map's, a 3D or a mipmapped target, RX_D3D12_DUMP_TARGETS set: kept; an array of
    one layer, and one unused 100 presents then drawn over: go;
  - target_rendered stamps a draw as the target's use and write; the books (n_targets, target_bytes, the map, the views
    given out and back, a depth target's to the DSV heap) match the targets held; RX_D3D12_KEEP_TARGETS=1 keeps them all.
d3d_replay.cpp's target_bound and the census line (targets_line) run on stand-in queues, and the wiring is read from the
source: target_for stamps the target it finds or makes, and counts it and puts its address in the map only past its last
return with nothing made; every write that marks a target drawn stamps it written; present sends the frame's list before
textures_frame and records nothing between.

At this commit it fails: all 2,400 of the scratch heap's targets are held after 400 frames, the targets that should go
are kept, target_for puts an address in the map before it can still fail, and target_bound is not in the source yet.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Render targets were never let go. OoT makes a frame's render targets one after another in a scratch heap whose offsets
move from frame to frame, so each placement is a target of its own here. In Castle Town's market, walking with the camera
turning, they grew to 2,947 and 26 GB, and the process's VRAM to 13.9 GB of the 9.8 GB the driver allowed: it paged, and
the frame rate fell under 10 fps for 105 s of the walk.

After each present textures_frame lets go of the render targets another was drawn over since their last use: those of
one level and layer, once the GPU ran past the list of the frame that last used them, and with no queue binding them
(target_bound). Drawn over from another start, over an eighth of them or more (gpu/vk/target_overlap.h, the Vulkan back
end's rule), they go once a present went by without them; drawn over from their own start, once 60 did: the game makes a
target in turn with one of another shape at its start (a shadow map of another size, the scene at another resolution)
and takes it again a few presents later. Their views go back to their heaps. A use is a binding, a draw or a clear (into
a target a queue kept bound across a present too), a sample, a store, a copy and the present; a write is a draw, a
clear, a store or a copy. target_for counts a target's VRAM and puts its address in the map once it is made, so one it
could not make leaves neither. The video memory line logged every 150 presents counts the targets held, those unused
600 presents, those behind a newer one at their address and the dead ones let go. RX_D3D12_KEEP_TARGETS=1 keeps them
all, as before (docs/d3d12.md section 8.4).

Measured in Castle Town's market, walked by hand for about 8 minutes after the teleport, one run each (the walks are not
the same step for step), at first with a target drawn over from its own start let go after a present too: before,
24.1 fps on average, the 5 s windows 0.0-31.5 fps and 21 of them under 10; VRAM at most 13.9 GB of a 9.8 GB budget,
render targets at most 2,947 and 26 GB. After, 30.5 fps, the windows 28.5-31.5 and none under 20; VRAM at most 9.2 GB
of 10.3 GB, render targets at most 174 and 853 MB, 3,339 dead ones let go (3.2 GB) of the 3,517 made. 3,082 of those
were made again at the same address and shape, 2,160 of them one 128 x 128 depth target, every 8 presents: hence the
60 presents. With them, the scripted walk (the teleport, then 2 minutes of the stick in the market, in the queue's shared
mode: not a timing run): 36.6 fps on average, the 5 s windows 24.2-46.7, none under 20; VRAM at most 9.2 GB of 10.3 GB;
render targets at most 220 and 1,046 MB, 6,903 dead ones let go (22 GB) of the 7,087 made, 5,319 of those made again at
the same address and shape (most often the frame's 960 x 540 and 480 x 270 passes; the Vulkan back end takes such
images from a pool). The 128 x 128 depth target was made 43 times there, all in the 600 presents after the teleport,
and not in the 6,700 after. The last frame of each walk shows nothing wrong.

tests/test_d3d12_dead_targets.py passes here and fails at the commit before; each of 39 mutants of the fix fails it (the
call left out; a draw or a sample not counted as a use; the GPU's check off by a frame or left out; bound, layered or
mipmapped targets let go; one drawn over from its own start kept, let go after 1, 59 or 61 presents, or aged from its
last write, not its last use; views given back to the wrong heap or not at all; the books not kept; the switch or the
dump ignored; target_bound blind to a binding; the VRAM counted or the address put in the map before target_for can
still fail; textures_frame before the flush, or a target used between them).
Checks: python -I -B tests/run_all.py, 592 passed, 47 failed, 98 skipped: the 47 that fail in this environment without
the check and the fix too, none of them of gpu/d3d12.
The check is compiled with clang (llvm-mingw); this PC has no GCC. It does not model threads, timing, a GPU, a driver or
the game's data.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
pools_open_all has every pool of the game's pool table opened in place before a draw follows pointers through the page
table. It looks at the table again whenever the host's maps generation moved, and each look went over every pool, a
shared lock and two map lookups each, also those it had opened or passed over before.

tests/test_d3d12_pools_open_all.py cuts pools_open_all and pools_refresh out of gpu/d3d12/d3d_memory.cpp and runs them
on a stand-in pool table and open_pool, with the opened and refused pools' maps counting their lookups: the first look
opens the pools in the page table's windows and not those outside them or above the virtual base; a look with the maps
as they were looks at nothing; 4,000 pools that came are opened, and a look after one more came opens it and looks a few
times into the maps, not 4,000; a pool gone and back at its range is not opened again, one grown at its start is, 100
opened by views before a look are not opened again and the looks after pass over them; a refused pool is not tried
again while its range is the same, and is tried once it grows.

It fails here: the looks after one pool came, went, came back, grew, or after 100 were opened by views, looked 4,002 to
4,109 times into the opened and refused pools. No GPU, driver, game or threads.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
pools_open_all keeps, by start, the pools its last look left opened or outside the page table's windows, and a look
passes over each of them whose range is the same: opened pools are never closed, and one opened again at the same start
is larger, so such a pool stays opened. Only the pools that came or changed since are looked up in the opened and
refused pools, with the lock; a refused one is still looked up at each look, as before.

The game maps and unmaps GPU memory several times a frame while it streams, and each change moved the maps generation:
the look after it went over every pool, a shared lock and two map lookups each. Measured in Castle Town's market with
the host's CPU sampler, 40 s while walking (the scripted walk from the teleport, one run each, in the queue's timing mode;
the walks are not the same step for step): pools_open_all took 4.2 % of the replay threads' samples on the CPU before
(356 of 8,457, three quarters of them the look and its locks) and 0.7 % after (59 of 8,165, all but 13 of them the
pools' openings themselves); a walk sampled later in the market had it at 7.5 %. Standing still the maps do not change,
and it took nothing either way (29-30 fps both). The last frames show nothing wrong. docs/d3d12.md section 5.

tests/test_d3d12_pools_open_all.py passes here and fails at the commit before; each of 15 mutants of the fix fails it (the
skip left out or by start alone, the walk past an equal start or not moving, the kept pools not kept or not cleared, the
pools opened now or by a view not kept, the opened or refused ones taken by start alone, refused ones tried again,
pools outside the windows opened, no look after a change or a look every time, the table not read again). The checks
beside it pass: test_d3d12_lookups.py, test_d3d12_pool_open_race.py.
Checks: python -I -B tests/run_all.py, 592 passed, 48 failed, 98 skipped: the 47 that fail in this environment without
the change too, and tests/test_longshot_ctl.py, which failed on a file a stopped process held as its folder was removed,
and passes alone. The check is compiled with clang (llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
inplace_buffer gives a storage buffer's view the guest pool, opened in place, that holds it. It keeps the thread's last
pool, and a view in that pool takes no lock while the host's maps and the opened pools stay as they were; a view in any
other pool takes the pool table's and the opened pools' locks to find its own. A draw's views go from pool to pool, and
most of them missed the one kept.

tests/test_d3d12_lookups.py has a new case: five pools, at starts a page and more apart, each looked up once since they
were opened, then 1,000 views in turn in them, each answered with its own pool's buffer, offset and room, and no lock
taken (the pools' and the opened pools' mutexes count their locks); with RX_D3D12_LOCKED_LOOKUPS=1 each view takes
them. A view at a pool's end is not given that pool.

It fails here: the 1,000 views took 2,000 locks. No GPU, driver, game or threads.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
inplace_buffer keeps the thread's last eight pools, not its last one: a view in any of them takes no lock while the
host's maps generation and the opened pools' generation stay as they were. A view in none of them looks its pool up
under the locks, as before, and it takes the place of the oldest kept; once either generation moved, the kept pools
are dropped at the next look.

A draw's views go from pool to pool, and in Castle Town's market those that missed the one pool kept took the locks:
inplace_buffer was 6.0 % of the replay threads' samples on the CPU standing still (520 of 8,672; its locks 3.7 %) and
4.4 % walking (357 of 8,165; its locks 1.9 %). With eight it is 2.1 % standing still (179 of 8,394) and 1.9 % walking
(159 of 8,495), its locks 0.4 and 0.3 %. Measured with the host's CPU sampler, 40 s each: standing still after the
teleport, and the scripted walk from it (one run each, in the queue's timing mode; the walks are not the same step for
step). The last frames show nothing wrong. docs/d3d12.md section 4.2.

tests/test_d3d12_lookups.py passes here and fails at the commit before; 9 of 10 mutants of the fix fail it (one or two
pools kept, the kept pools never dropped or dropped on the maps alone, the kept pools used blind to the opened pools or
to the maps or with RX_D3D12_LOCKED_LOOKUPS=1, a pool's end taken as inside it, the offset from the kept start). The one
that passes keeps the pools after a look that opened one, tagged with the generation after it: the same answers while
opened pools stay for the process's life, as they do (opened_all).
Checks: python -I -B tests/run_all.py, 593 passed, 48 failed, 98 skipped: the 47 that fail in this environment without
the change, less tests/test_coverage_run.py, which passed this time; tests/test_d3d12_sampler_heap.py, not in this
commit; and tests/test_d3d12_workers.py, whose 50 ms waits failed with 20 checks at once and pass alone. The check is
compiled with clang (llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The host cuts a log line at 1 KB, and in Castle Town's market the replay's line every 5 s ran past it: its rings' part,
with the sampler heap's resets, was cut off. work_report writes it with log_long now, in pieces past 1 KB. The line's
samplers say how many tables they were made in and how many of them were distinct: standing still in the market, 103,502
samplers in 3,831 tables, 47 of them distinct; walking there, the sampler heap was reset up to 11 times a second, each
time waiting for an idle GPU (27 to 265 ms of 5 s), and the tables were made again after each. docs/d3d12-tools.md
section 2.1.

Checks: in the game, the market's replay lines read whole with it (the runs that measured the commit before and the
next ones). No check reads these lines; tests/run_all.py ran with the next commits.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A stage's samplers are a table of the shader-visible sampler heap, 2,048 at most, kept while the same samplers come
again. When the heap is full, sampler_table sends the open list, waits until the GPU is idle and uses the heap again
from its start: walking in Castle Town's market, up to 11 times a second, 27 to 265 ms of 5 s, and the GPU idle after
each.

tests/test_d3d12_sampler_heap.py cuts sampler_table and what it reaches out of gpu/d3d12/d3d_draw.cpp and runs it on
stand-ins: sampler heaps whose slots remember their sampler and the newest list that read them, lists sent as the replay
sends them, each binding the heap in use when it opened, and a GPU two frames behind. Each table holds its samplers, the
same samplers take the same table, a heap holds 2,048 samplers before the next is taken and a table taken after it holds
its samplers there; no slot is written while a list that read it is not done, and a draw's tables are in the heap its
list binds (draws take their tables as take_all does). Frames of 300 new samplers, and frames that fill a heap each: no
wait for the GPU. More than a heap a frame: at most two waits a frame, none until the GPU is idle; six heaps a frame:
waits only for the lists that read the heap taken again.

It fails here: the second heap is the first again, and the replay waited for an idle GPU at each full heap (20 times in
the 300-sampler frames, 75 in the heap-a-frame ones). No GPU, driver, game or threads.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sampler_table takes the tables from one of four shader-visible sampler heaps. When the one in use is full, the open list
goes to the GPU with it, and the next heap takes the tables from its start, once the GPU is past the last list that read
it (sent three heaps before, so the replay seldom waits for it); its tables are made again as they come, and the lists
after bind it (set_heaps, with the list sent). Before, the one heap was used again from its start once the GPU was idle:
the open list sent and waited for, and the GPU left with nothing queued.

Walking in Castle Town's market that was up to 11 times a second, 27 to 265 ms of each 5 s waiting. The game samples with
47 distinct samplers there, but a table holds a stage's whole range of sampler registers, 12 to 33 of them on average,
and the tables a frame takes come near a heap. Measured on the walk from the market's teleport, 40 s, one run each in
the queue's timing mode (the walks are not the same step for step): the heaps taken 15 to 82 times in 5 s, and no wait
(before: 12 to 55 resets, 27 to 265 ms waiting); frames over twice the median 14 (24), 35.5 fps (36.9). Standing still
the same tables come again and no heap fills, before or after. The last frames show nothing wrong, and no device fault.
docs/d3d12.md section 4, docs/d3d12-tools.md section 2.1.

tests/test_d3d12_sampler_heap.py passes here and fails at the commit before; each of 15 mutants of the fix fails it (one,
two or three heaps, no list sent at the change, the heap left tagged with the list before the open one or not tagged,
the heap in use not changed, no wait or a wait until idle, the wait for another heap's list, the tables kept or the next
slot kept at a change, no change counted, a heap full a table early or late).
Checks: python -I -B tests/run_all.py, 594 passed, 47 failed, 98 skipped: the 47 that fail in this environment without
the change, less tests/test_coverage_run.py, which passed this time, and tests/test_longshot_ctl.py, which failed on a
file a stopped process held as its folder was removed, and passes alone. The checks are compiled with clang
(llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw's textures are SRVs written into the shader-visible ring at each draw, and make_srv makes each of them there:
72.5 ns on the B580, where copying one made before takes 5.9 (dxprobe views). Standing still in Castle Town's market,
making them was 7 % of the replay threads' time on the CPU, though the same views of the same render targets and
textures come draw after draw.

tests/test_d3d12_srv_cache.py cuts make_srv out of gpu/d3d12/d3d_texture.cpp and runs it on a stand-in device whose
descriptors remember the resource and the description they were made of, and a ring of view slots that goes round. Each
view taken holds what making it where it goes would; the same view of a texture taken 10 times is made once; thirteen
views of two textures that differ in format, component mapping, dimension, levels or layers, the furthest level and
layer a view can name among them (twelve SRVs), are each made once a texture; a view whose dimension does not fit is
refused each time and nothing is kept; a view taken again after the ring went round is copied from the one kept; more
views of one texture than it keeps, and the store gone round past a view kept, make it again; with nowhere to keep it,
a view is made each time.

It fails here: the view taken 10 times was made 10 times, and the 78 takes of the thirteen views made 78 SRVs. No GPU,
driver, game or threads.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
make_srv keeps each SRV it makes of a render target or a texture in a CPU-only heap of 65,536, by the view it was made
for (format, component mapping, dimension, and the game's view's levels and layers), and copies it from there into the
draw's slot of the shader-visible ring when the same view of the same resource comes again. A resource keeps its last
16; full, the heap is written again from its start, and the views kept before it went round are made again as they
come. A render target or a texture made again is a new one, with nothing kept. Before, each view a draw took was made
where it goes: 72.5 ns on the B580, where a copy takes 5.9 (dxprobe views).

Measured in Castle Town's market with the host's CPU sampler, 40 s, one run each in the queue's timing mode: standing
still, make_srv 1.1 % of the replay threads' time on the CPU (7.1), texture_srv with its lookups 10.1 % (15.7),
31.3 fps (30.1), frame time median 31.1 ms (33.0), p99 48.1 (48.8); walking from the market's teleport (the walks are
not the same step for step), texture_srv 8.8 % (13.3), 37.0 fps (35.5). The runs keyed a view's layers in 32 bits; the
64 here keep a view of the furthest layers a view can name apart from no view. The last frames show nothing wrong, and
no device fault. docs/d3d12.md section 4.

tests/test_d3d12_srv_cache.py passes here and fails at the commit before; each of 16 mutants of the fix fails it (the
format, the mapping, the dimension, the levels, the layers or the store's round left out of the key, the levels' or the
layers' count left out, the layers' key 32 bits wide, a store that never goes round, a hit copied the wrong way, a view
made and not copied where it goes, the ring's slot kept in place of the store's, kept tagged with the round after,
nothing kept, the store's heap shader-visible).
Checks: python -I -B tests/run_all.py, 595 passed, 47 failed, 98 skipped: the 47 that fail in this environment
without the change. The checks are compiled with clang (llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each draw hashes its state into the key of its pipeline (graphics_pipeline, fixed_key: 440 bytes of blend, rasterizer
and depth state in 17 pieces) and each stage's samplers into the key of their table (sampler_table: 52 bytes a sampler,
12 to 33 of them a table in Castle Town's market). hash_bytes takes them a byte at a time, with a multiply after each:
standing still in the market, graphics_pipeline and sampler_table were 8.9 % of the replay threads' time on the CPU,
most of it hashing.

tests/test_d3d12_draw_hash.py cuts hash_bytes and hash_of out of gpu/d3d12/d3d_draw.cpp and times them against a
byte-at-a-time FNV-1a, in turn on the same bytes, the fastest of 45 tries of 2000 keys each: a table of 27 samplers in
one piece, and a pipeline's fixed state in fixed_key's pieces, must hash at least three times as fast. It also checks
that the keys keep the states apart: a million samplers that differ in their last field, and a million that differ in
two others, give a million keys each; 0 to 16 zero bytes give 17; the same bytes with another seed, and two values
hashed in turn in the other order, give another key.

It fails here: 1069 ns a table and 307 a fixed state, as fast as a byte at a time. No GPU, driver or game.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
hash_bytes, which makes the keys of the pipelines (graphics_pipeline, fixed_key) and of the sampler tables
(sampler_table), takes 8 bytes at a time and mixes each in with MurmurHash3's two multiplies, where it took a byte at a
time with a multiply after each. The keys live in memory only (the pipelines' holds the program's address), so none
made before is read with the new one. On this PC a table of 27 samplers hashes in 188 ns (1071) and a pipeline's fixed
state, in fixed_key's 17 pieces, in 53 (308).

Measured standing still in Castle Town's market with the host's CPU sampler, 40 s, one run each in the queue's timing
mode, with nothing else running: graphics_pipeline with fixed_key 1.7 % of the replay threads' time on the CPU (5.9),
sampler_table 0.7 % (3.0); the replay 3.19 to 3.27 s in 5 (3.33 to 3.45), 32.8 fps (31.5), frame time median 29.5 ms
(31.2), p99 45.9 (48.4). The last frame shows nothing wrong, and no device fault. docs/d3d12.md section 4.

tests/test_d3d12_draw_hash.py passes here and fails at the commit before; each of 7 mutants of the fix fails it (one
byte of each eight mixed in, the last bytes or their count left out, the seed left out, no step of the key between
blocks, the first 8 bytes taken again and again, the last bytes taken from the start). tests/test_d3d12_sampler_heap.py,
which cuts hash_bytes too, passes.
Checks: python -I -B tests/run_all.py, 596 passed, 47 failed, 98 skipped: the 47 that fail in this environment
without the change. The checks are compiled with clang (llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each draw binds its render targets (OMSetRenderTargets), its 16 viewports and scissors, its blend factor and its
stencil reference on the open list (bind_targets), though most draws follow one into the same targets with the same
state. Standing still in Castle Town's market those calls took 5.6 % of the replay threads' time on the CPU, in the
driver and the runtime.

tests/test_d3d12_bind_targets.py cuts bind_targets and the draw targets' struct out of gpu/d3d12/d3d_draw.cpp, and the
RTV and DSV heaps (ViewHeap, its alloc and release) out of d3d_internal.h and d3d_device.cpp, and runs them on a
stand-in list that holds what was set on it (nothing on a new one), each heap slot remembering the view made in it.
100 draws alike on one list must set each of the five once. 20,000 draws over ten sets of targets (four of them binding
some of another's views), four sets of viewports, three scissors, three blend factors and three stencil references,
with lists sent, depth targets bound read-only, and a target's view given back and its slot taken by another view now
and then, must each leave the list holding the views and the state the draw takes, and bind the targets no more often
than they change.

It fails here: the 100 draws alike set each 100 times, and the 20,000 bind the targets 20,000 times where 2,852 took
other targets than the draw before. No GPU, driver or game.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
bind_targets sets a draw's render targets, viewports, scissors, blend factor and stencil reference on the open list
only where they differ from what the list holds (bound_targets). A list sent holds none of them (flushes), and the
targets are bound again once the RTV or DSV heap gave out a view since: a slot given back and taken again holds another
view at the same address (ViewHeap::changes, counted in alloc). Every view bind_targets binds is made into a slot just
taken (the targets' own, target_view's, depth_view_read_only's); the swapchain's, made again in their slots on a
resize, are cleared, never bound. bind_targets is the only code that sets those five on a list.

Measured standing still in Castle Town's market with the host's CPU sampler, 40 s, one run each in the queue's timing
mode, with nothing else running: bind_targets 0.9 % of the replay threads' time on the CPU (5.8); the replay 3.01 to
3.21 s in 5 (3.13 to 3.29), 34.6 fps (32.4), frame time median 28.1 ms (30.1), p99 45.2 (46.8). The last frame shows
nothing wrong, and no device fault. docs/d3d12.md section 4.

tests/test_d3d12_bind_targets.py passes here and fails at the commit before; each of 16 mutants of the fix fails it (a
new list not noticed, or marked before the compare; the heaps' changes, the count of colour views, a depth target or
none, the depth view or the colour views not compared, or the colour views compared one short; the heaps' changes not
remembered, the depth view remembered as none, the viewports not remembered; the viewports, the scissors, the blend
factor or the stencil reference not compared; a view given out not counted). tests/test_d3d12_workers.py and
tests/test_d3d12_dead_targets.py, which cut d3d_draw.cpp around it, pass.
Checks: python -I -B tests/run_all.py, 597 passed, 47 failed, 98 skipped: the 47 that fail in this environment
without the change. The checks are compiled with clang (llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each draw looks each of its textures up in the render targets at its address (target_sampled) and in the sampled
textures by its key (texture_srv), though draws take the same textures over and over. Standing still in Castle Town's
market those lookups took 4.9 % of the replay threads' time on the CPU, most of it waiting for memory.

tests/test_d3d12_texture_found.py cuts texture_srv, target_sampled, key_of and the key and its hash out of
gpu/d3d12/d3d_texture.cpp and runs them on stand-ins that count the two maps' lookups. 24 textures, each alone at its
address, and 4 render targets, each the only one at its address, taken 100 times each in turn, must be looked up a
tenth as often as taking each looks it up. 30,000 takes of 64 textures at 24 addresses, with render targets made and
let go there now and then, of the textures' shapes or another, one or more at an address, targets drawn into, textures
let go, the CPU writing their storage and the GPU copying into them, must each get a view of what the maps hold for
the texture, and a render target taken must be marked used at this present. 40,000 textures, more than a table of what
was found has room for, taken twice, must each get its own. Render targets made (target_for) and let go (target_free)
and textures let go (textures_frame) must be the maps' only changes, and each must make what was found go (found_gen).

It fails here: the 28 textures taken 100 times each are looked up 7,600 times. No GPU, driver or game.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
texture_srv keeps what it found each texture as, by its key, in a table of 16,384 slots placed by the key's hash
(tex_found): its texture in sampled when no render target is at its address, or the render target there when it is
the only one and of the texture's shape and format family. A draw that takes the texture again reads its slot instead
of looking it up in the render targets and the sampled textures, and marks a render target used as target_sampled
does. A texture with render targets of other shapes at its address is looked up each time (what it reads depends on
what was written since), as is one with two targets or more there. Each render target made (target_for) or let go
(target_free) and each texture let go (textures_frame) moves found_gen, and every slot found before goes: those are
the maps' only changes, and a render target's shape and format are set only when it is made. The key is hashed 8
bytes at a time, each mixed in with MurmurHash3's two multiplies, then its finish, as the draw's keys are (hash_bytes):
the low bits pick the slot, and a byte at a time, with a multiply after each, the hash was a third of the sampled
textures' lookups' time.

Measured standing still in Castle Town's market with the host's CPU sampler, 40 s, one run each in the queue's timing
mode, with nothing else running, two runs each: the lookups 0.2 % of the replay threads' time on the CPU (4.9 and
5.0), texture_srv with them 8.6 % (11.3 and 10.5); a run with a table of 4,096 slots: 0.5 and 8.5 %. The replay 2.90
to 3.09 s in 5, 2.83 to 3.04 with 4,096 slots (3.01 to 3.21 and 2.98 to 3.15); 34.4 fps, 35.8 with 4,096 slots (34.6
and 34.9), frame time median 27.9 ms and 27.0 (28.1 and 27.9), p99 46.4 and 42.2 (45.2 and 44.9): within the runs'
spread, as the GPU takes 24 ms of the 27 to 28 ms frame there. The last frame shows nothing wrong, and no device
fault. docs/d3d12.md section 4.2; section 4 now notes that setting the pipeline state only where it changed was tried
there, with no gain.

tests/test_d3d12_texture_found.py passes here and fails at the commit before; each of 12 mutants of the fix fails it
(the generation or the key not compared; one slot for every key; a render target kept among several, or not kept; a
texture kept with render targets at its address, or not kept; a render target found again not marked used; a render
target made, a render target let go or a texture let go not moving found_gen; the textures emptied).
tests/test_d3d12_dead_targets.py, which cuts target_free and textures_frame out, declares found_gen now; it passes here
and at the commit before.
Checks: python -I -B tests/run_all.py, 597 passed, 48 failed, 98 skipped: the 47 that fail in this environment without
the change, and tests/test_d3d12_dead_targets.py before it declared found_gen. The checks are compiled with clang
(llvm-mingw); this PC has no GCC.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Settings: the back end answers none of the host's option queries, so under D3D12 every row of the settings file
  takes its default (the game's own dynamic resolution, settling at 75 %; its 1600-pixel shadow maps). The Vulkan run
  it was compared with drew the scene at 2560x1440 and the shadows at 3072.
- The scene at 960x540 took the draws 9.8 ms a frame against 10.4 at 1920x1080: their time is not in their pixels.
- Like for like, Vulkan's GPU takes 12.3 ms a frame against D3D12's 24.4 (60 fps at the game's cap, against 35.4).
  With its VRAM mirrors off, Vulkan's draws take 11.6 ms (6.7 with them) and its GPU 42.4: the gap is mostly the
  memory the draws read.
- The upload ring in the GPU upload heap: no gain, not kept.
- The market's mesh draws: 3.0 ms of the GPU's 24.4 a frame (§7).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With its replay on the submitting thread (RX_VK_ASYNC=0, mirrors on) the Vulkan back end ran at 45.1 fps against 49.6
on its render thread, both with pass timing, its GPU unchanged: about a tenth. Without mirrors its Threaded
rendering's Auto is off as unsafe, so the mirrors-off run was on the submitting thread too.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RX_D3D12_BORDER_COLORS, RX_D3D12_DXC, RX_D3D12_HOME_TRACE, RX_D3D12_MESA and RX_D3D12_SERIAL had a row in
gpu/vk/switches.def but no word in the docs. Each is now described where its topic is: Mesa's DLL with the shader path's
choice (d3d12.md 3.3), DXC's with the native mesh shaders' route (7.1), the home trace beside the home check on the way
back (5.1), the serial barriers with DRED (d3d12-tools.md 4), and the border colours with the A/B switches (2.4).

What each says is taken from the code that reads it (border_mode, home_trace_at and home_trace_size, serial_barrier in
d3d_draw.cpp; dxc in d3d_hlsl.cpp; mesa in d3d_shader.cpp) and from its row. tests/test_doc_anchors.py passes; no
heading changed.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check read Stage's, Program's and Shader::Info's members with brace counters of its own: one split a struct's body
at the semicolons outside braces, another dropped brace initializers and array bounds, a third split a declaration at
the commas outside < > and [ ]. The braces are now cut by srccut's block (which also skips braces in literals,
comments and preprocessor lines), the < > and [ ] groups by a regular expression applied innermost first, and the
one slice it took with str.index (program_for after its stage check) by srccut's find. Every cut names its source,
so a renamed or doubled marker stops the check with srccut's one message naming the file and the marker.

Checked against the base's copy of the check: the same 14, 17 and 88 members read from Stage, Program and
Shader::Info, the same (no) failures, and the three compiled pieces byte for byte the same. The check passes, and
passes with SRCCUT_CHECK_NAIVE=1. Against a scratch copy of d3d_progcache.cpp with a marker renamed or doubled, it
stops with srccut's message.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A store of constant buffer views (kept by address and size in a CPU heap,
copied into the ring when the same range comes again) was tried in the
market: 64 % of the views were copied, yet the replay took 2.94 to 2.99 s
in 5 against 2.81 to 2.86, at 36.1 to 36.6 fps against 37.0 and 37.1
(three runs against two, the GPU the same). The CPU cost bullet now says
so, beside the loop's numbers that suggested it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The switches are the game's environment variables, and docs/d3d12.md and docs/d3d12-tools.md are where a reader finds
them; at the base before T-0009 five rows were named in neither. The new check reads gpu/vk/switches.def with the SW and
GONE row shapes of tests/test_switch_table.py and fails, listing each name and where such a switch is described, when a
live row's name is held whole by neither doc. Names the docs hold with no row or a GONE row are printed as notes only.
It sits in a file of its own, as test_switch_table.py fails at this base for a reason of its own, and runs its reading
on made-up text first so a match grown too loose fails too.

Checked: it passes at the head (64 live rows); on a copy of the docs with RX_D3D12_SERIAL renamed it fails naming
RX_D3D12_SERIAL; tests/run_all.py --list picks it up.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_desc_counts.py, test_bank_gen.py and test_capture_resources.py each carried a brace counter of their own. They now
cut with tests/srccut.py (block, between), so a missing or doubled marker stops each with srccut's one message naming
the source and the marker. What each check asserts is unchanged. Checked: the first two pass with
SRCCUT_CHECK_NAIVE=1 (each block cut equals the old counter's); the four blocks and the recording span test_capture_resources
cuts are identical to the old counter's text; a marker renamed in a scratch copy stops each with srccut's message.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
In the market operator new took 3 % of the replay threads' time on the CPU. The new check cuts live_prepare, sampler_table,
read_indices and upload_indices out of d3d_draw.cpp and runs them under a counting operator new: once to grow what they
keep, then again and again, where they must allocate nothing and still give the same copies back, tables and indices.
draw_one's vectors of indices are read from the source.

At this commit it fails: live_prepare makes 4 allocations a draw while a live copy is open (its held and out vectors),
sampler_table one for each table made again once the heaps went round, and read_indices and upload_indices 3 a draw.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
In the market operator new took 3 % of the replay threads' time on the CPU. On the way from the draw op to the recorded
draw, these allocated for each draw:
- live_prepare, while a live copy is open: its held and out vectors, made for the draw. They are kept now, as its views
  and global already were (replay_mu), and emptied for each draw.
- sampler_table, for each table its heap does not hold yet (each table again after the heaps go round, 8 to 11 times a
  second): an unordered_map node. The tables are now an open-addressed array, twice the heap's slots, so never half full;
  an entry is valid only for the round it was made in, so a heap's turn empties it without touching it.
- read_indices and upload_indices (8-bit indices, and the indices made for quads, fans and loops): the raw bytes and the
  narrowed copy, and draw_one's vectors of indices. Each is the thread's now, grown and never shrunk.

Checked with tests/test_d3d12_draw_alloc.py, which fails at the commit before and passes here, and with each check that
reads d3d_draw.cpp or d3d_draw.h run alone (17 of them, all passing, test_d3d12_sampler_heap.py and
test_d3d12_index_scan.py among them).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The common draw allocates nothing once its buffers have grown (2410f344).
Standing still in the market, the one clean run against two base runs: the
replay 2.76 s in 5 (2.82), 37.2 fps (37.2 and 37.1), frame time median
26.7 ms (26.6 and 26.7). A second run waited once for a pipeline, a third
met an event in the game: both written down beside it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GPU-based validation reported error 1358 in the save's loading: a pixel stage read a subresource of a 128x128x6 cube
target through its SRV in RENDER_TARGET. Each draw route takes its tables first, where texture_srv moves the levels a view
covers to the shader-resource states, and binds its targets after, where bind_targets moves the level each colour view
draws into, all its layers, back to RENDER_TARGET.

The new check cuts texture_srv, target_level_state, view_levels, target_sampled, the texture key, bind_targets and the
draw targets' struct out of the source and runs a draw's order on a stand-in list that keeps a state per subresource and
checks each barrier's StateBefore: a cube of 8 levels drawn level by level and sampled through a view of all its levels
(and of levels 2 to 7), a one-level target bound at a slot the draw does not write and sampled, a draw that samples A and
draws into B (the same barriers as in the base's order), a draw that samples where it writes (counted, its program named
once), and 4,000 random draws. It also reads that draw_one, mesh_one and mesh_native_one note their colour targets before
their tables and bind what colour_taken left.

At this commit it fails: each level of the cube drawn leaves 6 subresources the SRV covers in RENDER_TARGET, and the
target not written is bound and in RENDER_TARGET as it is sampled. The draw that samples A and draws into B passes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw that sampled the target it draws into, through a view over the level it draws, read that level in RENDER_TARGET:
texture_srv moved the view's levels to the shader-resource states, then bind_targets moved the drawn level back. What
the GPU reads then is undefined, and GPU-based validation reports it (error 1358, the ambient light's cube in the save's
loading).

Each draw route (draw_one, mesh_one for its draw's stages, mesh_native_one for all of its stages) now notes its colour
targets, the level each slot draws into and the slots it writes, before its tables are taken (colour_note, into
draw_colour, as draw_depth is noted). texture_srv's render-target branches ask colour_view: a view over a level drawn
after others is cut to the levels before it (its LOD still from its first level), and only those are moved; a view from
the drawn level of a slot the draw does not write (colour write mask 0) marks the slot, which bound_as then binds as the
null view, so the target stays in its shader-resource state; a view from the drawn level of a slot it writes is a feedback
loop no D3D12 state allows: left as before, counted in the replay's line (rings_line) and its program named once in the
log (colour_taken), as the Vulkan back end names those. A draw that samples none of its colour targets pays a loop over
its slots. The render target line RX_D3D12_LOG_TEXTURES logs now gives the target's levels.

Checked: tests/test_d3d12_colour_sampled.py passes (it failed before), and the D3D12 checks that read these files pass
run alone; test_d3d12_texture_found.py's harness takes a stand-in colour_view.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fix of b44cc189 gets its own section (8.5), beside 8.2's depth targets. It covers:
- why draws sampled subresources in RENDER_TARGET;
- the three cases, and what each does;
- what GPU-based validation of the save's loading saw before and after;
- the market's numbers, and the check.

Section 11 and d3d12-tools.md's notes on error 1358 now say what is fixed. A draw that samples the level it writes is
only counted: the market has about 18,000 a run.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main moved scripts/dev_build.py into scripts/dev.py and scripts/devtools/build.py (#1802), and the rebase dropped
the branch's d3d12 command with the old script. It is back as `dev.py d3d12 [--copy-to DIR]`: longshot_d3d12.dll
built by gpu/d3d12/build.py through the job queue as a light job, with the compilers at once `dev.py vk` takes,
its export checked, and copied into a game folder's bin/ on --copy-to. gpu/d3d12/build.py and docs/d3d12.md name
the new command. tests/test_dev_build.py checks the command line, the copy and the Windows-only stop.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main replaced docs/development.md, docs/design.md and docs/cpu-profile.md with docs/dev/ (#1802). The D3D12
docs, the bench README and a doc: comment pointed at them: they name docs/dev/developing.md's Share a PC,
docs/dev/reference/profiling.md's switches and architecture.md's rules from MKW now. The Vulkan market number
that development.md held is cited as it was, since main's docs no longer carry it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rebase onto main brought interface 36 and three changed headers the back end compiles with:
- nvn_invalidate_quick (version 31): the host asks it before it gives up the game thread's virtual core for
  nvn_invalidate. This back end's invalidate does nothing and never waits, so it answers 1: done, the core
  kept. OoT invalidates per shape per view.
- hold_gpu::choose lost its on argument (RX_VK_HOLD_GPU_WAIT is gone): the same choices as before, since
  RX_D3D12_HOLD_GPU_MS=0 already made 50 ms its most.
- target_overlap::ShiftedOver replaces shifted_over: the newer targets' parts in a dead target's storage are
  added up, an overlap counted once, so two that each cover less than an eighth of it and together more let it
  go, as the Vulkan back end now does (its targets grew to 3-4 GB at the driver's limit without it).
  targets_dead feeds it in start order, as it takes them.
tests/test_d3d12_dead_targets.py's own record adds the parts up too, with a case of a sixteenth over the head
and one over the tail (let go) and two covers of the same tenth (kept). tests/test_d3d12_switch_docs.py reads
main's table, whose rows are HOS_ and LONGSHOT_ names too. docs/d3d12.md section 8.4 says the rule.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's ASTC decoder (gpu/vk/host_shaders/astc_decoder.comp, #1553) takes two more push constants, blocks_x and
blocks_y, the level's blocks across and down, and leaves every block past them undecoded. The Direct3D 12 back
end pushes the 8 words the decoder took before; the two new ones are 0 there, so since the rebase onto main no
ASTC block is decoded on the GPU. The check compared the push block with 8 words written into it and missed
that.

It now reads the decoder's push block from its source and builds the words the Vulkan back end gives it
(gpu/vk/vk_texture.cpp upload_astc_gpu) from VULKAN_PUSH, field by field, in the shader's order; a push
constant the shader gains that the check does not know fails it. It fails here: "the push block has 8 words;
the decoder takes 10: blocks_x blocks_y never pushed".

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's ASTC decoder (#1553) takes blocks_x and blocks_y after the Switch 2's tiling and decodes no block past
them. AstcLevel's push block grows to the decoder's 10 words, and upload_astc fills the two new ones with the
level's blocks across and down, as the Vulkan back end does (gpu/vk/vk_texture.cpp upload_astc_gpu: tw, th).
astc_decode already copies the whole block (sizeof a.push) into the root constants.

tests/test_d3d12_astc_gpu.py passes; with the new line taken out it fails on "push word 8 (blocks_x) is 0, the
Vulkan back end pushes 128". The nine checks that read d3d_internal.h or d3d_texture.cpp pass with --strict
(clang++ 23.1.5; this PC has no GCC: llvm-mingw's g++ is clang).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dev.py ab measures a switch within one run (HOS_AB) when its reader asks for the A/B's value at each use. It
finds those readers in the source by hos_ab_value("NAME", ...), the host's, so a renderer's reader, which asks
through MkwVkHost.ab_value (interface 36: gpu/vk/vk_draw.cpp's RX_VK_MESH_CONV), is never found, and dev.py ab
measures such a switch in separate runs. The check now expects RX_VK_MESH_CONV among the switches found, and a
host->ab_value("NAME", ...) reader in a source of its own; hos_ab_value_at, the host's own function, is no
reader. It fails here: {'HOS_OS_YIELD', 'HOS_COLLECT_WIDE', 'HOS_OOT_BARRIER_WAIT'}.

(test_options_keys_in_source in the same file fails on main 702a57a4 as here.)

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The source scan for HOS_AB's readers takes ab_value("NAME", ...), so it finds a renderer's reader,
host->ab_value("NAME", ...) (MkwVkHost.ab_value, interface 36), as well as the host's hos_ab_value. dev.py ab
then measures gpu/vk/vk_draw.cpp's RX_VK_MESH_CONV within one run, as its reader was written for, and the
Direct3D 12 back end's switches once they read the A/B. developing.md says where a renderer's reader asks.

tests/test_dev_ab.py's test_wired_from_source passes; with the old pattern it fails on
{'HOS_COLLECT_WIDE', 'HOS_OS_YIELD', 'HOS_OOT_BARRIER_WAIT'}. test_doc_anchors passes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RX_VK_FRAME_TRACE=1 now writes logs/longshot_frames.csv (frames.csv in
HOS_PROFILE_DIR) from the D3D12 back end too: a line a present with the
frame's time, the replay's waits for translations and pipelines, the
draws left out meanwhile, the translations' and pipelines' time, the
texture uploads, the replay's own time and its waits for ring space,
at_ns and ab_side. The columns keep the Vulkan trace's names where they
mean the same, so an A/B within one run (HOS_AB) measures D3D12 too.
The work counters keep running sums beside their 5 s window.

tests/test_d3d12_frame_trace.py runs the cut tracer and sums on a
stand-in host, reads the lines back with dev.py ab's and perf.py ab's
readers, and fails 8 broken variants.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both are now read once a command list (list_switches), from the host's
A/B (MkwVkHost.ab_value, interface 36) or else the environment. A
list's draws all see one value, so the banks and uniform copies it
keeps for its later draws are made under one, and nothing is kept past
a list. dev.py ab measures either within one run.

tests/test_d3d12_ab_switches.py checks the reads and send_if_long and
fails 5 broken variants; tests/test_d3d12_cbufs.py runs its random run
with the host flipping RX_D3D12_WHOLE_CBUFS between lists;
tests/test_hos_ab.py lists the two and reads gpu/d3d12 for wired
switches too.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A test switch, off by default: where the card has GPU upload heaps, a
draw's constant buffers, indices and copied vertex streams go in a
second upload ring of 256 MB there, as the Vulkan back end keeps its
streams in VRAM; a texture's copy stays in system memory. It is read
once a command list (list_switches), so HOS_AB may flip it within one
run, and setup makes the ring when the switch is on or HOS_AB names it
(upload_vram_wanted).

In the market, one in-run A/B (23 periods of 3 s a side, no frame
cold), it made no difference: -0.06 % in frame time, 95 % interval
-0.50 to +0.37 %; the replay thread 14.51 ms a frame against 14.53.

The docs say so, and that dev.py ab cannot drive this back end past the
title screen yet (no option hook, so Skip title screen never reaches
the game): the way to run an A/B by hand, and the market's
RX_D3D12_WHOLE_CBUFS=1 result (+1.16 %, 95 % interval +0.65 to
+1.64 %).

tests/test_d3d12_ab_switches.py now builds the real Ring, upload_take,
ring_upload and rings_flushed as well: a list's draws take the ring
its switch names when the ring was made, a texture's copy the one in
system memory, each ring goes round over lists that end; 14 broken
variants fail. tests/test_hos_ab.py lists the switch as wired.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw's indices and vertices, and the storage buffers no stage may
store through, are read in the pools opened in place: system memory,
across PCIe, on every draw. RX_D3D12_MIRRORS=1 (a test, off by
default) gives each pool those reads reach a copy in the GPU upload
heap, which the CPU keeps in step itself: filled as it is made at a
present, the pages the CPU wrote copied in at each collection, before
the submit's work is recorded. No copy, barrier or command list of the
GPU's. GPU work still writes the pools in place: the pages it writes
are marked as it is recorded, and a read over them stays in place. A
stage that stores global memory may store through any storage buffer
it binds (the task and mesh stages' table at c0+0x880 is unwritten in
their descriptors), so all of its storage buffers count as written.
A pool the game frees keeps its buffer (pools opened in place are never
closed): its copy is given up within 8 presents (inplace_current),
released once the GPU passed the open list, and its room goes to the
pools refused before. Read once a command list, so HOS_AB flips it.
RX_D3D12_MIRROR_MB (1536) caps what is held at once.

RX_D3D12_MIRROR_AUDIT=1 compares 4 MB of guest memory a present with
each page's sum as the CPU last copied it in, and reads 64 KB of the
copies back. In the game (market and Hyrule Field, four teleports,
330 s), before the freed pools' copies were given up: 136,487 pages
changed with no write found, every one in memory no pool held; 1536 MB
held, 389 pools refused. After: none in a pool the game has, none of
249,483 pages read back changed, 633 MB held, none refused.

Measured in the market (B580; HOS_AB, 20 s periods after 240 s, one
run): frame time 27.27 -> 25.95 ms (-4.8 %, 95 % interval -5.3 to
-4.4 %), 36.7 -> 38.5 fps; the GPU 23.5 -> 20.6 ms a frame, the draws
to the 1920x1080 target 10.1 -> 7.8 ms. Shots on and off alike.

tests/test_d3d12_mirrors.py runs the mirrors' code against a model of
the CPU's writes, collections, GPU writes, reads and a pool freed and
made again; 18 broken variants fail.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gpu/d3d12/build.py links longshot_d3d12.dll with lld's /map, as nx2/build.py links the Vulkan back end, and
dev.py d3d12 --copy-to copies the map beside the DLL. scripts/profiling/symbols.py reads longshot_d3d12.map, so
perf.py threads, renderer and chain name the Direct3D 12 replay's frames (longshot_d3d12:<function>) and count a
sample in it as running, not waiting.

tests/test_profile_d3d12_names.py checks it without the game; it fails on the symbols.py before this.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
After each report of the passes' GPU times, a line gives the GPU's idle a frame between command
lists (from one list's last timestamp to the next one's first), the part before a frame's first
list, and the part the GPU waited for the replay: the gaps before lists it began within 0.25 ms
of their submit, each list's submit put on the GPU's clock with GetClockCalibration. It names the
passes those lists began with.

In Castle Town's market (B580, driver 32.0.101.9175, 2026-11-21): 3.33 ms a frame idle in 37.7
gaps, 2.52 ms of it waiting for the replay's next list (7.2 gaps a frame), 0.54 ms before a
frame's first list; with RX_D3D12_MIRRORS=1, 4.77 ms, 4.30 of it waiting. The lists' GPU time and
the idle add up to the frame time (23.52 + 3.33 ms against 26.87).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A queue stopped at a wait for an event left the open command list open: what was recorded
before the wait went to the GPU only after the event's signal and the next RX_D3D12_SEND_EVERY
draws, and the GPU idled meanwhile. send_at_stop sends it as the queue stops, once a stop, so
the GPU runs it while the queue waits. RX_D3D12_NO_SEND_AT_STOP=1 keeps it open, as before; it
is read at each stop, so HOS_AB may flip it.

In Castle Town's market (B580, HOS_AB periods of 20 s after 240 s): frame time 26.70 -> 26.42 ms
(-1.0 %, 95 % interval -1.7 to -0.4 %); the GPU's idle between lists 3.15 -> 2.82 ms a frame.
About 2.6 lists a frame are sent at a stop, 49 draws and dispatches in each.

tests/test_d3d12_resume_collects.py runs both ways: the list goes to the GPU at the stop, once
(not again when the stopped queue is looked at or a submit queues behind it), and stays open
when the host's A/B answers RX_D3D12_NO_SEND_AT_STOP=1.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RX_D3D12_GPU_TIMES' idle line splits the GPU's wait for the replay's next list further: the time
a queue was stopped at a wait for the game's signal, the gaps a stopped queue went on in (split
where it went on: before it the game had not signaled, after it the replay recorded the work
after the wait), and the time the replay ran a queue's work in them; the rest it had none.
The replay notes each queue's stop and each run (diag_stopped, diag_replay_ran) on the CPU's
counter while the timers are on, and nothing otherwise.

In Castle Town's market (B580, 2026-11-21) the GPU waited 2.02 ms a frame for the replay's next
list, the replay running in 1.87 ms of it: the replay's recording, not the game, holds the GPU
there. 1.2 gaps a frame ended as a stopped queue went on: 0.27 ms before it went on, 0.34 after.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the open list sent as a queue stops at a wait, the lists a frame are the GPU's cost to
watch: each list's start was 0.02 to 0.03 ms of the GPU's idle. In Castle Town's market (B580,
HOS_AB periods of 20 s after 240 s): 256 against 128, frame time -1.3 % (-2.0 to -0.7 %),
27.8 lists a frame against 38.7, the GPU's idle between lists 2.53 ms a frame against 2.85.
512 against 256 showed no difference (+0.2 %, -0.5 to +0.9 %).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw whose atomics write a storage buffer of a pool opened in place ran them there, in system
memory across PCIe. It now takes the buffer's home in VRAM (RX_D3D12_BOUNCE_HOMES), as a
dispatch's bounce does. The copy in goes on the open list, so the draw starts a list of its own
(copy_split), and live_back_all sent every live copy back as that list closed: the draw's take
copied in and out four times and the draw was left out. A copy made live for the draw being
taken is now fresh: the list sent on the way keeps it live, and the take made again on the next
list uses it. Fresh ends with the draw (live_settle), drawn or left out; left out, the copy goes
back unwritten. A draw's copy goes in a home only, never the bounce ring, whose slot goes with
the list sent; and only when its other stage binds no storage buffer over it and reads no global
memory. RX_D3D12_NO_DRAW_BOUNCE=1 runs it in place, as before.

In Castle Town's market (B580, one build, the switch on and off, a run each, 31 windows of 5 s):
a 480x270 pass's 1.1 ms a frame falls under the GPU report's floor (0.15 ms), the GPU's lists
take 23.5 -> 22.5 ms a frame, and the windows' median goes from 38.6 to 40.1 fps.

tests/test_d3d12_draw_bounce.py cuts the live set, live_back_all, live_settle and copy_split
out of the source and takes a draw's copies with a list sent on the way, with the bounce ring
full, for a draw left out, and over 400 random rounds, against a model of the pools: what each
pool holds after the lists end is what the draws wrote. The old live_back_all (the copies sent
back at the split), a settle that leaves them fresh, and one that keeps a left-out draw's copy
written each fail it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The copies in VRAM of the pools a draw's geometry and its read-only storage buffers read (docs/d3d12.md
section 5.2), a test until now, are made and read unless RX_D3D12_MIRRORS=0; a device without GPU
upload heaps makes none, as before. The switch's row becomes a kill switch. HOS_AB still flips it
within a run, and the mirrors are made and kept in step whenever either side wants them.

In Castle Town's market (B580, A/Bs within one run): turned on while off by default, -4.8 % in frame
time (95 % interval -5.3 to -4.4 %); turned off once on by default (RX_D3D12_MIRRORS=0), +3.5 % (+2.0
to +5.0 %), 38.6 fps against 40.0, the replay thread 16.2 ms a frame on both sides. In runs of their
own, the draws to the 1920x1080 target take 10.1 -> 7.9 ms a frame on the GPU. A shot at 300 s
showed the HUD and the far background right.

tests/test_d3d12_ab_switches.py: unset (and empty) is on and =0 off, from the environment and with
HOS_AB flipping it either way; list_switches reading it off unless set fails. tests/test_d3d12_mirrors.py
runs the model unset and with =0 (none made, none taken) and without GPU upload heaps; mirrors_wanted
off unless asked, or deaf to =0, fails.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
DXIL has no float atomic add (Shader Model 6.6 added only float exchange and compare-exchange),
so each RED/ATOM.ADD.F32 is Eden's compare-exchange loop, which gives up after 1024 tries (issue
17's ceiling). Where a subgroup's invocations all add to one word, each ran its own loop: an
atomic round trip per attempt, all but one failing, and past the ceiling the add is lost.

With the profile's new combine_f32_adds (the D3D12 profile's; RX_D3D12_NO_WAVE_FADD=1 turns it
off), a compute stage's float add to a storage buffer goes through CombinedF32Add: when every
active invocation adds to the same word, the subgroup's sum (OpGroupNonUniformFAdd Reduce) is
added by one invocation's loop (OpGroupNonUniformElect), and each invocation gets the word the
loop found plus the adds before its own (ExclusiveScan, BroadcastFirst): what the loops would
have returned run one after another in that order. Otherwise each runs its own loop, as before.
Compute stages only, which have no helper invocations. Sirit gains OpGroupNonUniformElect and
OpGroupNonUniformFAdd. The Vulkan profile never asks for it: its emission is unchanged.
Mesa's spirv_to_dxil makes WaveActiveAllEqual, WaveActiveSum, WavePrefixSum, WaveIsFirstLane
and WaveReadLaneFirst of them. The switch is in the program cache's stamp.

On the B580 (the two shapes' DXIL run outside the game, 262,144 adds of 1.0 to one word): the
loops took 167 ms and lost 81 % of the adds at the ceiling; summed first, 6.4 ms and 8 % lost.
A group's adds, partial waves and adds to 2 and 4 words came out exact both ways.
In Castle Town's market (in runs of their own, the switch on and off), the one dispatch a frame with
such adds took 1.30 ms on the GPU against 1.45 with a loop each; a shot at 300 s looked the same.

tests/test_native_float_atomic_add.py builds the combined add in its Sirit fixture, asked and
not, in a compute and a fragment stage, and with the device's own add: only the asked loop in a
compute stage has the subgroup's ops (one elect, all-equal and broadcast, a reduce and an
exclusive scan, the loop called twice), every module passes spirv-val, the D3D12 profile asks
unless switched off and its stamp holds the switch, and the Vulkan profile never asks.
tests/test_d3d12_program_cache.py takes a switch whose value is in the stamp.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
list_switches reads RX_D3D12_MIRRORS with env_int since the mirrors went on by default (69cbe429),
and tests/test_d3d12_cbufs.py's harness, which cuts list_switches, had only env_on: the check
stopped building. Its env_int answers with the default, as the run's other switches are unset.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The replay's 5 s line (rings_line) now says how many resource barriers the window recorded, by kind: transitions of
buffers (and apart, those between geometry reads and storage writes), of textures' subresources, UAV barriers of the back
end's own (mesh fallback, copies) and those the game asks for. To tell how many a frame takes before changing how they
are batched. Counted where each barrier is recorded (count_barriers, under replay_mu); no switch, as the count is a
few adds a barrier.

tests/test_d3d12_colour_sampled.py cuts BarrierKind from d3d_internal.h and stubs count_barriers for the cut functions.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The game's CPU signal of an event lets the queues stopped at a wait for it go on, and their replay ran on the
signalling thread: OoT's main thread replayed a frame's main pass there, 7.4 ms a frame in Castle Town's market (a
profile at 41 fps), while the thread that presents waited for the replay's lock 7.25 ms a frame.

RX_D3D12_SIGNAL_THREAD=1 (a test) leaves that replay to the back end's own thread (the watcher), and the signal's
thread goes on at once. The work keeps the game's order: whichever comes first of the watcher's turn, a submit, a
present, a fence wait or the next signal replays it (catch_up) before anything else the replay does. The texture and
sampler registrations made meanwhile are kept (copied and checked as they come) and made once that replay is done, so
the work after the wait looks them up as they were at the signal. What it reads of guest memory is read when it is
replayed, up to the replay's length after the signal, as a GPU's would be. Read at each signal; HOS_AB may flip it.
Every 300 presents the log says how many signals went to the watcher, and how many of those a game's thread replayed
first.

In the market (B580, an A/B within one run, 3 s periods after 240 s): 41.8 -> 42.8 fps, -2.36 % frame time (95 %
interval -2.88 to -1.86 %), p99 29.0 -> 26.7 ms. 2,832 signals went to the watcher, 10 of them replayed first by a
game's thread. A shot of each side (300 and 303 s) looked right; nothing new in the log.

tests/test_d3d12_resume_collects.py runs it: the signal's thread returns with the queue still stopped, the
registrations after the signal wait and are made in order after the watcher's replay, and a submit, a present or a
second signal before the watcher's turn replays the left work first, with the registrations as they were at its
signal; the switch off from the host's A/B replays at once. Six variants broken by hand (registrations made before the
replay or never kept, no catch-up in submit, in drain or at the next signal, the switch ignored) each fail it.
tests/test_hos_ab.py names the switch's reader.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
translator_stamp hashes every RX_VK_ and EDEN_ variable set, as the translator may read any of them. RX_VK_FRAME_TRACE,
RX_VK_PASS_TIMING, RX_VK_SLOW_LOG and RX_VK_PRECOMPILE are read by no translation, yet with them in, a run with the
frame trace on made the program cache again, and the next one without it again: 30 to 90 s of translations at the
start of each such run, inside the warm-up of an A/B or a timing run. They are left out now (kNotTranslation).

tests/test_d3d12_program_cache.py reads the list from the stamp and fails when the translator's sources (gpu/vk's eden,
sirit and compat) or the stamped ones read one of its names. The first run after this commit translates its programs
again once (the stamp's sources changed).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The replay a CPU signal lets go on (RX_D3D12_SIGNAL_THREAD, docs/d3d12.md section 6), a test until now, is left to
the back end's own thread unless RX_D3D12_SIGNAL_THREAD=0; the switch's row becomes a kill switch. HOS_AB still flips
it at each signal.

A queue's fence value (fence_of, the game's FenceSync) is answered under a lock of its own (last_mu, last_values) set
by submit, not under the replay's: a game's thread asking it no longer waits while the watcher replays.

In Castle Town's market (B580, an A/B within one run, 3 s periods after 240 s), turned off once on by default
(RX_D3D12_SIGNAL_THREAD=0): 42.2 -> 41.0 fps, +2.78 % frame time (95 % interval +2.21 to +3.36 %), p99 27.5 -> 30.3
ms. Turned on while off by default, before the fence's own lock: -2.36 % (-2.88 to -1.86 %). The run booted, went
through the title screen and the load into the market with it on: 21,761 signals went to the watcher, 1,503 of them
replayed first by a game's thread; nothing new in the log, and a shot of each side looked right.

tests/test_d3d12_resume_collects.py: the runs written for a signal replayed on its thread have the host's A/B answer
=0; the watcher's runs take the default (unset, with the A/B answering the normal value, and with a host that has no
A/B) as well as =1; a queue's fence is asked on another thread while the replay's lock is held, and answered with its
last submit's value (a queue with none: the last value handed out). fence_of under replay_mu, fence_of answering the
last value handed out for every queue, and the switch off unless set each fail it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The swap chain's Ref was a static: its destructor ran with the other static destructors at the process's exit and
released the swap chain there, which raised an exception in DXGI. The crash handler then logged a crash at every quit,
the swap chain's static destructor at the top of its stack: in each of the 40 and more runs of 2026-11-21 before this
change. The Ref is now made once and never destroyed; the process's end frees the swap chain.

No game-free test: the exception is DXGI's, at the process's exit. In the game (B580, driver 32.0.101.9175, Castle
Town's market, two runs of 330 s quit through the control socket) each log ends with the host's stop line and holds no
crash.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The root signatures mark each constant buffer range's data volatile (root signature 1.0's rule). Left static, version
1.1's default, a driver may load it ahead, and every draw's constant buffers are its own copies in the upload ring,
written before its list runs, so it would have been safe. Measured in Castle Town's market (B580, driver 32.0.101.9175,
one run each way, RX_D3D12_GPU_TIMES): 41.7 fps both, the GPU 19.84 and 19.83 ms a frame, the main pass 8.16 and 8.13
ms. The test switch is not kept; docs/d3d12.md section 4 and the root signature's comment say what was measured.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each was built and measured in Castle Town's market (B580, driver 32.0.101.9175, 2026-11-21) and is not kept; the docs say
what was found, so the next look starts from it.

- VRAM mirrors (section 5.2): a read over pages GPU work marked stays in place for the rest of the run. Counted for it, of
  the 0.92 million such reads in each 600 presents, 3 % were over pages no GPU work had marked in those 600 presents or
  the 600 before, and 147 of the 148.5 MB marked were marked again in every 600: marks that aged out would move few reads.
- Lists sent for an idle GPU (section 6): the GPU waited for the replay 3.7 ms a frame. Sending the open list once it held
  64 draws and dispatches while the GPU had run past every list before it came out +0.56 % in frame time (+0.07 to +1.05
  %; an A/B within one run), 42.0 -> 41.8 fps: about 10 more lists a frame, each with its copies back.
- The game's barriers (section 6): about 160 a frame, each a UAV barrier over all resources; half came with no UAV bound
  since the last on the same command list. Leaving those out (but for any that ordered indirect data) showed no
  difference: -0.26 % (-0.79 to +0.24 %), 42.3 and 42.4 fps, shots of both sides alike. The section's line also said a
  barrier was "one global enhanced barrier", which the code never was: it now says what is recorded.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): the homes' comparison compares a tile of 16 KB a group
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
0c1ca72213
A home a view wrote goes back to its pool through back_diff.comp, which compares it with its shadow and writes the 256-byte
blocks that differ. Counted in Castle Town's market (B580, driver 32.0.101.9175, 2026-11-21), 67.7 MB a frame were compared
and 0.88 MB had changed: the reads are the pass's cost. Nearly all of it goes back within a list, about 20 passes a frame,
from a chain of compute dispatches with global memory, each sending back the homes the one before it wrote.

A group now compares a tile of 4096 words (16 KB, 64 blocks), 16 words an invocation, a wave's lanes at words side by
side, instead of 256 words a word an invocation; the words of a changed block are written from what was read. Measured
standing in the market, two runs of one build but for the shader, 150 s each: the pass 2.04 -> 1.17 ms a frame (20.5
passes), the GPU in lists 19.6 -> 18.8 ms, 42.6 -> 44.1 fps (the median of 31 windows of 5 s). No device lost.

tests/test_d3d12_back_diff.py runs the shader's own main() as C++ on tiles (ranges of 1 word to past two tiles, a tile's
last block partly past the end) and checks back_diffs' groups reach each tile once; six broken variants of the shader and
the group count each fail it. docs/d3d12.md section 5.1 says what was counted and measured.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 (build 29704), Intel Arc B580, driver 32.0.101.9175, RX_D3D12=1 at 2560x1440: from the title into the game; Kokiri Forest, Zora's River and the areas after it, and Castle Town's market; runs of 240 s with no device removed; the head's code at 44 fps standing in the market (2026-11-21).

Tested in game: Windows 11 (build 29704), Intel Arc B580, driver 32.0.101.9175, RX_D3D12=1 at 2560x1440: from the title into the game; Kokiri Forest, Zora's River and the areas after it, and Castle Town's market; runs of 240 s with no device removed; the head's code at 44 fps standing in the market (2026-11-21).
Branches, twigs and vines in Kokiri Forest draw black under D3D12. Their
vertex stages read the normals the game stores as RGB10A2SN, and
unpack_patch refused those stages: "the attribute read other than a
component at a time". Its scan takes any operand word equal to the
attribute's id, or an access chain's, for a read of it, literals too. In
each of the three stages, GLSL.std.450's Sqrt (instruction 31, a literal
of OpExtInst) met the attribute at location 2, whose variable was id 31.
Left as it was, the stage read the four unsigned fields as floats (about
1e-42), normalize() made NaNs of them, and the colour target's NaN guard
wrote black.

Seen: in a capture at the spot, the black draws' vertex outputs 5 and 8
were NaN at every vertex (1602 of 1602), from rsqrt(0) of the normal;
their vertex stages had no decode. The game's log named the three
programs among 28 refused, all for that reason; their SPIR-V had one
operand word each that matched, the literal 31.

The test adds a stage whose literal operands equal in_attr1's id and an
access chain's: an extended instruction's number and a switch's cases. It
fails here, the stage refused for that reason; the fix follows.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Branches, twigs and vines in Kokiri Forest drew black: unpack_patch
refused their vertex stages, which then read their RGB10A2SN normals as
zeros (the test's commit says how that was seen).

Its scan took every operand word equal to the attribute's id, or an
access chain's, for a read of the attribute, literals too, and an
OpExtInst's instruction number (GLSL.std.450's Sqrt is 31) met an
attribute variable of id 31. The scan now skips the literals of the
instructions Eden writes in functions, and the operands past one that are
never pointers: an extended instruction's number, memory and image
operands, composite indices and shuffle components, merge and loop
controls, a switch's cases, branch weights, a function's control, a
variable's storage class, group operations, OpLine. A refusal names the
opcode in the log.

The translator's sources changed: the program cache starts again, and
the first run translates every program it meets.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A glitch seen while playing was a screenshot and a save to bring back,
and the save to replay before any log of it. With RX_D3D12_MARK_KEY=1,
F9 in the game's window marks the spot: the next frame's picture goes to
logs/marks/mark<n>_present<p>.png, and its draws to the log (the draw
log, 4000 of them unless RX_D3D12_LOG_DRAWS_MAX says) after the line
"mark <n>". So each mark has the picture and what drew it, side by side,
from the player's own run. 64 marks a run at most; the Vulkan back end's
RX_VK_DUMP_KEY is the same key.

RX_D3D12_MARK_FILE=<path>: that file appearing marks too (looked for
every 10 presents, then deleted), for a test that steers the game, as
RX_VK_DUMP_FILE does for the Vulkan back end.

A mark moves the draw log's frame (draw_log_mark): the frame after the
present, whole, in place of RX_D3D12_LOG_DRAWS's.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ground fog at the save's spot drew in dashes on the Direct3D 12
back end, not on the Vulkan one. Its particles are drawn twice: a depth
pass into a half-size depth target, then a pass that samples that depth
and discards a pixel whose own depth (SV_Position.z) is past it, so that
only the nearest particle is shaded. Both passes draw the same positions,
to the bit, in the same order. At a lattice of pixels the second pass
discarded the nearest particle too: RenderDoc's debugger, stepping one of
those pixels, computed a depth equal to the stored one and kept it; the
GPU (an Arc B580) discarded it. Its pixel shader's depth is there one
float past the depth its depth test stored for the same triangle.

Read with the depth one float nearer (a test build's switch), the fog's
half-size layer at the spot had 85 holes with all 8 neighbours lit,
against 6,945 in the same run without; the Vulkan back end, whose native
mesh shaders draw the particles, has 95 there.

The check cuts Eden's position read and the back end's policy out of the
sources and runs them with a stand-in context that evaluates what they
emit: on Intel's GPUs a fragment stage's PositionZ one float toward zero
(RX_D3D12_FRAGZ_NUDGE=<n>: n floats on any GPU, 0 off), the rest of the
position, other stages, a stage that writes depth and other vendors read
as they are. It fails here: nothing moves the read.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ground fog drew in dashes on the Direct3D 12 back end: its particles'
second pass discards a pixel whose own depth is past the depth their
first pass stored, and on Intel's GPUs a pixel shader's SV_Position.z is
at some pixels one float past the depth its depth test stored for the
same triangle (the test's commit says how that was seen).

Eden's position read (EmitGetAttribute) now reads a fragment stage's
PositionZ frag_z_nudge floats toward zero: a positive finite depth more
than that many floats above zero, in a stage that does not write depth
(the depth it writes stays the rasterizer's, for the depth tests after
it). The Direct3D 12 back end sets frag_z_nudge in translator_init from
frag_z_nudge_for: 1 on Intel's GPUs, 0 on the rest, which are not
measured; RX_D3D12_FRAGZ_NUDGE=<n> gives n on any GPU, 0 off. Its value
is in the translator's stamp. The Vulkan back end leaves it at 0.

Measured at the save's spot (the fog's half-size layer, holes with all 8
neighbours lit, one run each): 6,945 before, 107 with this build, 95 on
the Vulkan back end. The screenshot's dashes are gone.

The translator's sources changed: the program cache starts again, and
the first run translates every program it meets.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): the pipeline store: no draw waits for a pipeline an earlier run made
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 13s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
198dbfc833
Intel's own cache of compiled shaders stops at 512 MB, which a few hours
of play fill; past it, a pipeline an earlier run made is compiled again,
up to 10 s each (a 12-minute session on the B580: 6,557 pipelines in
179 s of the workers' time, the longest 10.3 s). The store keeps the
driver's blob of each pipeline the workers make in the game folder's
cache/longshot_d3d12_pipelines.bin, under a key of what made it, and
the next run makes the pipeline from that blob (CachedPSO): 937
pipelines in 0.28 s.

On the B580 a graphics pipeline made from a blob draws slower: the
scene pass took 4.32 ms a frame, against 3.08 ms with pipelines made
from their shaders (39.7 fps against 42.7). So each is made again from
its shaders on an idle worker (job_push_idle: only while no job is
queued, two at a time at most, at the lowest priority) and put in place
of the blob's at a present; the blob's is let go once the GPU has
passed the work that drew with it. Draws never wait for that. Timing
runs at the save, the store full: 42.7 fps, 20.63 ms of GPU time a
frame (20.65 without the store), the scene pass 3.04 ms. Compute
pipelines from blobs run as fast and are kept.

RX_D3D12_NO_PIPELINE_STORE=1 turns it off (and RX_D3D12_DEBUG does);
RX_D3D12_PIPELINE_STORE_MB (4096) caps the file. The replay's line
counts the store's pipelines and the ones made again apart.

tests/test_d3d12_pipeline_store.py runs the file, the stamp, the key on
d3d12.h's own structs, make_pipeline, and the remakes with their swap
and release; tests/test_d3d12_workers.py runs the idle lane.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Pushed six commits:

  • The pipeline store (198dbfc8): the driver's blob of each pipeline is kept in cache/longshot_d3d12_pipelines.bin, so no draw waits for a pipeline an earlier run made, even after Intel's own 512 MB cache has dropped it. On the B580 a graphics pipeline made from a blob draws slower (the scene pass 4.3 ms against 3.1), so each is made again from its shaders on an idle worker and swapped in at a present. Timing runs at the save: 42.7 fps with the store and without it. docs/d3d12.md §3.7.
  • F9 marks (5570090d, RX_D3D12_MARK_KEY=1): the next frame's picture and its draws in the log, for a glitch seen while playing.
  • Two fixes, each after a game-free test that fails before it: branches, twigs and vines drawn black in Kokiri Forest (2fe63d57, 7ecb2376), and the ground fog drawn in dashes on Intel's GPUs (bf3082db, 22055729).

The description's Summary and Testing say so.

Pushed six commits: - **The pipeline store** (198dbfc8): the driver's blob of each pipeline is kept in `cache/longshot_d3d12_pipelines.bin`, so no draw waits for a pipeline an earlier run made, even after Intel's own 512 MB cache has dropped it. On the B580 a graphics pipeline made from a blob draws slower (the scene pass 4.3 ms against 3.1), so each is made again from its shaders on an idle worker and swapped in at a present. Timing runs at the save: 42.7 fps with the store and without it. `docs/d3d12.md` §3.7. - **F9 marks** (5570090d, `RX_D3D12_MARK_KEY=1`): the next frame's picture and its draws in the log, for a glitch seen while playing. - **Two fixes, each after a game-free test that fails before it:** branches, twigs and vines drawn black in Kokiri Forest (2fe63d57, 7ecb2376), and the ground fog drawn in dashes on Intel's GPUs (bf3082db, 22055729). The description's Summary and Testing say so.
At Resolution 100 % the 3D was black under the HUD on the Direct3D 12
back end, and only there. The game's gameplay upscale network does not
translate here (its matrix multiplies), and a compute pass that does not
translate and writes the frame larger than it reads it is replaced by a
pass of the back end's own (upscale_stub). At 100 % the network's
full-size pass reads the 3D (RGB9E5) at the output's own size and writes
the picture (R11G11B10F): the stand-in took only an output larger than
its input, so it turned that pass away and nothing wrote the picture.
The run's log says so: the pass "is not stood in for: no smaller colour
texture it samples", its texture and its image both 2560x1440. At 75 %
the same network is stood in for (1920x1080 to 2560x1440) and the 3D
draws. The Vulkan back end's stand-in takes the gameplay networks'
same-size pass.

The check cuts upscale_stub, the stand-ins' struct and their two
definitions out of the source and runs them on stand-ins for the
textures a pass binds, the views it makes and the command list it
records on: the gameplay pass at each Resolution share (100, 75, 66.7
and 50 %) and the movie's are stood in for (the stand-in, its views,
push constants, dispatch and barrier); a same-size pass in other
formats, an output smaller than its input and a pass whose only image
it also samples are turned away. It fails here: the pass at 100 % is
turned away.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): the upscale stand-in takes the gameplay pass at Resolution 100 %
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
9fc7828fba
At Resolution 100 % the 3D was black under the HUD on the Direct3D 12
back end: the gameplay upscale network's full-size pass, which does not
translate here, reads the 3D at the output's own size, and the stand-in
turned away any pass whose output was not larger than its input, so
nothing wrote the picture (the test's commit says how it was seen).

upscale_stub now also takes a pass whose output is its input's size
when it is the gameplay network's: the 3D (RGB9E5) into the picture
(R11G11B10F), on the gameplay stand-in, as it takes the same network's
passes at the smaller shares. Any other pass the same size, and an
output smaller than its input, is still turned away. The Vulkan back
end's stand-in takes the same pass by the network's key; this one goes
by its formats.

Run at the save's spot on an Arc B580 (Resolution 100 %, shadows at
3072, one run): the log says the pass "is the gameplay upscale stand-in:
2560x1440 to 2560x1440" where it said "is not stood in for", and the
screenshots show the scene under the dialogue where it was black, at
39.5 fps (38.5 to 39 with the 3D black, an earlier run at the same
spot). tests/test_d3d12_upscale_stub.py passes; each of four changes to
the rule (the old one, any R11G11B10F output taken at the same size,
every same-size pass taken, a smaller output taken) fails it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): the player's settings, read through the Insert menu's own rows
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
bccb32555f
The Direct3D 12 back end left the host's option() null, so the host
took its own fallback for every id: the game's dynamic resolution (75 %
here), its 1600-pixel shadows, and every row of longshot_options.ini
at its default, whatever the player chose (field of view, camera
speed, hold toggles, button prompts...).

d3d_options.cpp reads the file once, at mkwvk_init, before the host can
ask, through the menu's model and modules (gpu/vk/menu_model.cpp,
gpu/vk/menu/*.cpp), built into the DLL for their keys, limits and
defaults alone (MENU_LAYOUT_ONLY, build.py's menu set), so a key or a
limit cannot drift from what the Vulkan back end's menu saves.
vk_menu.h gives such a build the options alone: its Vulkan include and
the menu's functions are fenced off, nothing changes for Vulkan.

option() answers as the Vulkan back end's does: the game's rows as the
file has them, with menu_init's upgrades of an older file and the
environment's switches over them (HOS_REALTIME_STEP, HOS_DYNRES,
HOS_SKIP_OPENING, HOS_OOT_CHEATS); the Resolution row's share as the
fixed path's scale; the Shadow resolution's Auto by the preset's tier
or this card's (auto_settings.h). The renderer's own answers are this
back end's: no menu, HDR, upscaler jitter or render thread. Nothing is
written: the - and = keys' mouse sensitivity holds for the run.

tests/test_d3d12_options.py builds it with the modules and runs it on
files (defaults, limits, the tiers, toggles, upgrades, the environment,
option_set), runs Vibration strength's steps and the fixed path's scale
beside vk_menu.cpp's own, and finds every id the host asks and every id
the Vulkan back end answers among options_answer's cases.

In the game at the save's spot on an Arc B580 (the test folder's file:
Resolution 100 %, Shadow resolution Auto, memory budget tier 4): the
log reads the file's 91 rows of the menu among its 163 lines and says
"Resolution 100%, Shadow resolution 3072 (Auto: tier 4)"; the scene
draws at 2560x1440 (the gameplay upscale stand-in, 2560x1440 to
2560x1440, after the fix before this commit) and the shadow maps at
3072x3072, at 39.5 fps, where the host's fallbacks drew it at the
game's 75 % and 1600-pixel shadows at 41.5 to 41.8. With HOS_DYNRES=1
over the file (Resolution Auto) the same build draws the scene at
1920x1080, the shadows still at 3072, at 42.0 fps.

The other checks that read the changed files (73, with the builder's
clang++) pass as they did before it: eight fail on this PC with this
change and without it alike, and two need the Vulkan SDK's headers.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The temporal upscalers read OoT's scene camera from the uniform buffer
its scene draws take: the view-projection at 0x30, the projection at
0x70 (its w row at 0xa0), the jitter as the picture moves (-P[0][2],
-P[1][2]) and the target's size at 0x120. vk_temporal.cpp and
vk_fsr3_inputs.cpp each read those offsets themselves, and the Direct3D
12 back end's frame chain needs the same reading.

gpu/vk/scene_camera.h is that reading as a plain function, no Vulkan:
parse() takes a block and the target's size and gives the matrices, the
jitter, and the near and far planes and the vertical field of view when
the projection is a plain perspective one (an infinite far plane as
1e9). Nothing in the Vulkan back end changes: its two readers stay as
they are.

tests/test_scene_camera.py builds blocks from a known camera (no game
data): a jittered perspective camera, an infinite far plane, a wrong
size, an orthographic projection, each word of the w row changed, and a
projection with no plain perspective. It also checks that the two Vulkan
readers read the block at the header's offsets (the core ones at least,
none outside them), so the three stay one layout. Breaking the jitter's
sign, the w row's -1, the near plane's formula or the infinite far plane
fails it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): Intel XeSS draws OoT's gameplay upscale
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 11s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
526eb60ab9
OoT's gameplay upscale is a network on cooperative matrices, which no
retail shader model has: on Direct3D 12 a stand-in draws it, an FXAA
without history (d3d_draw.cpp upscale_stub). With XeSS asked for (the
Upscaler row's Intel XeSS or its Native AA, or RX_VK_XESS=1 / 2 over the
row, as the Vulkan back end reads them), Intel XeSS SR draws it instead.

d3d_xess.cpp loads the player's libxess.dll where the Vulkan back end
looks for it (RX_VK_XESS_DIR, the executable's folder, the game folder)
through GetProcAddress, against Intel's MIT headers: xess_d3d12.h is
added to third_party/xess beside the Vulkan one, from the same commit,
the tree hash written again. It logs the library's version and each
preset's smallest input, and has the library build its pipelines in the
background at start. A context is made for the render size's preset
(xess_rules.h, shared, so the preset is the Vulkan back end's) and made
again only when the size leaves its range; an old one is destroyed once
the GPU is past it.

d3d_temporal.cpp is the Vulkan back end's frame chain on this back
end's passes:
 - the scene's camera and depth, from its largest draw of the frame into
   the scene's R11G11B10F target (draw_one and mesh_one note them), the
   camera block read by gpu/vk/scene_camera.h, each frame's own: the
   upscale that uses it takes it;
 - at the gameplay upscale, one pass makes XeSS's colour (the network's
   input, square-root encoded: LDR), depth and the camera's motion
   (dlss_prep.comp, translated by the new builtin_pass), XeSS executes,
   and its picture is squared back into the network's output
   (dlss_out.comp). XeSS's own heaps, root signature and pipelines leave
   the list's bound state unknown (list_state_lost): the next draw sets
   it again;
 - the host's jitter while XeSS draws (.jitter_sample and options 24 to
   26), and with Native AA the 3D at the output's size (options 2, 3).
Anything missing on a frame leaves it to the stand-in, the reason
logged. When XeSS fails for good, its context and the chain's images
are let go as the GPU passes them.

The jitter is made for the size XeSS drew last. The first run in the
game stopped XeSS for good after about 30 frames: the first context's
447 ms had the game's dynamic resolution drop to 953x536, and as it rose
again a frame's jitter, made for the smaller size, was past half a
pixel, which XeSS refuses as an invalid argument. xess_jitter holds a
jitter up to a sixteenth of a pixel past at the half and leaves a frame
further past to the stand-in, the history kept and the host told the
size drawn. tests/test_d3d12_xess_jitter.py cuts it out and runs it on
the host's own jitter (dlss_math.h) for every phase at four sizes: made
for the size drawn, a step smaller, half, larger, and not a number. It
found a y that was not a number passing through std::max: each axis is
now checked alone. Breaking the hold or the sixteenth fails it.

RX_VK_XESS and RX_VK_XESS_DIR are left out of the translator's stamp
(kNotTranslation): they choose the upscaler, and with them in, a run
with XeSS asked for started the program cache again, and the next run
without it again. d3d_shader.cpp is stamped: the cache starts again
once with this build.

tests/test_d3d12_upscale_stub.py stands in for XeSS's hook: the gameplay
pass goes to XeSS first, the stand-in records nothing when XeSS draws it
and draws it when XeSS does not, and the movie's pass and the passes
turned away never reach XeSS. tests/test_d3d12_options.py checks
RX_VK_XESS and the Upscaler row's XeSS and Native AA.

A second agent reviewed the chain cold. Its three findings are fixed
here: a frame whose scene was not noted was drawn with the camera,
jitter and depth of the frame before (the camera is now taken by the
upscale that uses it, as the Vulkan back end's is); a context made just
now went on with the old history when one of its images was not made on
that frame; and after XeSS failed for good, its context and images were
kept for the rest of the run.

In the game on an Arc B580 (driver 32.0.101.9175), Kokiri Forest at
Resolution Auto with RX_VK_XESS=1: XeSS drew every gameplay frame of a
100 s run, 4,200 frames at 1920x1080 to 2560x1440 (Ultra Quality), at
40.7 fps; its first context took 28 ms of CPU (447 ms the first time on
this PC, the driver compiling Intel's kernels). Again with the review's
fixes, from an empty program cache: XeSS drew every gameplay frame after
the first, through the dynamic resolution's drop to 854x480 while the
cache filled (made again for Ultra Performance, 40 ms) and back to
1920x1080, no jitter held or left to the stand-in. The shots are XeSS's,
sharp, with no black or broken areas. Not yet: the skinned draws' own
motion (a walking character ghosts a little), letting XeSS's 138 MB go
when the upscale stops, and HDR (this back end presents SDR).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): the preparation: the game's shaders translated ahead of play
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
8800c38cd0
A first visit to an area translates each program where a draw first
needs it. The workers make the back halves meanwhile (docs/d3d12.md
section 3.6), but a dispatch waits for its program, and the program
cache (section 3.5) keeps only what play has met. With
RX_D3D12_PREPARE=1, d3d_prepare.cpp translates every program of the
game's shader list into the cache, on a thread of its own while the game
runs. The list is longshot_shaders.bin beside the game, which the build
writes from the game's archives (nx2/shader_census.py) and the Vulkan
back end's precompile reads.

prepare_program (d3d_shader.cpp) translates a program as a draw with
nothing bound would, as the Vulkan back end's seed_program does:
 - its key made from the stages' heads as a draw makes it, and looked
   up in this run's programs and in the cache before anything is parsed;
 - float colour outputs and vertex inputs, and a vertex program that
   reads attributes 6 and 7 also with them as RGBA8UI (the skinned
   models' bone indices);
 - each texture as its stage reads it, which still_valid checks against
   the bound ones at play;
 - a compute stage's c0 laid out from its own control section
   (cs_layout_assume, checked before the thread's copy of its last
   program, whose serial the blank state shares), its uniform and
   storage buffer tables answered as holding buffers' addresses.
A program that asks whether any other constant-buffer word holds a
storage buffer's address is left to play, as is one that fails with
nothing bound (neither kept, logged nor counted: a draw's state may
translate it) and the mesh programs. Compute programs go first; 16 back
halves at a time are on the workers, taken as they end.

The program cache's file now lists the records a run adds as it adds
them, so a draw of the same run reads a prepared program back instead of
translating it again; progcache_has tells the preparation what is there.

tests/test_d3d12_prepare.py cuts out the list's reader and runs it on
lists written there (each stage's place read; a list cut short or made
wrong refused with its reason), and c0's layout code (the assumed
layout, also after the blank state's own lookup; the buffer tables'
words, 16 of each at the most), and checks the wiring. Moving the
override after the thread's copy fails it. tests/test_d3d12_program_cache.py
reads a record back in the run that added it, which fails without the
listing.

Measured in the game at the save spot (an Intel Arc GPU; the game
played on meanwhile, at 12 to 24 fps), three runs, each going on from
where the one before stopped:
 - all 38,809 programs of the list looked at, 45,017 variants
   translated into the cache (7,828 of them for bone indices), none
   failing in its back half;
 - 25.6 minutes in all: 4.9 and 15.0 with 8 workers, then the last
   27,214 variants in 5.8 with RX_D3D12_WORKERS=16 (the workers are
   what holds it up);
 - the cache 3.3 GB; each run read what the one before kept (7,063
   programs at the second's start, 18,342 at the third's);
 - left to play: 1,312 mesh programs and 71 that fail with nothing
   bound; none that ask after a constant-buffer word, none this back
   end does not draw.

RX_D3D12_PREPARE has its row (attempt) and its place in docs/d3d12.md
section 3.5. d3d_shader.cpp, d3d_shader.h, d3d_bank.cpp and
d3d_progcache.cpp are stamped: the cache starts again once with this
build.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): Intel XeSS Frame Generation and XeLL
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
1562ccc83f
Intel's XeSS Frame Generation (XeSS-FG) makes frames between the game's
from the depth and motion XeSS draws from; Intel's Xe Low Latency (XeLL)
paces the frames for it, and on its own begins each frame as late as the
GPU allows. Intel makes both for Direct3D 12 alone. With RX_D3D12_XEFG=1
the back end makes one frame between two of the game's (=2 and =3: two
and three, as far as Intel's library makes them on the GPU);
RX_D3D12_XELL=1 turns XeLL's latency reduction on by itself, =2 its
markers alone.

d3d_xell.cpp loads libxell.dll where libxess.dll is looked for, and
gives XeLL the Vulkan back end's Reflex markers at the same places: the
sleep after the present, out of the replay's lock, then the next frame's
simulation start and input sample; at the game's present the
simulation's end and the submission's start, the submission's end at the
last list sent, and the present's start and end around Present. A
frame's markers come only after its sleep returned, with an id one up a
frame (Intel: the sleep is a new id's first call). With the latency
reduction on, XeLL paces the frames in place of the swapchain's
waitable. Every 600 frames the log has XeLL's own reports, averaged.

d3d_xefg.cpp loads libxess_fg.dll, makes its context with XeLL's, and
makes the swapchain through XeSS-FG's proxy, without the frame latency
waitable object (swap_make falls back to the plain one; ResizeBuffers
keeps the flags the swapchain was made with). The gameplay upscale gives
it, after XeSS's execution, XeSS's depth and motion in the state they
keep until the present, and the camera: the view (the projection's
inverse times the view-projection) and the projection made Direct3D's
(z from 0 to w, as the depth is), without the jitter, in Intel's order
for row vectors. Each present takes XeLL's frame as its id; a frame
whose inputs were not given (no XeSS, the stand-in, the menus) is
presented with the generation off. The HUD is interpolated with the
picture, Intel's default.

scripts/fetch.py xefg fetches the two libraries (XeSS-FG 1.3.1.78 and
XeLL 1.3.2.10) from XeSS's commit, each checked against its SHA-256,
into a game folder with --game, and XeSS-FG's headers beside them in the
development folder's sdk/xefg, which dev.py's builds pass on as
LONGSHOT_XEFG_SDK. Those headers carry Intel's proprietary notice: they
never go into the repository, and a build without them has no frame
generation (and says so in the log). XeLL's headers are MIT and join
third_party/xess.

tests/test_d3d12_xell_xefg.py runs XeLL's markers and sleep frame by
frame, its reports and XeSS-FG's camera against stand-ins (6 broken
variants fail), and checks the wiring in present(), present_start,
swap_make and the gameplay upscale. tests/test_xess_sdk.py checks the
xefg table: XeSS's commit, the names the back end loads, the headers
kept out of a game folder.

Measured in the game at the save spot (Intel Arc B580; 1920x1080
drawn, XeSS Ultra Quality to 2560x1440, a 1280x720 window; 150 s runs
of this branch's builds, the program cache read whole):
 - XeSS alone: 40.7 fps;
 - RX_D3D12_XEFG=1: the game at 37.4 fps, and once the gameplay began
   XeSS-FG made a frame between every two of the game's (600 of 600 in
   each count, none failed): about 75 frames a second on screen, 1.84
   times as many;
 - RX_D3D12_XELL=1 and =2: 41.1 fps either way; XeLL's reports 23.4
   and 23.5 ms from a frame's simulation start to its present's end, 15
   of them the replay's submission. The frames do not queue there, so
   the latency reduction has little to take away.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The host's samplers (HOS_SAMPLE_ALL, HOS_PROFILE, HOS_SLOW_FRAMES, host/mkw_glue.c) take the guest's threads and those
whose description starts with "mkw_vk". The D3D12 back end's threads had no name, so at the save the watcher's replay of a
frame's main pass, most of the replay, was in no sample: the presenting thread waited 15 ms a frame for replay_mu and what
held it did not show. The watcher, the retire thread, the workers and the preparation are now "mkw_vk d3d12 <what>"
(thread_named), and the watcher's 16 ms a frame show: draw_one 29 %, stage_tables 17 %, target_for 7 % of its samples.

ReplayPin: whichever thread replays (a game thread's submit, the watcher, the present, a fence wait's drain) runs, while it
replays, on the core the host keeps from the game's threads (HOS_RESERVE_CORE), and goes back to its own processors after,
as the Vulkan back end's replay does (vk_replay.cpp). The outermost pin pins; nested ones count. RX_D3D12_REPLAY_PIN=0
leaves the threads where they are, read at each outermost pin so HOS_AB may flip it.

Measured at the save spot (B580; Core i5 of 6 performance and 8 efficiency cores, the reserved core a performance one;
XeSS on; one run, HOS_AB periods of 3 s after 60 s): 38.4 fps pinned, 38.5 not, -0.13 % (95 % interval -0.46 to
+0.14 %). No difference on this CPU, whose scheduler kept the replay on performance cores already; on by default to
match the Vulkan back end.

tests/test_d3d12_replay_pin.py runs ReplayPin and pin_on, cut from d3d_replay.cpp, against stand-ins of the host and
Windows' affinity calls: the thread's processors while pinned and after, nested pins, the switch flipped between pins,
no host or no reserved core; five broken variants each fail it. test_d3d12_workers and test_d3d12_resume_collects take
stand-ins of thread_named and ReplayPin. docs/d3d12.md section 6 and docs/d3d12-tools.md say what was measured and how
the threads are named.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): the dead render targets' resources pooled for the next of their shape
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
59ef9adcbd
At the save spot about 9 render targets a frame die and as many are made: each a committed resource made on the replay's
thread through the kernel, and let go a few presents later. With the replay's threads named (the commit before), the
watcher spent 7 % of its samples in target_for, most of it in win32u.dll under CreateCommittedResource.

A dead target's resource is now kept (pool_put, at target_free), and the next target asked of the same description and
format takes it (pool_take, in target_for, newest first), as its last target left it, its levels' states with it, cleared
to 0 as a new one is. The oldest go first past the most (RX_D3D12_TARGET_POOL_MB, 256), none is kept more than 60
presents, and the device lost keeps none. Target::asked keeps the description its resource was asked for, the pool's key.
RX_D3D12_TARGET_POOL_MB=0 makes each one and lets it go as before, read at each put and take so HOS_AB may flip it. The
targets' log line counts those made of pooled resources and those kept.

Measured at the save spot (B580, driver 32.0.101.9175; XeSS on; one run, HOS_AB=RX_D3D12_TARGET_POOL_MB=0, periods of
3 s after 60 s): 36.7 -> 37.4 fps, frame time -1.8 % (95 % interval -3.7 to -0.1 %), p99 45.1 -> 33.0 ms. About 1,300
targets died every 150 presents, and with the pool on nearly every new one took a pooled resource (26,000 in the run).

tests/test_d3d12_target_pool.py runs pool_put, pool_take and pool_trim, cut from d3d_texture.cpp, with target_for's and
target_free's calls: a resource back for its own description and format and no other, the newest first, the most and
the 60 presents, the switch at 0 (nothing kept, the pool emptied at the next take), a target made of a pooled resource
cleared; seven broken variants each fail it. test_d3d12_dead_targets takes the pool's stand-ins and the log line's new
counts. docs/d3d12.md section 8.4 says why and what was measured.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): the fallback's mesh draws recorded in batches (RX_D3D12_MESH_BATCH, off)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 24s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
71e2d1be06
A fallback mesh draw on its own is six steps that each wait for the one before, about 30 µs a draw on the B580 (73 a
frame at the save spot, about 10 ms of GPU time). RX_D3D12_MESH_BATCH=<n> (2 to 16) records up to n of them in a row
together: headers and counts, task stages, one UAV barrier, mesh dispatches' counts, mesh stages, draw arguments, then
the draws in the stream's order, one ResourceBarrier call between steps. Members: no stage writing memory, targets in
their draw states already, the same targets as the first. Each member has its own records buffer (slot k, 64 MB, made
the first time a batch reaches it) and a 256-aligned part of one payload buffer; the push block's pointers carry the
view index above the byte offset. The batch waits while nothing else is recorded: cmd, cmd_open, cmd_flush and
target_free record it first, a pending batch counts as a copy for the copy split, and a take asks for the list only when
it records (home_take, live_prepare, buffer_use_now, target_level_state). bind_targets splits into what it marks and
what it sets (BindKept, targets_set) so a member binds when the batch is recorded.

Save spot, HOS_AB 8 vs off with the frame trace: frame time -1.71 % (95 % interval -2.21 to -1.18 %), 40.1 to 40.8
fps, no device lost; batches average 1.5 draws, 97 % ended by other work, so it stays off (docs/d3d12.md 7.2).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nyannoying force-pushed feat/d3d12-renderer from 71e2d1be06
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 24s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 95eeede988
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 23s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-21 20:07:57 +00:00
Compare
test(d3d12): the mesh batches, checked without the game
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
f001adeace
tests/test_d3d12_mesh_batch.py cuts the batches' code out of gpu/d3d12/d3d_draw.cpp (MeshMember to mesh_batch_join,
mesh_batch_emit and the part of mesh_one that joins a draw, with what they call there) and the hooks of cmd(), cmd_open(),
cmd_flush() and target_free(), and plays a seeded stream of about 5,500 mesh draws on a model of the command list that
follows each buffer's state, the uses no barrier has ordered yet and the data. It checks each member's steps in order,
the UAV barriers, every transition from the state the buffer is in, the draws in the stream's order with their own state,
targets and arguments, the records slots and payload parts apart, each batch's end where it is due and counted, and a
batch waiting recorded before anything else on its list. Twelve broken variants must fail, each by a check.

Passes with clang++ and g++ (about 4 s); docs/d3d12.md section 7.2 names it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A live copy no view wrote goes back to its pool with nothing recorded (live_back: only its home stops being live), yet
live_prepare asks for the open list whenever a copy goes back. Asking records a mesh batch waiting first (cmd()'s hook),
which ends the batch: at the save spot (2026-11-21, RX_D3D12_MESH_BATCH=8, a diagnosis build naming the caller of each
batch's end) 5,934 of 8,762 ends in 5 s came from there, a mesh draw whose stage reads global memory sending back the
homes the mesh draw before it had taken, none of them written. The batches held 1.5 draws.

tests/test_d3d12_live_clean_back.py cuts LiveRange, LiveSet, Home, live_prepare and live_back out of
gpu/d3d12/d3d_draw.cpp and runs them over stand-ins (a command list that counts what is recorded, cmd() with its hook as
gpu/d3d12/d3d_device.cpp has it): unwritten homes sent back by a stage with global memory or over part of a view, a
written copy among them, no batch waiting; and a broken variant that asks for the list whenever a copy goes back.

It fails here, for that reason (clang++ and g++): "a stage with global memory sent back homes no view wrote: the list
asked for 1 times, the batch waiting recorded 1 times".

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): live copies that go back unwritten ask for no command list
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
657e12cdde
live_prepare asked for the open list whenever a live copy went back to its pool, though a copy no view wrote goes back
with nothing recorded (live_back only makes its home not live). Asking records a mesh batch waiting first, which ends
it: two of every three batches ended so at the save spot, a mesh draw whose stage reads global memory sending back the
homes the mesh draw before it had taken. Now the list is asked for only when one of the copies was written; live_back
takes a null list when none was.

Measured on the B580 in nightly 695's game (Saria's dialogue at the save spot, RX_D3D12_MESH_BATCH=8):
- the batches: 1.5 draws each before (8,964 batches of 13,794 draws in 5 s), 3.7 after (3,825 of 14,261); the
  caller of each end named by a diagnosis build;
- HOS_AB=RX_D3D12_MESH_BATCH=8,3,70 with the frame trace (30 and 29 periods a side): frame time -4.04 % with batches
  (26.21 to 25.16 ms, 38.1 to 39.8 fps; 95 % interval -8.14 to -0.21 %), p99 -3.0 ms, no device lost (-1.71 % before);
- the debug layer reported nothing with batches of 16, from the title to the save spot.
Batches stay off by default.

tests/test_d3d12_live_clean_back.py passes now (clang++, g++), and its broken variant (the list asked for whenever a copy
goes back) fails; the 34 checks that read the changed files pass. docs/d3d12.md section 7.2 has the measurements.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/test_d3d12_mirrors.py built and ran its 20 broken variants one after the other, each through all ten runs: 1,176 s
on Windows, past run_all.py's 600 s a check, which CI uses too. The mirrors and the variants are now built and run at
once (a thread pool, as tests/test_d3d12_mesh_batch.py does), each variant stopped at its first failing run, and the
variants judged only when the mirrors pass: 69 s with clang++ beside 63 other checks, 58 s alone with g++. Every variant still fails.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): mesh batches on by default, up to 4 draws
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
68558e550e
RX_D3D12_MESH_BATCH measured a win once live copies that go back unwritten stopped ending the batches (-4.04 % frame
time at 8, 38.1 to 39.8 fps), so it ships on, as the switches' rule asks. At 4: batches of 8 against 4 at the same spot
(HOS_AB=RX_D3D12_MESH_BATCH=8,3,70 over 4, 30 and 29 periods a side) drew no faster, -0.12 % (95 % interval -0.82 to
+0.54 %, 41.1 fps both), and 4 holds half the records: 4 x 64 MB of VRAM. Its row is a tune now (0 or 1 draws each on
its own); docs/d3d12.md section 7.2 says so. No shader changes: the program cache stays.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): the Insert menu draws on Direct3D 12
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
c2305b5627
The Insert menu (Insert, F1 or Esc) now works with RX_D3D12=1: the start-up screen, the menu with every tab, the
FPS counter, the Debug tab's tools. vk_menu.cpp, its model and its modules are built into longshot_d3d12.dll as they
are (gpu/d3d12/build.py: the menu, Dear ImGui, the fonts, the zstd decoder the fonts need), and two new files serve it:

- d3d_ui.cpp draws the menu's Dear ImGui lists over the swapchain's buffer once the picture is copied in: its own root
  signature, a pipeline per format, a descriptor heap; its shaders compiled at the first frame by Windows'
  d3dcompiler_47.dll; its textures (font atlas, logo) uploaded through the upload ring and released once the GPU is
  past them.
- d3d_menu.cpp answers what the menu asks the renderer from this back end (the device, driver, VRAM, the FPS
  counter's frames, the draws and textures, XeSS's state, a shot), runs the menu's frame at each present, and gives
  Auto (this PC) the same hardware facts as the Vulkan back end, so its fingerprint matches.

The menu reads and saves longshot_options.ini itself, as on Vulkan; d3d_options.cpp keeps only the host's option()
answers, each the Vulkan back end's expression but where this back end differs on purpose (no HDR, no render
thread, its zstd core, XeSS's jitter and full scale in d3d_api.cpp). tests/test_d3d12_options.py now reads each
answer against vk_replay.cpp's and runs the file with the menu's answers stood in.

RX_D3D12_SHOT_MENU=1 (diag) makes the shots copy the swapchain's buffer with the overlays, so a test can see the menu.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11): three scripted runs (RX_VK_MENU_SCRIPT) at the save:
the menu opens, draws, switches tabs, moves its selection and closes; Debug tools turn on through their warning and
are saved; Switch age made Link adult; the FPS counter draws at its Dev level. Not yet: the breakdown and Dev lines
read 0 (no D3D12 counters behind them yet); the Vulkan back end's own Developer rows show and do nothing.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The FPS counter's Dev lines and Breakdown on Direct3D 12 showed nothing: d3d_menu.cpp kept a ring of its own, its frames
stamped with steady_clock while the menu (vk_menu.cpp fps_texts) reads them at prof_now(), so the Dev lines' "frames
since the last time" were always none, their per-frame values "-", and the Breakdown's parts all 0.

tests/test_d3d12_fps.py reads the sources: build.py builds vk_fps.cpp with the menu and d3d_menu.cpp defines none of its
functions; d3d_api.cpp ends the game's frame at its present and times the renderer's entries on the game's thread; the
waits by their kind (the GPU's, the pacing, the game's main thread); the rings' waits timed once; the GPU time from a
timestamp at each list's start and end; Submits. It runs gpu_wait, cut out of d3d_device.cpp, with a stand-in fence and
counter: a wait for the GPU timed once, as the GPU's; a ring's, a fence already passed, or the Breakdown off: none.

It fails here (clang++ and g++), among others: "d3d_draw.cpp:5439: a ring wait timed into kWorkRingWait is timed by
gpu_wait too (no slot)", "cmd_flush: ExecuteCommandLists is not timed (the Dev line Submits)".

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The FPS counter's Dev lines and Breakdown now show this back end's numbers. d3d_menu.cpp's own ring is gone: the
Vulkan back end's measurements (vk_fps.cpp) are built in, so the frames are stamped with the clock the menu reads them
with (prof_now), and the Breakdown gets its parts:

- d3d_api.cpp ends the game's frame at its present and times the renderer's entries on the game's thread.
- The waits by their kind, each timed once: the GPU's (gpu_wait, the game's fence waits by whether their work was
  replayed, the swapchain's latency wait, the rings' waits), the pacing (the present, XeLL's sleep, the host's
  sleeps), the game's main thread (a present held for a stopped queue).
- The GPU time: a timestamp at each command list's start and end while the Breakdown shows (d3d_device.cpp).
- The Dev lines: draws less dispatches, dispatches, pipelines and their time, passes (draws into other targets than
  the draw before's), the draws left out while their program or pipeline was made, ASTC decodes, bytes uploaded,
  Submits (ExecuteCommandLists' time). No mirrors and no write-backs here; the textures' memory is not counted yet.

tests/test_d3d12_fps.py passes with clang++ and g++. The checks that stand in gpu_wait or read present() and
api_event_signal follow their new shapes.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11): at the save, the Breakdown split a 25.7 ms frame into
15.0 ms renderer, 10.1 ms GPU, 0.5 ms pacing and 0.1 ms main thread; GPU time 22.3 ms; every Dev line filled.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Direct3D 12 the Graphics tab's Upscaler row did nothing until the next start: d3d_draw.cpp's upscale stand-in read
whether Intel XeSS was on from the start, never the row, and drew the row's Off with the game's edge smoothing.

tests/test_d3d12_upscale_stub.py now stands in d3d_temporal.cpp's side of the row (temporal_follow, temporal_stretch)
and checks that each pass follows it once: Intel XeSS chosen at the row draws the very next gameplay pass; the row's
Off draws it as a plain linear stretch (no FXAA, as the Vulkan back end's Off), said in the log; the game's own again
brings the edge smoothing back; the movie's pass is drawn as before.

It fails here (clang++ and g++), among others: "the gameplay pass at 75 % (...): the Upscaler row not followed once at
the pass", "the gameplay pass with XeSS on: XeSS not asked first", "the gameplay pass at the row's Off (...): its push
constants are 2560 1440 2".

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): Intel XeSS and XeSS-FG chosen in the game
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
0353fb6744
The Insert menu's Upscaler and Frame generation rows now work on Direct3D 12 while the game runs, as on Vulkan.

- Upscaler (d3d_temporal.cpp temporal_follow, at each gameplay upscale): Intel XeSS and Native AA draw from the next
  frame. Intel's library is looked for on a thread of its own the first time the menu opens or the row chooses XeSS
  (temporal_probe). Left, XeSS's context and images go, their memory given back once the GPU is past them. Off draws
  the gameplay upscale as a plain linear stretch, as the Vulkan back end's; the game's own is the stand-in again. A
  failure is tried again when the row or the Render resolution changes (temporal_retry).
- The menu's answers are the Vulkan back end's (d3d_menu.cpp): the row offers XeSS once Intel's library is found,
  says why when it is not (RX_VK_XESS=0, no library), and steps through what this PC has.
- Frame generation (d3d_xefg.cpp): XeSS-FG's swapchain is made whenever libxess_fg.dll is beside the game, for the
  most frames this GPU makes (three on the B580), with XeLL pacing the frames as XeSS-FG requires. At each present
  the row turns it on and sets the count: Off none, Auto and 2x one, 3x two, 4x and up three. It is off while the
  menu is open. The FPS counter counts its frames and names it "XeSS FG" (vk_framegen.h FgMaker::XeSS); the Vulkan
  back end's Frame generation by row is not shown. RX_D3D12_XEFG still chooses for a run (=0: none at all); its log
  report comes only while frames are asked for or made.

tests/test_d3d12_upscaler_live.py runs the menu's answers, the rows' changes and XeSS-FG's present with stand-ins
for Intel's calls (clang++ and g++); tests/test_d3d12_upscale_stub.py passes now.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11), driven through the menu (RX_VK_MENU_SCRIPT): XeSS
chosen on the row drew from the next frame; Off drew the stretch; Frame generation at 2x, then 3x, took the counter
from 35 to 106 FPS with "XeSS FG" shown; with the menu open, the game's frames alone.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
40 of OoT's mesh programs got no native mesh shaders on Direct3D 12: "no native mesh shaders, the fallback draws it:
sirit: an operand with no SPIR-V definition (null Id), SPIR-V op 65". The native profile (Profile::hlsl_mesh) has no
descriptor aliasing, so each storage buffer has its u32 view alone, and the 64- and 128-bit global memory helpers searched
the buffers through u32x2 and u32x4 views it never declares. Behind that, 2 more stopped at SPIRV-Cross on
VariablePointersStorageBuffer, which the storage buffers' 8/16-bit compare-exchange helper adds for any program with a
16-bit access, the global 16-bit loads OoT's mesh stages make among them.

tests/native_mesh_globals_ir.cpp emits a task and a mesh stage that load 64, 128 and 16 bits and store 64, 128 and 32 bits
at addresses no bound buffer is known for, through the real shader-info pass and EmitSPIRV, without game files or a GPU.
tests/test_d3d12_native_mesh_globals.py builds it and runs spirv-val on its modules. Native: the stage translates, the
64- and 128-bit helpers read and write word by word through the u32 ones, and there is no VariablePointersStorageBuffer
unless a bound buffer's 8- or 16-bit access needs the helper. Aliasing (the Vulkan back end's profile and the D3D12
fallback's): those helpers keep their own search.

It fails here, with the game's error: "native task: not translated: sirit: an operand with no SPIR-V definition (null Id),
SPIR-V op 65", and the same for the mesh stage. Skipped on Windows, as the other emitter fixtures are.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without descriptor aliasing (Profile::hlsl_mesh, the D3D12 back end's native task and mesh stages) the 64- and 128-bit
global memory helpers are now the u32 helpers word by word, word i at the address + 4i, as EmitLoadStorage64/128 already
read a bound buffer without aliasing. They searched the storage buffers through u32x2 and u32x4 views that profile never
declares: sirit's null Id, and 40 of OoT's mesh programs left to the compute fallback.

And under hlsl_mesh the storage buffers' 8/16-bit compare-exchange helper is made only where a bound buffer's 8- or 16-bit
access calls it. Its pointer parameter needs VariablePointersStorageBuffer, which SPIRV-Cross refuses in HLSL, and it was
made for any program with a 16-bit access, the global 16-bit loads of OoT's mesh stages among them.

Every other profile's SPIR-V is as before: both changes are under no aliasing or hlsl_mesh alone, which only the native
profile has. The translator's sources change, so both back ends' program caches start again once.

tests/test_d3d12_native_mesh_globals.py passes (clang++; spirv-val on its 6 modules) and fails on five broken versions of
the fix: the gate removed, the gate for every hlsl_mesh program, every word at the address, the words for the aliasing
profile too, every store's word the first component.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The B580 runs a task or mesh workgroup of OoT's 32 threads as two waves of 16, and a group barrier holds a wave until every
wave of the workgroup reaches one. tests/test_d3d12_native_mesh_barriers.py builds Eden's SPIR-V back end with a fixture
that emits task and mesh stages under Profile::hlsl_mesh (the D3D12 back end's native mesh shaders) and under the aliasing
profile: a barrier at the top level, after a branch that closed, and in a branch; the warp's barrier (a subgroup's, from
the Ampere lowering) at the top level and in a branch; a mesh stage's branch to no target in a branch, before the
epilogue's barrier.

Here it fails 9 checks, for two reasons. A barrier in a branch, the warp's in a branch and the early return before the
epilogue translate, where a wave that does not reach the barrier hangs the other. And the warp's barrier stays a
subgroup's, which SPIRV-Cross leaves out of the HLSL (HLSL has no wave barrier) while a wave of 16 holds half the warp.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): native mesh stages take a group barrier only where every wave reaches it
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
10abcd35f5
Under Profile::hlsl_mesh (the D3D12 back end's native task and mesh stages) a barrier in a branch, or after a return in
one, now fails the translation, and the compute fallback draws the program. EmitContext::HlslGroupBarrier checks it for the
program's barriers and the stage's own (the epilogue's, after an early return), by the rule the warp's operations already
follow (cf_depth, cf_early_exit). The B580 runs OoT's 32-thread workgroups as two waves of 16: a barrier one wave does not
reach holds the other, or meets it at another barrier, and the draw hangs the GPU.

The warp's barrier (a subgroup's, MEMBAR from the Ampere lowering) is the workgroup's there. HLSL has no wave barrier,
SPIRV-Cross wrote none for it, and the two waves' shared memory accesses went unordered.

Every other profile's SPIR-V is as before: all of it is under hlsl_mesh, which only the native profile has. The
translator's sources change, so both back ends' program caches start again once.

Native mesh shaders stay off by default (RX_D3D12_MESH_NATIVE). Whether this was what hung the first native draw is for
the next run with the switch on.

tests/test_d3d12_native_mesh_barriers.py passes (clang++; spirv-val on its 17 modules), fails without the fix for the
bug's reasons, and fails on eight broken versions of it: either check gone, the warp's barrier a subgroup's again or
without its check, the check or the workgroup's barrier for every profile, the early return not counted, a closed branch
still counted.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the B580 (driver 32.0.101.9175) an ExecuteIndirect whose command signature sets a root constant before DISPATCH_MESH
hangs the GPU once the mesh stage reads a constant buffer, as every translated stage does. The native mesh draws'
signature set the push block's first task workgroup that way, and the first native indirect draw in Kokiri Forest hung
the device. A standalone repro took the parts away one at a time: the same stages and arguments run by DispatchMesh with
the word set from the CPU, or by a signature of DispatchMesh alone; a mesh stage that reads no constant buffer runs under
the root constant's signature; the debug layer reports nothing.

tests/test_d3d12_native_mesh_signature.py cuts mesh_native_ready, mesh_native_one and the indirect ring out of
gpu/d3d12/d3d_draw.cpp and runs them on a model device and command list that execute what is recorded on the words of
their buffers. The signature must hold DispatchMesh's counts alone; an indirect draw of a mesh stage alone dispatches
{count, 1, 1} whatever its first workgroup; an indirect draw with a task stage is the fallback's; a direct draw dispatches
its workgroups with its first workgroup in the push block, and one of more than DispatchMesh takes is the fallback's.

Here it fails at the first check: the signature sets a root argument (a constant) before DispatchMesh.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): native mesh draws dispatch with no root argument in the command signature
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 2m33s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
08cedae0e6
The native mesh draws' indirect command signature now holds DispatchMesh's counts alone, and an indirect draw's
{count, first} is copied to {count, 1, 1}. On the B580 the root constant it also set (the push block's first task
workgroup) hung the GPU once the mesh stage read a constant buffer: DXGI_ERROR_DEVICE_HUNG after about 3.5 s, no page
fault (docs/d3d12.md section 7.1).

A mesh stage alone reads no first workgroup. A task stage reads it from the push block, and an indirect draw's is on the
GPU, where only a root argument in the signature could take it from: such draws (about 7 of the 73 mesh draws a frame at
the save spot) are the fallback's for now. Direct draws are as before, the word set from the CPU. The native draws have a
row of their own in RX_D3D12_GPU_TIMES, "the native mesh shaders".

In the game (B580, a five-minute walk through Kokiri Forest, Castle Town's market and Hyrule Field with
RX_D3D12_MESH_NATIVE=1, the program cache off): no device lost, 40 mesh programs native and 15 not, 62 % of the mesh draws
native. In Hyrule Field the native draws took 2.5 ms of GPU time a frame for 34, the fallback's 3.7 ms for 21.
RX_D3D12_MESH_NATIVE stays off by default until it is measured against the fallback.

tests/test_d3d12_native_mesh_signature.py passes (clang++ and g++), fails on the parent for the bug's reason, and fails on
four broken versions: the root constant back in the signature, an indirect draw with a task stage drawn natively, the
first workgroup copied where the count goes, a direct draw's first workgroup not pushed. The other checks that read the
changed files pass, but those that fail on the parent too or for files this does not change (test_dev_ab,
test_frame_overlap, test_crash_dialog, test_driver_env_choose, test_vk_occlusion_queries, test_target_reuse_memory,
test_present_queue_default, test_linux_pressure).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Direct3D 12 frame trace (RX_VK_FRAME_TRACE=1) gains the columns a slow frame needs to show its cause:

- around the replay: the uploads' time (uploads_ms), the draws seen and dispatches recorded (draws, dispatches), the
  command lists sent and their sending (lists, send_ms), the waits for a list's slot (slot_wait_ms);
- around the present: its wait for the replay's lock (present_lock_ms), its time under it (present_ms), the menu's
  frame (menu_ms), the present's end after its line (frame_end_ms); the CPU's writes collected (collect_ms);
- where the game's frame went, as the FPS counter's Breakdown splits it (game_ms, render_ms, gpu_wait_ms, pace_ms,
  wait_render_ms, wait_gpu_ms, wait_main_ms), and the game's main thread over the frame (main_cpu_ms,
  main_blocked_ms, main_vcore_ms).

The FPS counter's GPU wait counts the waits for a list's slot too (slot_wait_ns): they are the GPU's.

tests/test_d3d12_frame_trace.py runs the trace's line, cut out of d3d_present.cpp, against made-up sums: every column
is what its sum grew by since the last present; broken variants (columns in each other's places, a sum written
instead of what it grew by) fail. tests/test_d3d12_fps.py checks the slot waits in slot_wait_ns, timed once.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11): the walk route (save spot, market, Hyrule Field), the
trace filled; it showed the replay pin's stalls (present_lock_ms 16 to 33 ms) and the market's upload frames.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A read over a page GPU work writes stays in place, in system memory across PCIe. The marks behind that are now four
sets, each read once a command list (list_switches) so HOS_AB may flip them, and counted by a census every 600 presents
(the reads by kind and where each went, the bytes each set marked anew):

- gpu_pages: a storage buffer bound as written by a stage that stores no global memory;
- pointer_pages: the whole pools a pointer table names (c0+0x880). Now left out of where a list's reads go unless
  RX_D3D12_POINTER_MARKS=1: a stage that binds such a pool reads and stores in its mirror, as the Vulkan back end
  binds those pools. At the save spot (HOS_AB, 3 s periods after 150 s): -2.44 % in frame time (-2.76 to -2.11 %),
  51.2 -> 52.5 fps, and -2.46 % in a run before it;
- store_pages (RX_D3D12_STORE_MARKS=0, a diagnosis: -3.50 %, what exact store marks could buy) and back_pages
  (RX_D3D12_BACK_MARKS=0, a diagnosis: +0.02 %, nothing to buy).

Pointers into the mirrors, on unless RX_D3D12_MIRROR_PAGES=0: a pointer no bound buffer holds is followed through a
twin of guest memory's page table, in the GPU upload heap, whose entries point into the mirrors where a page's pool
has one and no mark is over the page. The same A/B: -0.61 % (-0.91 to -0.30 %).

Also, off by default:
- RX_D3D12_KEEP_LIVE=1: the bounce's homes stay live past a list sent on the way (copy_split, send_if_long). Measured
  -0.01 % (-0.36 to +0.30 %): kept as the base RX_D3D12_SEND_IDLE=<n> needs (the list sent once it holds n draws
  while the GPU is idle).
- RX_D3D12_GPU_TIMES=<presents>,draws: each draw timed too, by program and by where its geometry is read.
- RX_D3D12_MESH_NATIVE read once a command list (HOS_AB), and the rings line says why a mesh draw passed its native half.
- docs: the float-add pass a word, tried and not kept (slower in the game).

Tests: test_d3d12_mirrors.py runs the marks, a pointer table's pool in lists that keep or leave out its marks, and the
audit finding a store through one; test_d3d12_keep_live.py runs the homes kept live past a list sent on the way;
test_d3d12_ab_switches.py and test_hos_ab.py the new switches' A/B. The checks whose stand-ins the new calls reach
follow them.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11): the A/Bs above, and five walk-route runs (save spot,
market, Hyrule Field) with the pointer marks left out and the pointers into the mirrors on: no device lost, the shots
the game's.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): the replay where the system puts it, unless RX_D3D12_REPLAY_PIN=1
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 19s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
6c3bce4a51
ReplayPin moved whichever thread replays onto the core the host keeps from the game's threads, and back after. A
thread that moves itself to one core waits until that core is free, and it often was not: on the walk route
(HOS_SAMPLE_ALL and the frame trace) the watcher, and at times the presenting thread, waited there 17 to 31 ms about
12 times a minute at the save spot and 6 in the market and Hyrule Field, replay_mu held, so the present waited for the
lock as long (present_lock_ms 16 to 33 ms against 9) or in its own pin (present_ms 10 ms against 0.2).

Off by default now; RX_D3D12_REPLAY_PIN=1 pins as before (a 'kill' row: the older way). The log names the core only
when the replay runs there.

Measured at the save spot (B580, one run, HOS_AB periods of 3 s after 150 s, XeSS off), unpinned against pinned: the
mean frame 18.88 -> 18.79 ms (-0.42 %, 95 % interval -0.63 to -0.21 %), p99 21.17 -> 20.52 ms, the 1 % low 40.2 ->
46.3 fps, the frames 6 ms or more over their neighbours' median 3.9 -> 0.5 a minute.

tests/test_d3d12_replay_pin.py runs ReplayPin with the switch unset, 0 and 1: unset or 0, the thread's processors are
left alone and nothing is logged; a broken variant with the pin on unless set fails.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): sampled textures placed in shared heaps, the heaps compacted
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
04b73c84ea
Walking through the market and the field, a batch of ~30 new textures came every ~90 frames, and those frames took
10-15 ms more of the replay: each texture was a committed resource, a kernel allocation of 0.3 ms and more
(win32u.dll under D3D12Core.dll in 27 of tex_make's 31 samples). The Vulkan back end places its images in larger
allocations (VMA).

- A sampled texture of 8 MB or less is now a placed resource in a heap of 64 MB (non-RT/DS textures only, not zeroed
  where the runtime takes that), first fit, 4 KB aligned where the device grants it (64 KB else). Its range comes back
  once the GPU passed the list that last used it; an empty heap goes but one. A placed texture is always written whole
  before a draw reads it.
- The heaps' free space is given back (tex_compact, tex_move): without it, the field's textures left 1.4-1.9 GB free
  inside 65 heaps, the process went past the driver's allowance (11.2 of 11.0 GB) and the field ran slower than
  before. Every 10 presents, once the heaps hold 256 MB free beyond a heap's worth (128 MB past 90% of the allowance),
  the emptiest heap's textures are moved on the GPU into the fullest heaps' free ranges, 16 a present and 16 MB at
  most; old resources and ranges are kept until the GPU passed the copy, and a texture moved is let go by the budget
  only after its copy ran. A heap is chosen only when all its textures fit in the others (tried on copies of the
  books); none fitting waits 100 presents. The Vulkan back end's VMA defragmentation does the same.
- The budget leaves out what the compaction gives back, unless it is stuck.

RX_D3D12_TEX_HEAPS=0 makes each a committed resource as before (read at each texture made; HOS_AB may flip it).

tests/test_d3d12_tex_heaps.py cuts the heaps and the compaction out of d3d_texture.cpp and runs them against stand-ins
for D3D12's heaps, resources and command lists (a resource released while the GPU may use it fails): the placement,
alignment and reclaim, the compaction's exact choices, its limits a present, a stuck look, the switch off and a random
run of 4000 steps checking the books against the resources; 29 broken variants must fail.
tests/test_d3d12_dead_targets.py and tests/test_hos_ab.py follow.

Tested in game (Arc B580, driver 32.0.101.9175, Windows 11): the walk route (save spot, market, Hyrule Field), one
run each against a committed resource each: frames with 10 or more new textures 2.5 ms over their neighbours in the
market (8.3 before; worst 6.2, 16.0 before) and 3.3 ms in the field (6.9; worst 5.1, 11.1); the market 46.3 fps
(46.0), p99 24.9 ms (25.7); the field 52.4 fps (50.2), p99 22.0 ms (23.3); the save spot the same. Video memory in the
field 9.6 GB (9.5), past the allowance in 1 of 238 looks, at the field's load; no device lost.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
OoT's depth of field draws a chain of 3 levels of its half-size picture (960x540 R11G11B10F) in a scratch heap, where a
texture of the same shape and format but 1 or 2 levels was drawn before. target_for found a render target by its
storage's address, format, size, depth and samples, not its levels: the chain took the target of 1 level, target_view
left the draws into levels 1 and 2 out (the log's "a view of level 1 of a render target of 1 (960x540): what is drawn
into it is left out"), and the far parts of the picture, which read those levels, read what was never drawn there: the
brown wall behind a shop's close-up of an item, the dark sky between the Deku Tree meadow's leaves, a dark patch over a
forest's canopy (three marks, 2026-11-22).

tests/test_d3d12_target_levels.py cuts same, target_sampled, target_slices, target_for's lookup and its count of the
levels, and target_view out of gpu/d3d12/d3d_texture.cpp and runs them on stand-ins for D3D12's views and heaps: the
chain where a texture of 1 level and of 2 levels was, its levels drawn through views of its own target, each texture
asked again, and the sampled textures each taking the target of its levels.

Here it fails at the first check: the texture of 3 levels takes the target of 1, and the draws into its levels 1 and 2
are left out with the game's log line.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A render target was found by its storage's address, format, size, depth and samples (same). OoT's depth of field
draws a chain of 3 levels where a texture of its shape but 1 or 2 levels was drawn before: the chain took that
texture's target, and target_view left the draws into the levels it lacks out. The far parts of the picture read
them: a brown wall behind a shop's close-up of an item, a dark sky between the Deku Tree meadow's leaves, a dark patch
over a forest's canopy.

same compares the levels as well (0 counted as 1), as the Vulkan back end keys its images (gpu/vk/vk_texture.cpp,
Key): a texture of 3 levels drawn where one of 1 was is a target of its own. A sampled texture takes the target of its
levels at its address, the newest of them; of levels no target there has, the newest of the others, as before
(target_sampled). docs/d3d12.md section 8.8.

tests/test_d3d12_target_levels.py passes here and its 5 broken variants fail; the checks that read d3d_texture.cpp
pass (dead_targets, colour_sampled, target_pool, texture_found, bind_targets, srv_cache, tex_heaps, astc_gpu,
mesh_batch, workers, hos_ab, doc_anchors). The D3D12 DLL builds with no new warning. Not run in the game yet.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(d3d12): the frame trace's replay runs, CPU time, core kind and pools opened; RX_D3D12_REPLAY_PRIORITY
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
bbcaf9ddec
The gameplay spikes at the save spot came with replays that took about twice as long a draw, and the trace could not
say whether the replaying thread worked longer, waited, or was off the CPU. With the trace on (RX_VK_FRAME_TRACE=1)
each replay run now records, at its start, the thread's cycles and the time stamp counter, the core it began on and
whether it runs on the watcher (RunDetail, work_ran). The trace gets replay_runs, replay_cpu_ms (the cycles over the
counter's ticks, times the run's time), replay_slow_ms (begun on a core of a kind slower than the fastest: a hybrid
CPU's efficiency cores) and replay_watcher_ms; and pools_opened and pool_open_ms, the game's pools opened in place
(kWorkPoolOpen, also in the replay's 5 s line). Without the trace nothing is measured.

RX_D3D12_REPLAY_PRIORITY (an experiment, off): 1 runs the watcher and the retire thread above normal priority, as the
Vulkan back end's replay thread runs; 2 also keeps them to the cores of the fastest kind, the core the host keeps from
the game's threads their ideal one. Read at each thread's start; the log says where each runs. Its row in
gpu/vk/switches.def, docs/d3d12.md section 6, docs/d3d12-tools.md section 2.

tests/test_d3d12_frame_trace.py checks the new columns with a stand-in for the run's system calls (19 broken variants
fail); test_d3d12_resume_collects.py and test_d3d12_pool_open_race.py follow work_ran's and work_add's use;
test_d3d12_replay_pin, test_d3d12_pools_open_all, test_switch_table and test_doc_anchors pass. The D3D12 DLL builds;
the walk route ran with the detail on (its numbers are for the next commit's A/B).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): a mesh program's translation on a worker, as a draw's program's
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 35s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
6da92bc6ce
A mesh program (NVN2's task and mesh stages, drawn by Eden's compute fallback) was translated whole on the replay's
thread where its first draw met it: Eden's front end, then four stages' SPIR-V and Mesa's DXIL. Each held the replay
405 to 797 ms in a play session's log (2026-11-22), at every new area; the preparation leaves mesh programs to play,
so a program cache a new DLL drops meets them all again.

translate_mesh_into keeps the front end on the replay's thread (it reads the bound state and guest memory), with the
stages' info, the program's mesh fields, the answers and the native half's front end; translate_mesh_back makes the
task, mesh, made vertex and fragment stages' SPIR-V and DXIL on a worker (p.making), as translate_back does a draw's
program's. A mesh draw whose program is being made follows the rule for draws: left out when no stage writes memory
and its targets hold an earlier frame's picture, its culled list held as while its pipelines are made (let go if the
program fails); else it waits. may_leave_out now counts the task and mesh stages' writes, so a mesh draw whose task or
mesh stage writes memory also waits for its own pipeline. program_for reads a mesh variant's failed once it is made.
With a native half the two halves share a count, and the last to end keeps the program in the cache (mesh_half_done).
A translation of 250 ms or more is logged with the replay's share of it. docs/d3d12.md sections 3.6 and 7.1.

tests/test_d3d12_workers.py runs mesh_half_done on two threads (kept once, whole, by the last half) and may_leave_out
on mesh programs whose task or mesh stage writes memory, and reads the wiring (the back half writes nothing the replay
reads, the front end emits nothing, mesh_one reads the program once it is made). It passes here and fails on HEAD;
with each half keeping the program, or the rule without the mesh stages, it fails. The checks that read
d3d_shader.cpp, d3d_shader.h and d3d_draw.cpp pass (34) and doc_anchors does; 3 more need spirv-val and run on Linux,
and read none of the changed code. The D3D12 DLL builds with no new warning. A second agent reviewed the diff cold; its
points are in (the native half's count undone if its push throws, the hold let go when the program fails). Not run
in the game yet.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(d3d12): the preparation translates the mesh programs too
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 21s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
fb742f17ce
The preparation (RX_D3D12_PREPARE=1) left the game's 1,312 mesh programs to play, and each one a session met was made
there: 405 to 797 ms on the replay's thread before 6da92bc6, its back half on a worker since (the draw left out or
waiting meanwhile). A new DLL's stamp drops the program cache, so every session after one met them all again.

prepare_program now takes a program of a mesh stage, a task stage if any, and a fragment stage if any, keys it as
program_for keys a draw of it (mesh_key: no per-primitive map, float colour outputs; the game's list has no header-only
stage, and play logged no per-primitive line), and translates it with translate_mesh_into on a blank state. As for a
draw's program: one that asks whether a constant-buffer word holds a storage buffer's address is left to play, before
either half is pushed; its failures are not kept (mesh_half_done, either half), counted or logged, and its time is not
the game's. The preparation queues the mesh programs after the compute programs, before the rest, and lets one go once
its native half (section 7.1), which writes into it, is made too. Prepared::kMesh is gone. docs/d3d12.md sections 3.5
and 3.6.

tests/test_d3d12_prepare.py reads the wiring (the key made as program_for makes it, the program marked the
preparation's before it is translated, left to play before either half is pushed, let go only once both halves are
made); tests/test_d3d12_workers.py runs mesh_half_done with a prepared program that failed (not kept, one half or two).
Both pass here and fail on 6da92bc6. The 38 checks that read the changed sources pass but for 3 that need spirv-val and
run on Linux (they read none of the changed code); so do the 26 that read docs/d3d12.md, and doc_anchors. The D3D12 DLL
builds with no new warning. A second agent reviewed the diff cold and found no bug; from its notes, one check reads the
order of the failed front end's return more closely (it fails with the return moved after the log). The replay's work
line still counts the preparation's front ends, emits and DXIL conversions with the game's, as it did a prepared draw
program's. Not run in the game yet.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nyannoying force-pushed feat/d3d12-renderer from fb742f17ce
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 21s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 30e9f3d489
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-22 09:49:43 +00:00
Compare
feat(d3d12): the performance statistics, named Direct3D 12, with this back end's phases and events
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2b5245d22b
The D3D12 DLL stood in for the launcher's Send performance statistics: with the tick on, a Direct3D 12
run measured nothing and wrote nothing. It now builds perf_report.cpp, perf_curl.cpp and
perf_os_win.cpp in (gpu/d3d12/build.py MENU_VK), as the Vulkan DLL does, and d3d_menu.cpp answers
what they ask of the renderer:

- The machine. perf_renderer (vk_fps.h, new) names the back end: "Vulkan" in vk_main.cpp,
  "Direct3D 12" here. A summary from a back end no release has is never a release's, so the relay's
  release label keeps Direct3D 12 runs out of the players' series whatever the folder's stamp. The
  driver is named as its maker numbers it (NVIDIA 581.57; Intel's and AMD's last two parts): the
  Windows version the driver had before read "Intel 32.0" under the relay's major.minor label, the
  same for every Intel driver. vram_total_gb asks device_vram_bytes, the back end's own count
  (Vulkan's largest device-local heap, as before; here the adapter's dedicated memory). The present
  mode is mailbox (Present(0, 0) in the flip model), frame generation XeSS-FG's.
- The phases, at each present after the queue submit's time (perf_phases): submit is the replay,
  then present, uploads, programs (translations and cache reads the replay ran itself), memsync (the
  collects and the pools opened) and slot wait (the rings' waits). WorkTotals gains in_replay, each
  kind's time on the replaying thread; a job that job_wait runs in place is its wait's, counted once.
- The events. A lost device writes the last summary and stops the counting (the back end goes on
  without its device). swap_make and swap_resize count as swapchain_recreated. Video memory over the
  driver's allowance, checked every 60 presents with the status line's thresholds, is
  vram_over_budget, with a log line. program_failed comes from the translator's counts.
- The window's close. mkwvk_close_asked is exported, as the Vulkan DLL's is (the host asks for it by
  name), so the last summary is written before the host tears down.

Zero by design: the texture readback and late memory waits (no mirrors or write-backs here), the
presentation clock's samples, the movie upscaler's and DLSS's events. Draw, descriptors, texture
lookups, pipelines, commands and dispatch are inside submit here.

Building the shared files with the D3D12 DLL's own flags (C++20, -Wall) showed two deprecation
warnings, fixed where they are: perf_report.cpp's static_assert compares the two enums as int, and
perf_curl.cpp makes curl's Windows path from the wide system directory (no u8path, no UTF-8 round
trip). The Vulkan DLL builds them with warnings off and behaves the same.

tests/test_d3d12_perf_report.py checks the wiring and compiles read_machine, both perf_renderer,
driver_label (against a port of the relay's major.minor label), perf_phases, the allowance's
crossings and the in-place accounting (work_add, job_wait) cut from the sources; it passes with
clang++ and g++. test_d3d12_fps, test_perf_send and test_perf_pipe_waits pass. test_perf_report's
three Windows failures (the fork start method, a sender's lease, an expired lock) fail on the base
too. docs/d3d12.md and docs/dev/reference/profiling.md say what a Direct3D 12 summary holds and how a
development folder ticks the statistics on.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
translator_stamp (d3d_shader.cpp) hashed every RX_VK_ and EDEN_ switch set, but six it named
(kNotTranslation: the frame trace's and XeSS's). The DLL now builds the menu, the FPS counter and
the performance summary from gpu/vk, which read 30 RX_VK_ switches of their own. A run with
RX_VK_PERF_INTERVAL=60 (the summaries' period) logged "the program cache: made again, 0 programs
kept", and the next run without it would make it again: a session of translations each time.

The check now wants the stamp to name them one by one (kTranslation), as the Vulkan back end's
stamp does: exactly the switches the translator's sources and the stamped files read (20: nine
EDEN_ and eleven RX_VK_ ones, found as the check finds every other read), in order, each read by
its value. On 2b5245d2 it fails with "translator_stamp takes every RX_VK_ and EDEN_ switch set,
whatever reads it" and the missing kTranslation.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): the program cache kept across runs that set a switch no translation reads
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
dab5e0a8c6
translator_stamp (d3d_shader.cpp) now names the switches of gpu/vk's that the translation reads,
one by one (kTranslation: nine EDEN_ and eleven RX_VK_ ones, those the translator's sources and the
stamped files read), and hashes each one's value. Before, it took every RX_VK_ and EDEN_ switch set
but six: since the DLL builds the menu, the FPS counter and the performance summary from gpu/vk,
which read 30 RX_VK_ switches of their own, a run with one of them set (RX_VK_PERF_INTERVAL=60 for
the performance statistics' check, 2b5245d2) logged "the program cache: made again, 0 programs
kept", and translated every program again; the next run without it again.

tests/test_d3d12_program_cache.py (the commit before) passes with clang++ and g++.
tests/test_switch_table.py's PREFIXES loses the bare RX_VK_, which no source reads as a prefix now;
its other failure (switches.def's RX_VK_GRASS_DISTANCE after RX_VK_SIM_TURF_ADAPTIVE) is on the base
too. The other checks that read d3d_shader.cpp pass. docs/d3d12.md section 3.5 says which switches
the stamp takes.

The stamp itself changes (d3d_shader.cpp is stamped): the program cache is made again once.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mesa's spirv_to_dxil inlines every function, as Intel's Mesa driver does (#2513), so a global memory
access of OoT's culling programs carries its ~70 storage buffer table entries written out (four
tables of 16, one of 3). On an Arc B580 with a cold program cache the largest compute stage came out
as 934 KB of DXIL, 133,000 instructions for 49 accesses: Mesa took up to 3.4 s to translate a compute
program, the driver 16.6 s to make the pipeline of one of 841 KB, and the save's first load held one
frame 22.9 s (the workers making compute pipelines, the replay thread translating each program it
met in place).

tests/test_d3d12_table_loop.py cuts translator_init (d3d_shader.cpp) and the back end's env_on and
env_int (d3d_device.cpp) out and runs them: global_table_loop on by default on every vendor,
RX_D3D12_GM_LOOP=0 writing the tables out, 1 and an empty value as unset, the other settings as
they were. On dab5e0a8 it fails: global_table_loop is off whatever is set.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): the storage buffer tables searched in a loop, as on Intel's Mesa driver
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
3466506710
translator_init turns on global_table_loop (mma_layout.h, the Vulkan back end's on Intel's Mesa
driver, #2513): a global memory access the storage buffer pass could not bind searches each storage
buffer table in a loop the compiler is asked not to unroll, not entry by entry written out. Mesa's
spirv_to_dxil inlines every function, so the written-out search came at each access: OoT's culling
programs (four tables of 16, one of 3) came out as up to 934 KB of DXIL, and their first making held
the save's first load in one frame of 22.9 s.

RX_D3D12_GM_LOOP=0 writes the tables out, as before. The setting is in the program cache's stamp, so
the first run on this change translates every program again.

Measured offline (B580, driver 32.0.101.9175), a compute stage made like theirs (49 accesses, the
same tables) through Eden's SPIR-V back end, Mesa's spirv_to_dxil.dll and the driver, three programs
each way:
- DXIL: 1,002-1,046 KB written out, 120-125 KB in loops; 153,017 instructions against 19,273 (49)
- Mesa: 2.03-2.17 s against 0.14 s
- the driver's compute pipeline: 12.0-12.6 s against 2.4-2.5 s; its blob 1.79-1.86 MB against
  0.43-0.45 MB (the driver keeps the loop)

In the game, the save's first load with the program cache cold (a run cut short after it): the
compute stages 8.2 MB of DXIL in all, the largest 430 KB (11.1 MB and 934 KB before); the slowest
compute pipelines 11.4, 9.7 and 9.5 s (28.9, 16.6 and 8.7 s before); the longest frame 15.9 s (22.9 s
in the run before, whose graphics pipelines were cold too). What is left of it: the translations the
draws wait for, one after another (269 in 12.1 s). docs/d3d12.md section 3.8.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(d3d12): the frame trace's and the dead targets' checks build again
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 29s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
f721a3c44e
2b5245d2 (the performance statistics) timed textures_frame (st_frame_ns, work_clock) and had work_add
and work_add_n tell work done inside a replay run (pin_depth, job_run_in_wait); neither check's
stand-ins had those, so test_d3d12_dead_targets and test_d3d12_frame_trace no longer built. Their
stand-ins now have them: the replay's clock standing still, no run under way.

The frame trace's check cuts work_is_count as a block, not as the line it was.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nyannoying force-pushed feat/d3d12-renderer from f721a3c44e
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 29s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 0984e394d9
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 29s
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/windows+nvidia 2/1 fail
beanstalk/windows+amd 1/1 fail
beanstalk/windows+intel 1/1 fail
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-23 16:11:09 +00:00
Compare
Author
Contributor

Brought up to date: rebased on main f9fb7449, head 0984e394.

  • New since the last description: the player's settings and the Insert menu, Intel XeSS, XeSS Frame Generation and XeLL, the preparation (RX_D3D12_PREPARE=1), and 13.69 ms a frame in Castle Town's market against Vulkan's 12.62 on an Arc B580.
  • Mesa's spirv_to_dxil.dll is now in this PR (third_party/mesa-spirv-to-dxil/bin, its bytes pinned by its PROVENANCE.md and checked), so a build of this branch, the Test Farm's too, makes the D3D12 back end with no build tools change. #2362 is closed for it.
  • The description has a "How to try it (testers)" section.
  • Checks: the full suite has no failure main lacks, except one in code this branch doesn't change (Testing says which).
Brought up to date: rebased on main f9fb7449, head 0984e394. - New since the last description: the player's settings and the Insert menu, Intel XeSS, XeSS Frame Generation and XeLL, the preparation (`RX_D3D12_PREPARE=1`), and 13.69 ms a frame in Castle Town's market against Vulkan's 12.62 on an Arc B580. - Mesa's `spirv_to_dxil.dll` is now in this PR (`third_party/mesa-spirv-to-dxil/bin`, its bytes pinned by its `PROVENANCE.md` and checked), so a build of this branch, the Test Farm's too, makes the D3D12 back end with no build tools change. #2362 is closed for it. - The description has a "How to try it (testers)" section. - Checks: the full suite has no failure main lacks, except one in code this branch doesn't change (Testing says which).
Author
Contributor

@Beanstalk Windows on an NVIDIA GPU and an AMD GPU: start with HOS_D3D12=1, from the title into the game. Expect the picture as on Vulkan and no device removed.

@Beanstalk Windows on an NVIDIA GPU and an AMD GPU: start with HOS_D3D12=1, from the title into the game. Expect the picture as on Vulkan and no device removed.
Member

@nyannoying only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@nyannoying only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner

@beanstalk

@beanstalk
Member
Beanstalk test farm · an earlier run: commit 0984e39 (the newer results are in a comment below)

Commit 0984e39 · approved by HumanBean (reviewed) · dashboard

⚠️ Note: The title and gameplay are separate starts, not a continuous title-to-save transition. The generic D3D12 log prefix confirms that the backend logged, but may not by itself rule out a later fallback to Vulkan.
⚠️ Note: Headless pictures and timings do not test the swapchain, window presentation, V-Sync, XeSS frame generation or XeLL; the farm cannot take comparison pictures in its window scenarios.
⚠️ Note: The fixed 1920×1080 output and uncontrolled D3D12 caches cannot reproduce the author’s prepared-cache 2560×1440 Arc measurement or quantify preparation time and cache size.

Started at 16:23 UTC.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
windows+nvidia ❌ fail 2 1 2 — — 4 PR runs
windows+amd ❌ fail 2 1 2 — — 5 PR runs
windows+intel ❌ fail 1 1 — — 5 PR runs

Why it failed

  • windows+nvidia: title · HOS_D3D12=1 (PR only) screenshot.max_diff: 0.0 → 1.0; limit 0.2
  • windows+nvidia: build times (lift) build_s.max_delta_pct: 1,376 → 2,199 (+59.7%); limit 20.0
  • windows+nvidia: build times (lift) build_lift_s.max_delta_pct: 204.0 → 253.2 (+24.1%); limit 20.0
  • windows+nvidia: gameplay · HOS_D3D12=1 (PR only) crash: 1 PR run crashed
  • windows+nvidia: gameplay · HOS_D3D12=1 (PR only) screenshot.max_diff: 0.5 → 1.0; limit 0.2
  • windows+amd: title · HOS_D3D12=1 (PR only) crash: 2 PR runs crashed
  • windows+amd: title · HOS_D3D12=1 (PR only) screenshot.max_diff: 0.0 → 1.0; limit 0.2
  • windows+amd: gameplay · HOS_D3D12=1 (PR only) crash: 3 PR runs crashed
  • and 5 more, in the reports

Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.

  • windows+amd, report 1: the pr runtime failed (exit 1): return a.func(a) or 0
What was tested

What will be tested · AI plan (gpt-6.1-terra)

On Windows NVIDIA, AMD and Intel GPUs, the plan compares the PR’s requested D3D12 backend with main’s Vulkan renderer at the title, Castle Town Market and Kokiri Forest. It takes two title starts and three gameplay starts per side, with 20-second warmed measurements at each gameplay location; the Windows Intel target will wait for a tester. Crashes, a missing D3D12 log line, device-removal messages, materially different pictures or frame-time regressions beyond 20% fail the PR. Timed lift builds also check for build-time regressions. No tester online now matches windows+intel: that target waits for one.

  • Where: windows+nvidia (1-2 reports), windows+amd (1-2 reports), windows+intel (1-2 reports).
  • Matrix: 1 cell, each on main and the PR: HOS_D3D12 1 (PR only).
  • title: from the title screen, then take the picture title to compare with main; 2 runs on each side.
  • gameplay: from the repository's save market-entrance, then teleport to Market, take the picture market to compare with main, measure market for 20 s (after 10 s warm-up), teleport to Kokiri Forest, take the picture forest to compare with main, measure forest for 20 s (after 10 s warm-up); 3 runs on each side.
  • Build times: main and the PR each built 2 times, alternating, each whole in a fresh folder: the lift again (no kept lift, main's compiled objects kept); every stage timed (shader preparation is not), and the lifted C compared.
  • Measured: crashes, frame times, stutters and hitches, load times, the game's log.
  • The PR fails if: it crashes; or the whole build's time is more than 20% above main; or a picture differs from main by more than 25%; or the lift's time is more than 20% above main; or longest load is more than 50% above main; or frame time (p99) is more than 20% above main; or forbidden log lines is above 0; or expected log lines missing is above 0; or frame time (worst 1%) is more than 20% above main.
  • Time: about 57 min of game runs per tester (10 game starts), plus the two builds and 4 timed builds (about 80 min).
Measurements on `windows+nvidia`, for the PR description

Verdict: fail on windows+nvidia (2 reports): title screenshot.max_diff; build times (lift) build_s.max_delta_pct (+59.7%); build times (lift) build_lift_s.max_delta_pct (+24.1%) failed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0 AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070, 621.35.0 AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ f9fb744 After: this PR @ 0984e39
title · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
title · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · longest load (s) 13.4 5.1 (−62%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (p99) (ms) 18.8 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (p99) (ms) 20.8 —
gameplay · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
gameplay · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (worst 1%) (ms) 19.8 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (worst 1%) (ms) 37.2 —

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

Before: main @ f9fb744 After: this PR @ 0984e39
lift · whole build (s) 1,720 2,244 (+30%)
lift · read (s) 592.7 615.1 (+4%)
lift · lift (s) 162.4 186.8 (+15%)
lift · compile (s) 871.6 1,348 (+55%)
lift · finish (s) 88.4 91.2 (+3%)
lift · lifted C main's same lifted C

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame time (p99)) Helps / doesn't help / untested
HOS_D3D12 switch the PR adds (set on the PR side only) 1 not in main the PR's default title, main without it → the PR with 1: not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** fail on windows+nvidia (2 reports): `title screenshot.max_diff`; `build times (lift) build_s.max_delta_pct (+59.7%)`; `build times (lift) build_lift_s.max_delta_pct (+24.1%)` failed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0` `AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM`  
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 13.4 | 5.1 (−62%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.8 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 20.8 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 19.8 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 37.2 | — |

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| lift · whole build (s) | 1,720 | 2,244 (+30%) |
| lift · read (s) | 592.7 | 615.1 (+4%) |
| lift · lift (s) | 162.4 | 186.8 (+15%) |
| lift · compile (s) | 871.6 | 1,348 (+55%) |
| lift · finish (s) | 88.4 | 91.2 (+3%) |
| lift · lifted C | main's | same lifted C |

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested |
Measurements on `windows+amd`, for the PR description

Verdict: fail on windows+amd (2 reports): title crash; title screenshot.max_diff; gameplay crash failed.

Hardware: 1: windows+amd+amd-proprietary+dgpu AMD Radeon RX 7900 XT, 2.0.416 AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM; 2: windows+amd+amd-proprietary+dgpu AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ f9fb744 After: this PR @ 0984e39
title · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
title · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · longest load (s) 7.2 1.1 (−85%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (p99) (ms) 19.2 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (p99) (ms) 19.4 —
gameplay · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
gameplay · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (worst 1%) (ms) 20.6 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (worst 1%) (ms) 22.8 —

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

Before: main @ f9fb744 After: this PR @ 0984e39
lift · whole build (s) 1,661 2,110 (+27%)
lift · read (s) 527.6 524.6 (−1%)
lift · lift (s) 152.8 152.8 (+0%)
lift · compile (s) 895.4 1,350 (+51%)
lift · finish (s) 81.1 80.6 (−1%)
lift · lifted C main's same lifted C

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame time (p99)) Helps / doesn't help / untested
HOS_D3D12 switch the PR adds (set on the PR side only) 1 not in main the PR's default title, main without it → the PR with 1: not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** fail on windows+amd (2 reports): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed.

Hardware: 1: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 7900 XT, 2.0.416` `AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM`; 2: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM`  
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 7.2 | 1.1 (−85%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 19.2 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 19.4 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.6 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 22.8 | — |

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| lift · whole build (s) | 1,661 | 2,110 (+27%) |
| lift · read (s) | 527.6 | 524.6 (−1%) |
| lift · lift (s) | 152.8 | 152.8 (+0%) |
| lift · compile (s) | 895.4 | 1,350 (+51%) |
| lift · finish (s) | 81.1 | 80.6 (−1%) |
| lift · lifted C | main's | same lifted C |

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested |
Measurements on `windows+intel`, for the PR description

Verdict: fail on windows+intel (1 report): title crash; title screenshot.max_diff; gameplay crash failed.

Hardware: 1: windows+intel+intel-proprietary+dgpu Intel(R) Arc(TM) B580 Graphics, 0.406.983 13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ f9fb744 After: this PR @ 0984e39
title · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
title · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · longest load (s) 5.1 4.7 (−7%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (p99) (ms) 18.6 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (p99) (ms) 28.8 —
gameplay · HOS_D3D12=1 (PR only) · forbidden log lines 0.0 0.0
gameplay · HOS_D3D12=1 (PR only) · expected log lines missing 1.0 0.0 (−100%)
gameplay · HOS_D3D12=1 (PR only) · forest · frame time (worst 1%) (ms) 20.1 —
gameplay · HOS_D3D12=1 (PR only) · market · frame time (worst 1%) (ms) 33.9 —

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

Before: main @ f9fb744 After: this PR @ 0984e39
lift · whole build (s) 874.0 959.4 (+10%)
lift · read (s) 316.5 291.0 (−8%)
lift · lift (s) 77.9 78.6 (+1%)
lift · compile (s) 439.6 549.2 (+25%)
lift · finish (s) 37.9 39.1 (+3%)
lift · lifted C main's same lifted C

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame time (p99)) Helps / doesn't help / untested
HOS_D3D12 switch the PR adds (set on the PR side only) 1 not in main the PR's default title, main without it → the PR with 1: not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** fail on windows+intel (1 report): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed.

Hardware: 1: windows+intel+intel-proprietary+dgpu `Intel(R) Arc(TM) B580 Graphics, 0.406.983` `13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM`  
Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 1 report  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 5.1 | 4.7 (−7%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.6 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 28.8 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) |
| gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.1 | — |
| gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 33.9 | — |

Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept))

| | Before: main @ f9fb744 | After: this PR @ 0984e39 |
|---|---|---|
| lift · whole build (s) | 874.0 | 959.4 (+10%) |
| lift · read (s) | 316.5 | 291.0 (−8%) |
| lift · lift (s) | 77.9 | 78.6 (+1%) |
| lift · compile (s) | 439.6 | 549.2 (+25%) |
| lift · finish (s) | 37.9 | 39.1 (+3%) |
| lift · lifted C | main's | same lifted C |

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested |
The testers' hardware
Target Report Ran on
windows+nvidia 1 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0 AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM
windows+nvidia 2 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070, 621.35.0 AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM
windows+amd 1 windows+amd+amd-proprietary+dgpu AMD Radeon RX 7900 XT, 2.0.416 AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM
windows+amd 2 windows+amd+amd-proprietary+dgpu AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM
windows+intel 1 windows+intel+intel-proprietary+dgpu Intel(R) Arc(TM) B580 Graphics, 0.406.983 13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>0984e39</code> (the newer results are in a comment below)</summary> Commit `0984e39` · approved by HumanBean (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2040) ⚠️ **Note:** The title and gameplay are separate starts, not a continuous title-to-save transition. The generic D3D12 log prefix confirms that the backend logged, but may not by itself rule out a later fallback to Vulkan. ⚠️ **Note:** Headless pictures and timings do not test the swapchain, window presentation, V-Sync, XeSS frame generation or XeLL; the farm cannot take comparison pictures in its window scenarios. ⚠️ **Note:** The fixed 1920×1080 output and uncontrolled D3D12 caches cannot reproduce the author’s prepared-cache 2560×1440 Arc measurement or quantify preparation time and cache size. Started at 16:23 UTC. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `windows+nvidia` | ❌ fail | 2 [1](https://beanstalk.magicbean.dev/reports/rp_f109edd87f1f3318) [2](https://beanstalk.magicbean.dev/reports/rp_fa587123d9547605) | — | — | 4 PR runs | | `windows+amd` | ❌ fail | 2 [1](https://beanstalk.magicbean.dev/reports/rp_a9e50593e9874649) [2](https://beanstalk.magicbean.dev/reports/rp_6728572e899e907a) | — | — | 5 PR runs | | `windows+intel` | ❌ fail | 1 [1](https://beanstalk.magicbean.dev/reports/rp_474539b6efc60f3d) | — | — | 5 PR runs | **Why it failed** - `windows+nvidia`: `title · HOS_D3D12=1 (PR only)` `screenshot.max_diff`: `0.0 → 1.0; limit 0.2` - `windows+nvidia`: `build times (lift)` `build_s.max_delta_pct`: `1,376 → 2,199 (+59.7%); limit 20.0` - `windows+nvidia`: `build times (lift)` `build_lift_s.max_delta_pct`: `204.0 → 253.2 (+24.1%); limit 20.0` - `windows+nvidia`: `gameplay · HOS_D3D12=1 (PR only)` `crash`: `1 PR run crashed` - `windows+nvidia`: `gameplay · HOS_D3D12=1 (PR only)` `screenshot.max_diff`: `0.5 → 1.0; limit 0.2` - `windows+amd`: `title · HOS_D3D12=1 (PR only)` `crash`: `2 PR runs crashed` - `windows+amd`: `title · HOS_D3D12=1 (PR only)` `screenshot.max_diff`: `0.0 → 1.0; limit 0.2` - `windows+amd`: `gameplay · HOS_D3D12=1 (PR only)` `crash`: `3 PR runs crashed` - and 5 more, in the reports **Couldn't be judged**: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own. - `windows+amd`, [report 1](https://beanstalk.magicbean.dev/reports/rp_a9e50593e9874649): `the pr runtime failed (exit 1): return a.func(a) or 0` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) On Windows NVIDIA, AMD and Intel GPUs, the plan compares the PR’s requested D3D12 backend with main’s Vulkan renderer at the title, Castle Town Market and Kokiri Forest. It takes two title starts and three gameplay starts per side, with 20-second warmed measurements at each gameplay location; the Windows Intel target will wait for a tester. Crashes, a missing D3D12 log line, device-removal messages, materially different pictures or frame-time regressions beyond 20% fail the PR. Timed lift builds also check for build-time regressions. No tester online now matches windows+intel: that target waits for one. - **Where:** windows+nvidia (1-2 reports), windows+amd (1-2 reports), windows+intel (1-2 reports). - **Matrix:** 1 cell, each on main and the PR: HOS_D3D12 `1` (PR only). - **title:** from the title screen, then take the picture title to compare with main; 2 runs on each side. - **gameplay:** from the repository's save `market-entrance`, then teleport to Market, take the picture market to compare with main, measure market for 20 s (after 10 s warm-up), teleport to Kokiri Forest, take the picture forest to compare with main, measure forest for 20 s (after 10 s warm-up); 3 runs on each side. - **Build times:** main and the PR each built 2 times, alternating, each whole in a fresh folder: the lift again (no kept lift, main's compiled objects kept); every stage timed (shader preparation is not), and the lifted C compared. - **Measured:** crashes, frame times, stutters and hitches, load times, the game's log. - **The PR fails if:** it crashes; or the whole build's time is more than 20% above main; or a picture differs from main by more than 25%; or the lift's time is more than 20% above main; or longest load is more than 50% above main; or frame time (p99) is more than 20% above main; or forbidden log lines is above 0; or expected log lines missing is above 0; or frame time (worst 1%) is more than 20% above main. - **Time:** about 57 min of game runs per tester (10 game starts), plus the two builds and 4 timed builds (about 80 min). </details> <details><summary>Measurements on `windows+nvidia`, for the PR description</summary> **Verdict:** fail on windows+nvidia (2 reports): `title screenshot.max_diff`; `build times (lift) build_s.max_delta_pct (+59.7%)`; `build times (lift) build_lift_s.max_delta_pct (+24.1%)` failed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0` `AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 13.4 | 5.1 (−62%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 20.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 19.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 37.2 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 1,720 | 2,244 (+30%) | | lift · read (s) | 592.7 | 615.1 (+4%) | | lift · lift (s) | 162.4 | 186.8 (+15%) | | lift · compile (s) | 871.6 | 1,348 (+55%) | | lift · finish (s) | 88.4 | 91.2 (+3%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** fail on windows+nvidia (2 reports): `title screenshot.max_diff`; `build times (lift) build_s.max_delta_pct (+59.7%)`; `build times (lift) build_lift_s.max_delta_pct (+24.1%)` failed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0` `AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 13.4 | 5.1 (−62%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 20.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 19.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 37.2 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 1,720 | 2,244 (+30%) | | lift · read (s) | 592.7 | 615.1 (+4%) | | lift · lift (s) | 162.4 | 186.8 (+15%) | | lift · compile (s) | 871.6 | 1,348 (+55%) | | lift · finish (s) | 88.4 | 91.2 (+3%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | ``` </details> <details><summary>Measurements on `windows+amd`, for the PR description</summary> **Verdict:** fail on windows+amd (2 reports): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed. Hardware: 1: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 7900 XT, 2.0.416` `AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM`; 2: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 7.2 | 1.1 (−85%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 19.2 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 19.4 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.6 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 22.8 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 1,661 | 2,110 (+27%) | | lift · read (s) | 527.6 | 524.6 (−1%) | | lift · lift (s) | 152.8 | 152.8 (+0%) | | lift · compile (s) | 895.4 | 1,350 (+51%) | | lift · finish (s) | 81.1 | 80.6 (−1%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** fail on windows+amd (2 reports): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed. Hardware: 1: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 7900 XT, 2.0.416` `AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM`; 2: windows+amd+amd-proprietary+dgpu `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 7.2 | 1.1 (−85%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 19.2 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 19.4 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.6 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 22.8 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 1,661 | 2,110 (+27%) | | lift · read (s) | 527.6 | 524.6 (−1%) | | lift · lift (s) | 152.8 | 152.8 (+0%) | | lift · compile (s) | 895.4 | 1,350 (+51%) | | lift · finish (s) | 81.1 | 80.6 (−1%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | ``` </details> <details><summary>Measurements on `windows+intel`, for the PR description</summary> **Verdict:** fail on windows+intel (1 report): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed. Hardware: 1: windows+intel+intel-proprietary+dgpu `Intel(R) Arc(TM) B580 Graphics, 0.406.983` `13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 5.1 | 4.7 (−7%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.6 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 28.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.1 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 33.9 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 874.0 | 959.4 (+10%) | | lift · read (s) | 316.5 | 291.0 (−8%) | | lift · lift (s) | 77.9 | 78.6 (+1%) | | lift · compile (s) | 439.6 | 549.2 (+25%) | | lift · finish (s) | 37.9 | 39.1 (+3%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** fail on windows+intel (1 report): `title crash`; `title screenshot.max_diff`; `gameplay crash` failed. Hardware: 1: windows+intel+intel-proprietary+dgpu `Intel(R) Arc(TM) B580 Graphics, 0.406.983` `13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM` Scene: title, from the title screen; gameplay, from the repository's save market-entrance; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side; gameplay: 3 game starts a side, market 20 s after 10 s warm-up, forest 20 s after 10 s warm-up; timed builds: main and this PR each built 2 times a cache, alternating, each a whole build in a fresh folder (lift; shader preparation not timed); each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | title · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | title · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · longest load (s) | 5.1 | 4.7 (−7%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (p99) (ms) | 18.6 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (p99) (ms) | 28.8 | — | | gameplay · `HOS_D3D12=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | gameplay · `HOS_D3D12=1 (PR only)` · expected log lines missing | 1.0 | 0.0 (−100%) | | gameplay · `HOS_D3D12=1 (PR only)` · forest · frame time (worst 1%) (ms) | 20.1 | — | | gameplay · `HOS_D3D12=1 (PR only)` · market · frame time (worst 1%) (ms) | 33.9 | — | Build times (each a median of the timed builds; caches: lift = the lift again (no kept lift, main's compiled objects kept)) | | Before: main @ f9fb744 | After: this PR @ 0984e39 | |---|---|---| | lift · whole build (s) | 874.0 | 959.4 (+10%) | | lift · read (s) | 316.5 | 291.0 (−8%) | | lift · lift (s) | 77.9 | 78.6 (+1%) | | lift · compile (s) | 439.6 | 549.2 (+25%) | | lift · finish (s) | 37.9 | 39.1 (+3%) | | lift · lifted C | main's | same lifted C | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_D3D12` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | title, main without it → the PR with 1: not measured | untested | ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `windows+nvidia` | [1](https://beanstalk.magicbean.dev/reports/rp_f109edd87f1f3318) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 5050 Laptop GPU, 621.24.0` `AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAM` | | `windows+nvidia` | [2](https://beanstalk.magicbean.dev/reports/rp_fa587123d9547605) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` | | `windows+amd` | [1](https://beanstalk.magicbean.dev/reports/rp_a9e50593e9874649) | windows+amd+amd-proprietary+dgpu `AMD Radeon RX 7900 XT, 2.0.416` `AMD Ryzen 7 5700X 8-Core Processor, 16 GB RAM` | | `windows+amd` | [2](https://beanstalk.magicbean.dev/reports/rp_6728572e899e907a) | windows+amd+amd-proprietary+dgpu `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` | | `windows+intel` | [1](https://beanstalk.magicbean.dev/reports/rp_474539b6efc60f3d) | windows+intel+intel-proprietary+dgpu `Intel(R) Arc(TM) B580 Graphics, 0.406.983` `13th Gen Intel(R) Core(TM) i5-13600K, 64 GB RAM` | </details> </details>
RX_D3D12_PREPARE runs beside the game, its progress only in the log. A box at the top left over the game now says
"Preparing shaders 29%" with a bar and the programs looked at of the list (vk_menu.cpp menu_shader_progress,
gpu/vk/shader_note.h), short of 100 % until the last back halves are made, then "Shaders prepared" for 8 s. At the
bottom left while the FPS counter is in the top left; not over the open menu or the start-up screen. Both texts in every
menu language. tests/test_shader_note.py checks the note's states and where d3d_prepare.cpp tells it;
tests/test_fps_overlay_order.py draws it in menu_record's order.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Longshot leaves through ExitProcess. The Direct3D 12 back end's globals hold
DXGI and D3D12 objects in Refs, and their static destructors run in the DLL's
DLL_PROCESS_DETACH after the other threads are gone: DXGI raised exception
0x87a in such a release, and each Test Farm start that quit through the
control bridge ended in a crash (exit code 2170, PR #2040's windows+intel
report).

The check cuts the Ref template and DllMain from the sources and compiles
them with stand-ins: a Ref still releases out of scope and after a
FreeLibrary's detach, and releases nothing in its destructor after the
process's end. Fails now: the DLL has no DllMain and Ref always releases.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(d3d12): nothing released at the process's end, so a quit is no crash
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 10s
e90a42c703
Longshot leaves through ExitProcess. The back end's globals (Device dev's
factory, adapter and device, the buffers, the root signatures) hold DXGI and
D3D12 objects in Refs, and their static destructors released them in the
DLL's detach after the other threads were gone: DXGI raised exception 0x87a,
and the Test Farm counted every start that quit through the control bridge
as a crash (exit code 2170; PR #2040's windows+intel report, all 5 starts).

DllMain notes the process's end (DLL_PROCESS_DETACH with lpvReserved set,
where Windows asks a DLL to do no clean-up) before the CRT runs the static
destructors, and a Ref's destructor then leaves its object to the process's
end. A FreeLibrary's detach and every Ref going out of scope while the game
runs still release. docs/d3d12.md section 8; test_d3d12_pipeline_store cuts
the flag with Ref.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Beanstalk test farm

Commit e90a42c · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `e90a42c` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/2040) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
Author
Contributor

Pushed e90a42c7 (3 commits on 0984e394):

  • edd7f13e feat: a corner note with the shader preparation's progress over the game (RX_D3D12_PREPARE), then "Shaders prepared" for 8 s.
  • 0ff0f8d2 test + e90a42c7 fix: the crash at quit the farm found. Each start that quit through the control bridge ended with exit code 2170 (DXGI's exception 0x87a, on Intel and AMD). Longshot leaves through ExitProcess. The back end's globals still released their DXGI and D3D12 objects in static destructors during the DLL's detach. They now leave them to the process's end (DllMain notes the detach, Windows' rule for it). tests/test_d3d12_exit_release.py fails before the fix and passes after.

Not fixed yet, being looked at:

  • a hang while loading the market after the teleport (RTX 3070 1 of 3 starts, RX 9070 XT 2 of 3);
  • the pictures: the farm's D3D12 program cache starts empty, and draws whose programs are still being translated are left out, so the market shot lacks most geometry.

@Beanstalk please run the same plan again on e90a42c7: does the quit still end in a crash (exit code 2170), and does the market load still hang?

🤖 Generated with Claude Code

Pushed e90a42c7 (3 commits on 0984e394): - **edd7f13e** feat: a corner note with the shader preparation's progress over the game (`RX_D3D12_PREPARE`), then "Shaders prepared" for 8 s. - **0ff0f8d2** test + **e90a42c7** fix: the crash at quit the farm found. Each start that quit through the control bridge ended with exit code 2170 (DXGI's exception 0x87a, on Intel and AMD). Longshot leaves through `ExitProcess`. The back end's globals still released their DXGI and D3D12 objects in static destructors during the DLL's detach. They now leave them to the process's end (`DllMain` notes the detach, Windows' rule for it). `tests/test_d3d12_exit_release.py` fails before the fix and passes after. Not fixed yet, being looked at: - a hang while loading the market after the teleport (RTX 3070 1 of 3 starts, RX 9070 XT 2 of 3); - the pictures: the farm's D3D12 program cache starts empty, and draws whose programs are still being translated are left out, so the market shot lacks most geometry. @Beanstalk please run the same plan again on e90a42c7: does the quit still end in a crash (exit code 2170), and does the market load still hang? 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Member

@nyannoying only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@nyannoying only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Contributor

Tested e90a42c7 on an Intel Arc A750 (Alchemist, 8 GB): the device was lost after ~15 min, transparency broken, long hitches

Setup: Intel Arc A750 8 GB, driver 32.0.101.8974, Windows build 26300, Core i3-10105F (4 cores, 8 threads), 16 GB RAM,
1920x1080 at 60 Hz. Log line 1: longshot v3.1.1-231-ge90a42c7. Built with dev.py update --branch refs/pull/2040/head,
libxess_fg.dll and libxell.dll beside the game. RX_D3D12=1; the first run with RX_D3D12_PREPARE=1.

What worked

  • The device, XeSS 2.0.2, XeLL 1.3.2 and XeSS-FG 1.3.1 all came up (SM 6.8, mesh shader tier 10, enhanced barriers).
  • The preparation: done in 5785 s (4 workers): 38809 programs, 69431 variants, 0 failed, 71 left to play. Cache 5.1 GB.
    During play after it only 27 DXIL conversions in ~15 minutes, so the program cache does its job.
  • XeLL's own reports: about 6 ms from simulation start to present end.

Problems, worst first

  1. Device lost after ~15 minutes of play (second run, Upscaler Intel XeSS, Frame generation 2x):

    d3d12: video memory at present 36900: 9363 MB of a budget of 6746 MB in VRAM, 5573 MB of 7476 MB in system memory; textures: 1077 held, 4751 MB; 4685 let go (10364 MB), 4071 of them made again
    d3d12: device lost: ID3D12GraphicsCommandList::Close failed (0x8007000e): the device was removed (0x887a0007). Nothing more is drawn
    d3d12: device lost: DRED says the device unknown
    d3d12: device lost: DRED gives no page fault's address (0, 0)
    

    VRAM use ran ~2.6 GB over the budget, textures were let go and made again thousands of times, then E_OUTOFMEMORY at a
    list's Close and a device reset. The B580 in the description has 12 GB; an 8 GB card looks like it needs the budget held.

  2. Transparency broken in many places: text in the title menu and the settings drawn on solid boxes (light blue behind
    "New Game", black behind "Options"), subtitles on a solid black box, a dark/noisy box behind the hearts, white patches in
    the world. Looks like one blend/alpha problem rather than several.

    Title menu: solid boxes behind the text

  3. Long hitches and flicker on the first visits: pipelines, not programs. The preparation covers DXIL but the driver's
    pipelines on Alchemist are very slow to make, and draws are left out meanwhile (objects vanishing and coming back,
    flicker, blue lines; at the end the screen went white and stayed so after the device was lost):

    After the device was lost

    d3d12: the replay's last 37.0 s: 32948 ms in 4427 runs (longest 17694 ms); ... 254 pipelines made 24643 ms (longest 1538.1); 86 compute pipelines made 82126 ms (longest 12858.0); ...
    d3d12: the replay's last 5.6 s: ... 27 pipelines made 4203 ms (longest 1033.8); 7 compute pipelines made 65573 ms (longest 42470.2); ...
    

    Over the run: 849991 draws left out while their program or pipeline was made; one replay run of 17.7 s; one compute
    pipeline of 42.5 s. Also 174 lines with "stopped too long" waits. Making the pipelines in the preparation too (or a
    pipeline list run first) would help Alchemist a lot.

  4. The Intel XeLL row says "Off" while XeSS-FG keeps XeLL on. The row is locked and its hint reads "The game as without
    it.", while the description says XeSS-FG keeps it on and the log has XeLL's reports throughout. The
    row's text could show the state in force while xell_locked() (for example "On (XeSS-FG)").

    The Intel XeLL row reads Off while XeSS-FG is on

  5. Minor: DXC 1.9 from dxcompiler.dll (no dxil.dll: the DXIL it makes is not validated).

XeSS-FG itself couldn't be judged: the run was not playable before it came into it. Happy to test again on the A750 with
any build or switches you want (for example a lower texture budget).

### Tested e90a42c7 on an Intel Arc A750 (Alchemist, 8 GB): the device was lost after ~15 min, transparency broken, long hitches **Setup:** Intel Arc A750 8 GB, driver 32.0.101.8974, Windows build 26300, Core i3-10105F (4 cores, 8 threads), 16 GB RAM, 1920x1080 at 60 Hz. Log line 1: `longshot v3.1.1-231-ge90a42c7`. Built with `dev.py update --branch refs/pull/2040/head`, `libxess_fg.dll` and `libxell.dll` beside the game. `RX_D3D12=1`; the first run with `RX_D3D12_PREPARE=1`. **What worked** - The device, XeSS 2.0.2, XeLL 1.3.2 and XeSS-FG 1.3.1 all came up (SM 6.8, mesh shader tier 10, enhanced barriers). - The preparation: done in 5785 s (4 workers): 38809 programs, 69431 variants, 0 failed, 71 left to play. Cache 5.1 GB. During play after it only 27 DXIL conversions in ~15 minutes, so the program cache does its job. - XeLL's own reports: about 6 ms from simulation start to present end. **Problems, worst first** 1. **Device lost after ~15 minutes of play** (second run, Upscaler Intel XeSS, Frame generation 2x): ``` d3d12: video memory at present 36900: 9363 MB of a budget of 6746 MB in VRAM, 5573 MB of 7476 MB in system memory; textures: 1077 held, 4751 MB; 4685 let go (10364 MB), 4071 of them made again d3d12: device lost: ID3D12GraphicsCommandList::Close failed (0x8007000e): the device was removed (0x887a0007). Nothing more is drawn d3d12: device lost: DRED says the device unknown d3d12: device lost: DRED gives no page fault's address (0, 0) ``` VRAM use ran ~2.6 GB over the budget, textures were let go and made again thousands of times, then E_OUTOFMEMORY at a list's Close and a device reset. The B580 in the description has 12 GB; an 8 GB card looks like it needs the budget held. 2. **Transparency broken in many places:** text in the title menu and the settings drawn on solid boxes (light blue behind "New Game", black behind "Options"), subtitles on a solid black box, a dark/noisy box behind the hearts, white patches in the world. Looks like one blend/alpha problem rather than several. ![Title menu: solid boxes behind the text](https://git.magicbean.dev/attachments/73f43186-b5f9-4609-8919-65737cf2c645) 3. **Long hitches and flicker on the first visits: pipelines, not programs.** The preparation covers DXIL but the driver's pipelines on Alchemist are very slow to make, and draws are left out meanwhile (objects vanishing and coming back, flicker, blue lines; at the end the screen went white and stayed so after the device was lost): ![After the device was lost](https://git.magicbean.dev/attachments/828e3079-5404-4ea2-9c0c-87ca306c1023) ``` d3d12: the replay's last 37.0 s: 32948 ms in 4427 runs (longest 17694 ms); ... 254 pipelines made 24643 ms (longest 1538.1); 86 compute pipelines made 82126 ms (longest 12858.0); ... d3d12: the replay's last 5.6 s: ... 27 pipelines made 4203 ms (longest 1033.8); 7 compute pipelines made 65573 ms (longest 42470.2); ... ``` Over the run: 849991 draws left out while their program or pipeline was made; one replay run of 17.7 s; one compute pipeline of 42.5 s. Also 174 lines with "stopped too long" waits. Making the pipelines in the preparation too (or a pipeline list run first) would help Alchemist a lot. 4. **The Intel XeLL row says "Off" while XeSS-FG keeps XeLL on.** The row is locked and its hint reads "The game as without it.", while the description says XeSS-FG keeps it on and the log has XeLL's reports throughout. The row's text could show the state in force while `xell_locked()` (for example "On (XeSS-FG)"). ![The Intel XeLL row reads Off while XeSS-FG is on](https://git.magicbean.dev/attachments/ddd94915-e07e-408d-874b-589a1da7225d) 5. Minor: `DXC 1.9 from dxcompiler.dll (no dxil.dll: the DXIL it makes is not validated)`. XeSS-FG itself couldn't be judged: the run was not playable before it came into it. Happy to test again on the A750 with any build or switches you want (for example a lower texture budget).
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 10s
This pull request has changes conflicting with the target branch.
  • .gitattributes
  • gpu/vk/eden/shader_recompiler/backend/spirv/spirv_emit_context.cpp
  • gpu/vk/eden/shader_recompiler/profile.h
  • gpu/vk/menu/framegen.cpp
  • tests/global_load_16_ir.cpp
  • tests/test_framegen_dlss_cap.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/d3d12-renderer:nyannoying-feat/d3d12-renderer'
git switch 'nyannoying-feat/d3d12-renderer'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2040
No description provided.