victory.exe: load the D3D12 Agility SDK from .\D3D12\ #2460

Open
github-bot wants to merge 3 commits from github-bot/gh-2460 into main AGit
Owner

@⁠lhnizdo on GitHub · 2026-11-25 14:00 UTC · original
lhnizdo:pr/agility-sdk → main · +56 −0 · 3 files · 3 commits · open

On Windows 10 the D3D12 runtime in System32 refuses root signatures with the directly indexed heap flags (CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED, 0xC00) that translated shaders need. On a Windows 10 22H2 machine (build 19045) with an NVIDIA card, every root signature was refused ("Unsupported bit-flag set (root signature flags c01)", 196 times), nothing drew, and the title crashed about 18 s in.

victory.exe now exports D3D12SDKVersion (620) and D3D12SDKPath (.\D3D12\). Windows then loads D3D12Core.dll from D3D12\ next to the exe, instead of the System32 runtime. Rust does not export statics from an executable, so apps/victory/build.rs adds the /EXPORT linker arguments (MSVC targets only).

Without the folder, Windows keeps its own runtime, so machines where main already runs are unaffected.

Setup: take build\native\bin\x64\ from the Microsoft.Direct3D.D3D12 NuGet package, version 1.620.x (tested with 1.620.2). Copy D3D12Core.dll, plus d3d12SDKLayers.dll for the debug layer, into target\<profile>\D3D12\. I haven't added the DLLs or a download step to the repository; tell me if you'd like either, or a README section.

Checked on that machine: root signatures are taken, the title draws, and the D3D12 debug layer works through d3d12SDKLayers.dll.

🤖 Generated with Claude Code. The change was written by Claude Code (Claude Opus 5.5) in my session; the commit carries a Co-Authored-By: Claude line.

**@⁠lhnizdo** on GitHub · 2026-11-25 14:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460) `lhnizdo:pr/agility-sdk` → `main` · +56 −0 · 3 files · 3 commits · open On Windows 10 the D3D12 runtime in System32 refuses root signatures with the directly indexed heap flags (`CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED`, 0xC00) that translated shaders need. On a Windows 10 22H2 machine (build 19045) with an NVIDIA card, every root signature was refused ("Unsupported bit-flag set (root signature flags c01)", 196 times), nothing drew, and the title crashed about 18 s in. `victory.exe` now exports `D3D12SDKVersion` (620) and `D3D12SDKPath` (`.\D3D12\`). Windows then loads `D3D12Core.dll` from `D3D12\` next to the exe, instead of the System32 runtime. Rust does not export statics from an executable, so `apps/victory/build.rs` adds the `/EXPORT` linker arguments (MSVC targets only). Without the folder, Windows keeps its own runtime, so machines where `main` already runs are unaffected. **Setup:** take `build\native\bin\x64\` from the [Microsoft.Direct3D.D3D12](https://www.nuget.org/packages/Microsoft.Direct3D.D3D12) NuGet package, version 1.620.x (tested with 1.620.2). Copy `D3D12Core.dll`, plus `d3d12SDKLayers.dll` for the debug layer, into `target\<profile>\D3D12\`. I haven't added the DLLs or a download step to the repository; tell me if you'd like either, or a README section. **Checked** on that machine: root signatures are taken, the title draws, and the D3D12 debug layer works through `d3d12SDKLayers.dll`. 🤖 Generated with [Claude Code](https://claude.com/claude-code). The change was written by Claude Code (Claude Opus 5.5) in my session; the commit carries a `Co-Authored-By: Claude` line.
victory.exe exports D3D12SDKVersion (620) and D3D12SDKPath (".\D3D12\"),
so Windows loads D3D12Core.dll from the Microsoft.Direct3D.D3D12 1.620.x
NuGet package (build\native\bin\x64\, with d3d12SDKLayers.dll) placed in
target\<profile>\D3D12\, instead of the System32 runtime. Rust does not
export statics from an executable, so build.rs adds the /EXPORT linker
arguments (MSVC targets). Without the folder Windows keeps its own
runtime.

On a Windows 10 machine (NVIDIA, wave32) the System32 runtime refused
root signatures with the directly indexed heap flags (0xC00) our
translated shaders need, so nothing drew; with the Agility SDK the menus
run at 30 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
(cherry picked from commit 2959665e6d87306200277ecdda222cc71b35280d)
Review of #2460: GNU ld takes no /EXPORT:, so on x86_64-pc-windows-gnu
the exports were silently left out. A Windows build for a non-MSVC
target now warns that Windows' own D3D12 runtime will be used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
Review of #2460: the setup was not documented. Where the DLLs come from,
where they go, that the version must match D3D12SDKVersion (620), and that
without the folder nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:06:32 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 14:12 UTC · original

The mechanism is the documented one (exe export table + app-local .\D3D12\), and the CARGO_CFG_TARGET_ENV gate keeps GNU builds compiling — but two caveats from testing in this area:

  • On x86_64-pc-windows-gnu this silently does nothing: /EXPORT: is unsupported by GNU ld (same wall #486 hit — rustc-link-arg with a .def file is the GNU path, or rustc-link-arg-bins + .def). Whatever ships should either emit the .def too or be explicit that the feature is msvc-only.
  • Scope: this covers victory.exe only. #2429's ID3D12DeviceFactory route covers the same app case plus test binaries and, crucially, the title-facing d3d12_xs! serializers (the title's own root signatures carry the same flags the system runtime refuses — an export-loaded SDK does not re-route a GetProcAddress("d3d12.dll","D3D12SerializeRootSignature") lookup, which still resolves to the system serializer). If #2429 lands, this becomes redundant for device creation; if a minimal app-only change is wanted first, this is the clean version of that.
**@⁠kotekompotek** on GitHub · 2026-11-25 14:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7164924942) The mechanism is the documented one (exe export table + app-local `.\D3D12\`), and the `CARGO_CFG_TARGET_ENV` gate keeps GNU builds compiling — but two caveats from testing in this area: - **On `x86_64-pc-windows-gnu` this silently does nothing**: `/EXPORT:` is unsupported by GNU `ld` (same wall #486 hit — `rustc-link-arg` with a `.def` file is the GNU path, or `rustc-link-arg-bins` + `.def`). Whatever ships should either emit the `.def` too or be explicit that the feature is msvc-only. - **Scope**: this covers `victory.exe` only. #2429's `ID3D12DeviceFactory` route covers the same app case plus test binaries and, crucially, the title-facing `d3d12_xs!` serializers (the title's own root signatures carry the same flags the system runtime refuses — an export-loaded SDK does not re-route a `GetProcAddress("d3d12.dll","D3D12SerializeRootSignature")` lookup, which still resolves to the system serializer). If #2429 lands, this becomes redundant for device creation; if a minimal app-only change is wanted first, this is the clean version of that.
Author
Owner

@⁠lhnizdo on GitHub · 2026-11-25 14:46 UTC · original

Thanks. You're right about GNU: /EXPORT: only works with MSVC's linker. I've pushed a commit that makes it explicit: a Windows build for a non-MSVC target now prints a cargo warning that the Agility SDK isn't exported and Windows' own runtime will be used. I can't test x86_64-pc-windows-gnu here, so I didn't add a .def path I couldn't verify.

On #2429: agreed that the ID3D12DeviceFactory route covers more (test binaries, and the title's own serializer lookups). If #2429 lands, this one is redundant for device creation, and I'm happy for the owner to pick that one. This is the minimal app-only version, tested on Windows 10 22H2 with an NVIDIA card, where nothing drew without it.

**@⁠lhnizdo** on GitHub · 2026-11-25 14:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7165781496) Thanks. You're right about GNU: `/EXPORT:` only works with MSVC's linker. I've pushed a commit that makes it explicit: a Windows build for a non-MSVC target now prints a cargo warning that the Agility SDK isn't exported and Windows' own runtime will be used. I can't test `x86_64-pc-windows-gnu` here, so I didn't add a `.def` path I couldn't verify. On #2429: agreed that the `ID3D12DeviceFactory` route covers more (test binaries, and the title's own serializer lookups). If #2429 lands, this one is redundant for device creation, and I'm happy for the owner to pick that one. This is the minimal app-only version, tested on Windows 10 22H2 with an NVIDIA card, where nothing drew without it.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:56 UTC · original · edited 2026-11-25 18:46 UTC

Automated triage for the maintainers.

Needs the maintainer's decision. This adds apps/victory/build.rs (linker /EXPORT arguments, MSVC targets only, a cargo warning on other Windows targets) and makes victory.exe export D3D12SDKVersion (620) and D3D12SDKPath (.\D3D12\) in apps/victory/src/main.rs, so Windows loads D3D12Core.dll from that folder when it is there. Triage does not recommend build-script changes or loading a separately obtained runtime DLL on its own. By reading, the exports have the shape Windows looks for (a u32 and a pointer to a NUL-terminated path), and without the folder nothing changes. CI check passes.

For the maintainer to weigh: the SDK version is fixed at 620 and must match the DLL users copy in, and #2429 (ID3D12DeviceFactory) covers the same need more broadly, including test binaries and the title's own root-signature serializer lookups.

On your reply: thanks, the new README section answers the setup and version points. What remains is the maintainer's call on the build script, the external DLL, and this versus #2429.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7167455223) · edited 2026-11-25 18:46 UTC <!-- victory-triage v1 head=ed3a25155bc309b109a8b6affd0937f04240588e verdict=needs-work at=2026-11-25T18:45:59Z --> Automated triage for the maintainers. **Needs the maintainer's decision.** This adds `apps/victory/build.rs` (linker `/EXPORT` arguments, MSVC targets only, a cargo warning on other Windows targets) and makes `victory.exe` export `D3D12SDKVersion` (620) and `D3D12SDKPath` (`.\D3D12\`) in `apps/victory/src/main.rs`, so Windows loads `D3D12Core.dll` from that folder when it is there. Triage does not recommend build-script changes or loading a separately obtained runtime DLL on its own. By reading, the exports have the shape Windows looks for (a `u32` and a pointer to a NUL-terminated path), and without the folder nothing changes. CI `check` passes. For the maintainer to weigh: the SDK version is fixed at 620 and must match the DLL users copy in, and #2429 (`ID3D12DeviceFactory`) covers the same need more broadly, including test binaries and the title's own root-signature serializer lookups. On your reply: thanks, the new README section answers the setup and version points. What remains is the maintainer's call on the build script, the external DLL, and this versus #2429. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠lhnizdo on GitHub · 2026-11-25 18:07 UTC · original

Rebased onto current main (13f91ca). On the triage points:

  • Setup docs: added a README section, "Windows 10: the D3D12 Agility SDK": where the DLLs come from, where they go, and that without the folder nothing changes.
  • Version 620: it has to match the DLL's middle version number. The README now says so, with a pointer to the constant. Moving to a newer SDK means changing the constant and the DLL together.
  • #2429: agreed that it covers more. Happy for the maintainer to pick either one. This is the small app-only version.
**@⁠lhnizdo** on GitHub · 2026-11-25 18:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7170471928) Rebased onto current `main` (13f91ca). On the triage points: - **Setup docs:** added a README section, "Windows 10: the D3D12 Agility SDK": where the DLLs come from, where they go, and that without the folder nothing changes. - **Version 620:** it has to match the DLL's middle version number. The README now says so, with a pointer to the constant. Moving to a newer SDK means changing the constant and the DLL together. - **#2429:** agreed that it covers more. Happy for the maintainer to pick either one. This is the small app-only version.
Author
Owner

@⁠lerapeurdu62280-debug on GitHub · 2026-11-26 16:04 UTC · original

Test report on Windows 10 Pro 19045, AMD RX 6600 (Adrenalin 32.0.21045), with the Agility SDK 1.620.2 from NuGet (D3D12Core.dll signed by Microsoft). No game files: victory.exe translate --pipelines <empty folder>, which makes a host device first (Host::new(false)).

victory.exe no D3D12\ folder D3D12\ next to the exe
main 63bcca4 the device supports SM 0x65 only the same (the folder is ignored)
this PR (ed3a251) Error: … D3D12 SDK version configuration of the host executable is invalid (0x887E0003) device made, 0 emitted … 0 pipelines (no error)

So the folder works as intended. But without it, the exe can no longer make any device. That contradicts "Without the folder, Windows keeps its own runtime" in the description and the code comment. It is the same loader behaviour found for the test binaries in #2878 (0x887E0003 on Windows 11), which #2878 fixed by exporting only when the runtime is staged. As it stands, this PR would break victory.exe on every PC without the folder, Windows 11 included, where main runs today.

For comparison, #2429 (runtime chosen at first use through ID3D12DeviceFactory, no exports) on the same PC: device made with the folder, and without it the same SM 0x65 only as main, so no regression.

AI-assisted: yes (Claude Code)

**@⁠lerapeurdu62280-debug** on GitHub · 2026-11-26 16:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7197145782) Test report on **Windows 10 Pro 19045, AMD RX 6600** (Adrenalin 32.0.21045), with the Agility SDK 1.620.2 from NuGet (`D3D12Core.dll` signed by Microsoft). No game files: `victory.exe translate --pipelines <empty folder>`, which makes a host device first (`Host::new(false)`). | `victory.exe` | no `D3D12\` folder | `D3D12\` next to the exe | |---|---|---| | `main` 63bcca4 | `the device supports SM 0x65 only` | the same (the folder is ignored) | | this PR (ed3a251) | **`Error: … D3D12 SDK version configuration of the host executable is invalid`** (0x887E0003) | device made, `0 emitted … 0 pipelines` (no error) | So the folder works as intended. **But without it, the exe can no longer make any device.** That contradicts "Without the folder, Windows keeps its own runtime" in the description and the code comment. It is the same loader behaviour found for the test binaries in #2878 (0x887E0003 on Windows 11), which #2878 fixed by exporting only when the runtime is staged. As it stands, this PR would break `victory.exe` on every PC without the folder, Windows 11 included, where `main` runs today. For comparison, #2429 (runtime chosen at first use through `ID3D12DeviceFactory`, no exports) on the same PC: device made with the folder, and without it the same `SM 0x65 only` as `main`, so no regression. AI-assisted: yes (Claude Code)
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 14:04 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11:

  • Exporting Agility SDK symbols from victory.exe (apps/victory/build.rs + main.rs) builds cleanly and passes all victory tests.
  • cargo test -p victory: 12/12 passed.
  • cargo clippy -p victory --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 184 files ok.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 14:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#pullrequestreview-6059058246) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11: - Exporting Agility SDK symbols from `victory.exe` (`apps/victory/build.rs` + `main.rs`) builds cleanly and passes all `victory` tests. - `cargo test -p victory`: 12/12 passed. - `cargo clippy -p victory --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 184 files ok. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 14:11 UTC · original · reviewed

Fifth Agility SDK PR — this one the cleanest mechanism: build.rs /EXPORT:D3D12SDKVersion,DATA + loading from .\D3D12. If the cluster converges, this export mechanism is the right core. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

**@⁠catminou4** on GitHub · 2026-11-25 14:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#pullrequestreview-6059180658) · **reviewed** **Fifth Agility SDK PR** — this one the cleanest mechanism: build.rs /EXPORT:D3D12SDKVersion,DATA + loading from .\D3D12\. If the cluster converges, this export mechanism is the right core. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Author
Owner

@⁠lhnizdo on GitHub · 2026-11-26 16:31 UTC · original

@⁠lerapeurdu62280-debug, thank you, you're right. The D3D12SDKVersion and D3D12SDKPath exports make the loader insist on the Agility runtime, so without a D3D12\ folder victory.exe can't make a device at all (0x887E0003). The description's "Windows keeps its own runtime" is wrong. It's the same behavior we hit with the test binaries in #2878, and there a build-time check fixed it. For the exe that can't work: whether the folder is there only matters on the PC that runs it.

#2429 picks the runtime at first use through ID3D12DeviceFactory, with no exports, and by your table it behaves like main without the folder and uses the folder when it's there. That's the right shape for this, so I'm happy to close #2460 in favor of #2429. I'll close it once #2429 is the way forward for the maintainers, unless someone wants something of #2460 kept.

AI-assisted (Claude Code). No game data.

**@⁠lhnizdo** on GitHub · 2026-11-26 16:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2460#issuecomment-7197761827) @⁠lerapeurdu62280-debug, thank you, you're right. The `D3D12SDKVersion` and `D3D12SDKPath` exports make the loader insist on the Agility runtime, so without a `D3D12\` folder `victory.exe` can't make a device at all (0x887E0003). The description's "Windows keeps its own runtime" is wrong. It's the same behavior we hit with the test binaries in #2878, and there a build-time check fixed it. For the exe that can't work: whether the folder is there only matters on the PC that runs it. #2429 picks the runtime at first use through `ID3D12DeviceFactory`, with no exports, and by your table it behaves like `main` without the folder and uses the folder when it's there. That's the right shape for this, so I'm happy to close #2460 in favor of #2429. I'll close it once #2429 is the way forward for the maintainers, unless someone wants something of #2460 kept. AI-assisted (Claude Code). No game data.
This pull request can be merged automatically.
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 '+refs/pull/2460/head:github-bot/gh-2460'
git switch 'github-bot/gh-2460'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2460'
git switch 'github-bot/gh-2460'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2460'
git switch 'github-bot/gh-2460'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2460'
git switch 'main'
git merge --squash 'github-bot/gh-2460'
git switch 'main'
git merge --ff-only 'github-bot/gh-2460'
git switch 'main'
git merge 'github-bot/gh-2460'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/Marvisak--VIctory!2460
No description provided.