Skip to content

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

Open
lhnizdo wants to merge 3 commits into
Marvisak:mainfrom
lhnizdo:pr/agility-sdk
Open

lhnizdo wants to merge 3 commits into
Marvisak:mainfrom
lhnizdo:pr/agility-sdk

Conversation

@lhnizdo

@lhnizdo lhnizdo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kotekompotek

Copy link
Copy Markdown

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:

lhnizdo added a commit to lhnizdo/VIctory that referenced this pull request Nov 25, 2026
…non-MSVC targets)

Review of Marvisak#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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
@lhnizdo

lhnizdo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

lhnizdo and others added 3 commits November 25, 2026 19:04
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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
(cherry picked from commit 2959665e6d87306200277ecdda222cc71b35280d)
…non-MSVC targets)

Review of Marvisak#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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
Review of Marvisak#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 <noreply@anthropic.com>
@lhnizdo

lhnizdo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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.
  • GPU: use the DirectX Agility SDK when the system D3D12 runtime refuses the shaders' root signatures #2429: agreed that it covers more. Happy for the maintainer to pick either one. This is the small app-only version.

lhnizdo added a commit to lhnizdo/VIctory that referenced this pull request Nov 26, 2026
Measured in the world on an RTX 2080 (1,000,000-view cap), `main` +
Marvisak#2460 Marvisak#2461 Marvisak#2464 and local work, 10 minutes each from a save that
loads into the world: with 65,533 dynamic slots the host ran out of
them and dropped draws (512 and more, and root views); with this PR's
layout before (721,469 title slots, 262,144 dynamic) none were dropped,
and no draw read a title slot past the kept ones (523,715 left out, all
for_draw=false). Back to that layout until a scene needs more title
slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
@lerapeurdu62280-debug

Copy link
Copy Markdown

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)

@lhnizdo

lhnizdo commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants