d3d12: export the Agility SDK symbols from a gnullvm build too (D3D12-GNULLVM-BUILD) #3238

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "github-pr/3238:github-pr/3238"
git switch "github-pr/3238"
Open
leonida/mandy
bercedev wants to merge 1 commit from github-pr/3238 into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'github-pr/3238:github-pr/3238'
git switch 'github-pr/3238'
bercedev commented 2026-12-02 21:55:37 +00:00

Claimed in the coordination issue as: D3D12-GNULLVM-BUILD (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7359018429)

What and why

build.rs only told the msvc linker to export D3D12SDKVersion / D3D12SDKPath and delay-load d3d12.dll, so a leonida.exe built on linux with llvm-mingw (x86_64-pc-windows-gnullvm) exported nothing and loaded d3d12.dll before main. lld's mingw driver takes the same switches, so the gnullvm target gets them too. tests/agility.rs now runs for that target, and docs/linux.md shows how to build leonida.exe on linux without xwin.

Tested

  • llvm-readobj on the gnullvm exe: before, no exports and d3d12.dll a normal import. after, both exports and d3d12.dll in the delay-import table
  • tests/agility.rs under wine 11.23: 2 failed with main's build.rs, 2 passed with this one
  • msvc build via xwin: exports and delay-load identical before and after
  • docs tests (tests/test_docs_*.py) pass

GPUs tested: n/a (link and export change, no gpu code)

AI-assisted: yes. code by claude opus, reviewed by separate read-only claude opus and claude sonnet reviewer agents, checked by me.

Claimed in the coordination issue as: D3D12-GNULLVM-BUILD (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7359018429) ### What and why build.rs only told the msvc linker to export D3D12SDKVersion / D3D12SDKPath and delay-load d3d12.dll, so a leonida.exe built on linux with llvm-mingw (x86_64-pc-windows-gnullvm) exported nothing and loaded d3d12.dll before main. lld's mingw driver takes the same switches, so the gnullvm target gets them too. tests/agility.rs now runs for that target, and docs/linux.md shows how to build leonida.exe on linux without xwin. ### Tested - llvm-readobj on the gnullvm exe: before, no exports and d3d12.dll a normal import. after, both exports and d3d12.dll in the delay-import table - tests/agility.rs under wine 11.23: 2 failed with main's build.rs, 2 passed with this one - msvc build via xwin: exports and delay-load identical before and after - docs tests (tests/test_docs_*.py) pass GPUs tested: n/a (link and export change, no gpu code) AI-assisted: yes. code by claude opus, reviewed by separate read-only claude opus and claude sonnet reviewer agents, checked by me.
MoonEyes commented 2026-12-02 21:59:43 +00:00

This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
merzleckeier reviewed 2026-12-02 22:05:15 +00:00
merzleckeier left a comment
No description provided.
Reviewed `7fa7043e` on `f3865cae8`. I compiled both versions of `build.rs` with Rust 1.98.1 and compared their output. The MSVC and plain GNU directives match `main`, and `rustc --print cfg` confirms `target_env="gnu", target_abi="llvm"` for the gnullvm target. I passed the exact emitted gnullvm arguments through Clang/lld 23.1.5 when linking a synthetic x86-64 PE with a stub `d3d12.dll` import library. With the base directives, `llvm-readobj` reports a plain import and no Agility exports. With the PR directives, the PE exports `D3D12SDKPath` and `D3D12SDKVersion` and reports `d3d12.dll` only as a delay import. This checks the linker argument handling and PE tables. The full runtime build and Wine integration are covered by the author’s tests.
bercedev commented 2026-12-02 22:57:54 +00:00

run report for 7fa7043eb merged onto main f3865cae8 (no conflicts), plus main alone for comparison

setup: rtx 4050 laptop 6 gb, nvidia 620.73.04, i5-14500hx, 32 gb, cachyos linux 7.3.6, proton experimental 11.0 wine with protonida's wineserver patch, vkd3d-proton master f8c1cae83. both exes built the same way (x86_64-pc-windows-gnullvm, --features diagnostics), same prefix, same play-linux.sh settings, series s. numbers from tools/game_gate.py summary on each run folder (i drove the runs from a bash loop since game-gate.ps1 is windows only)

run exe world s median fps result
warm-up (discarded) pr 331 10.8 clean exit, 11 s pipeline gap
1 main 334 13.6 clean exit, 10.5 s pipeline gap
2 pr 183 12.3 device lost (0x887A0005)
3 pr 332 12.2 PASS, clean exit
4 main 106 11.5 hung, no device lost message, had to kill it

so both sides went down once. the pr only adds two exports and delay-loads d3d12.dll on the gnullvm target, and the msvc link is unchanged, so i don't think either failure comes from it. the kernel log showed NVRM intermapRegisterDmaMapping errors on both sides (most before run 2's device loss), and vram sat at ~5.2/5.2 gb, so it looks like this 6 gb card + linux setup being on the edge rather than the change. run 3 went through the same scripted corridor scene where run 2 died

one thing that makes every linux run noisier than it should be: the log says "no host pipeline library: pipelines are not kept" on every start, so nothing is persisted and each launch recompiles hundreds of psos (the 10 s gaps above, LEONIDA_PIPELINE_WAIT_MS=10000). that's the empty-slice CreatePipelineLibrary call vkd3d-proton rejects with E_INVALIDARG, which #2654 fixes. merging #2654 would make linux gate runs a lot more meaningful

AI-assisted: yes (claude). runs played by me

run report for 7fa7043eb merged onto main f3865cae8 (no conflicts), plus main alone for comparison setup: rtx 4050 laptop 6 gb, nvidia 620.73.04, i5-14500hx, 32 gb, cachyos linux 7.3.6, proton experimental 11.0 wine with protonida's wineserver patch, vkd3d-proton master f8c1cae83. both exes built the same way (x86_64-pc-windows-gnullvm, --features diagnostics), same prefix, same play-linux.sh settings, series s. numbers from tools/game_gate.py summary on each run folder (i drove the runs from a bash loop since game-gate.ps1 is windows only) | run | exe | world s | median fps | result | |---|---|---|---|---| | warm-up (discarded) | pr | 331 | 10.8 | clean exit, 11 s pipeline gap | | 1 | main | 334 | 13.6 | clean exit, 10.5 s pipeline gap | | 2 | pr | 183 | 12.3 | device lost (0x887A0005) | | 3 | pr | 332 | 12.2 | PASS, clean exit | | 4 | main | 106 | 11.5 | hung, no device lost message, had to kill it | so both sides went down once. the pr only adds two exports and delay-loads d3d12.dll on the gnullvm target, and the msvc link is unchanged, so i don't think either failure comes from it. the kernel log showed NVRM intermapRegisterDmaMapping errors on both sides (most before run 2's device loss), and vram sat at ~5.2/5.2 gb, so it looks like this 6 gb card + linux setup being on the edge rather than the change. run 3 went through the same scripted corridor scene where run 2 died one thing that makes every linux run noisier than it should be: the log says "no host pipeline library: pipelines are not kept" on every start, so nothing is persisted and each launch recompiles hundreds of psos (the 10 s gaps above, LEONIDA_PIPELINE_WAIT_MS=10000). that's the empty-slice CreatePipelineLibrary call vkd3d-proton rejects with E_INVALIDARG, which #2654 fixes. merging #2654 would make linux gate runs a lot more meaningful AI-assisted: yes (claude). runs played by me
fiestorra commented 2026-12-02 23:02:02 +00:00

VERIFY-3238 — Windows nativo (MSVC): el camino de siempre sigue exportando; la rama nueva no se puede construir aquí

Own commit 7fa7043eb — apps/leonida/build.rs (+26/−5), tests/agility.rs (1 line), docs/linux.md
Merge base recent

Ran

cargo test -p leonida --test agility      2 passed; 0 failed

And that test is the right one for this change: the_exe_exports_the_agility_sdk_symbols reads the built executable's exports for D3D12SDKVersion and D3D12SDKPath, and d3d12_dll_is_delay_loaded reads the import table — precisely the four link arguments the build.rs change rearranges. Both pass, so the MSVC path the refactor touches still produces the same exports and delay-load.

What the change is: the CARGO_CFG_TARGET_ENV == "msvc" check becomes a match over target env and ABI, so x86_64-pc-windows-gnullvm (llvm-mingw's clang and lld) gets the same exports through lld's MinGW driver — -Xlinker to keep the comma that -Wl, would split on, and mingw-w64's own runtime for the delay-load helper — while GNU ld (x86_64-pc-windows-gnu) gets neither, which the comment says outright. docs/linux.md gains the three lines that tell a reader to use it.

What I could not test — and it is the whole new branch: there is no x86_64-pc-windows-gnullvm toolchain on this machine, so the code path the pull request adds is never compiled here. What I verified is that the refactor did not break the MSVC path, which is the regression risk of turning an if into a match; the new path itself needs a gnullvm build on the runner that has it.

One note for whoever reviews the build logic: -Xlinker with a space-separated argument is the correct way to hand lld a comma inside one switch, and the comment states it — that is the kind of detail that is invisible until a link line is read, and it is documented here.

Written with an AI assistant.

## VERIFY-3238 — Windows nativo (MSVC): el camino de siempre sigue exportando; **la rama nueva no se puede construir aquí** | | | |---|---| | Own commit | `7fa7043eb` — `apps/leonida/build.rs` (+26/−5), `tests/agility.rs` (1 line), `docs/linux.md` | | Merge base | recent | **Ran** ``` cargo test -p leonida --test agility 2 passed; 0 failed ``` **And that test is the right one for this change**: `the_exe_exports_the_agility_sdk_symbols` reads the built executable's exports for **`D3D12SDKVersion` and `D3D12SDKPath`**, and `d3d12_dll_is_delay_loaded` reads the import table — **precisely the four link arguments the `build.rs` change rearranges**. Both pass, so **the MSVC path the refactor touches still produces the same exports and delay-load**. **What the change is**: the `CARGO_CFG_TARGET_ENV == "msvc"` check becomes a `match` over **target env and ABI**, so `x86_64-pc-windows-gnullvm` (llvm-mingw's clang and lld) gets the same exports **through lld's MinGW driver** — `-Xlinker` to keep the comma that `-Wl,` would split on, and mingw-w64's own runtime for the delay-load helper — while **GNU ld (`x86_64-pc-windows-gnu`) gets neither**, which the comment says outright. `docs/linux.md` gains the three lines that tell a reader to use it. **What I could not test — and it is the whole new branch**: **there is no `x86_64-pc-windows-gnullvm` toolchain on this machine**, so the code path the pull request adds is **never compiled here**. What I verified is that **the refactor did not break the MSVC path**, which is the regression risk of turning an `if` into a `match`; **the new path itself needs a gnullvm build on the runner that has it.** **One note for whoever reviews the build logic**: `-Xlinker` with a space-separated argument is the correct way to hand `lld` a comma inside one switch, and the comment states it — that is the kind of detail that is invisible until a link line is read, and it is documented here. Written with an AI assistant.
Sign in to join this conversation.
No description provided.