win10: export D3D12SDKVersion=621 at load time so the Agility SDK is actually used #39

Manually merged
github merged 6 commits from github-bot/gh-38 into main 2026-12-04 07:06:26 +00:00 AGit
Owner

@⁠gianlukin2001-ops on GitHub · 2026-12-04 05:35 UTC · original
gianlukin2001-ops:fix/agility-load-time-version → main · +11 −2 · 2 files · 1 commits · merged 2026-12-04 07:03 UTC

Summary

On Windows 10, v0.4.0 crashes at launch with 0xC0000005 (access violation) during GPU init. The log shows the host never reached the Agility SDK:

ERROR [gpu] the D3D12 runtime refuses directly indexed descriptor heaps (shader model 6.6), ...
WARN  [pipe] host root signature refused error=The parameter is incorrect. (0x80070057) ... flags=0xc00

Cause

d354c69 ("agility: opt into D3D12SDKVersion only when local D3D12Core.dll exists") changed the exported value from a static 621 to an AtomicU32 initialized to 0, then stored 621 from main():

pub static D3D12SDKVersion: AtomicU32 = AtomicU32::new(0);
// ...
fn main() -> Result<()> {
    #[cfg(windows)]
    agility::init(); // stores 621

d3d12.dll reads D3D12SDKVersion when it is loaded, before main runs. It sees 0, uses the OS in-box runtime, and Windows 10's in-box runtime refuses the SM 6.6 directly-indexed heap root-signature flags (0xc00). Every host pipeline is then refused and the title crashes at init with 0xC0000005.

Fix

Put 621 back in the file and drop the runtime store:

pub static D3D12SDKVersion: u32 = SDK_VERSION;

SDK_VERSION remains 621, matching the shipped D3D12Core.dll 1.621.0. One file, +7/−23, apps/victory/src/main.rs only.

Trade-off

With the version in the file, a host without D3D12\D3D12Core.dll fails device creation with D3D12_ERROR_INVALID_REDIST (0x887E0003) instead of silently falling back to the in-box runtime. That is the documented Agility SDK behavior and the README already tells users to install the folder; the silent fallback is what caused this regression.

Testing

  • Windows 10 22H2 (19045.6466), RX 9060 XT, D3D12Core.dll 1.621.0 next to victory.exe.
  • Before: 0xC0000005 at init; the log has the in-box / SM 6.6 error and refused root signatures.
  • After: host D3D12 device ready with no in-box / SM 6.6 / root-signature messages, and the title continues into streaming init.
  • Verified the built PE export holds 621 in initialized .rdata (not a zeroed .bss slot).

Credits

  • Reported and diagnosed on Windows 10 + RX 9060 XT: @⁠gianlukin2001-ops.
  • Regression introduced by @⁠zeex64 in d354c69.
  • Original Windows 10 Agility SDK opt-in: @⁠megancheetus (PR #8).
  • Project and D3D12 host: @⁠ReTerryDavis.
  • Implemented with AI assistance (OpenCode, DeepSeek V4.1 Flash Free), then reviewed and tested locally.
**@⁠gianlukin2001-ops** on GitHub · 2026-12-04 05:35 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/38) `gianlukin2001-ops:fix/agility-load-time-version` → `main` · +11 −2 · 2 files · 1 commits · merged 2026-12-04 07:03 UTC ## Summary On Windows 10, v0.4.0 crashes at launch with `0xC0000005` (access violation) during GPU init. The log shows the host never reached the Agility SDK: ``` ERROR [gpu] the D3D12 runtime refuses directly indexed descriptor heaps (shader model 6.6), ... WARN [pipe] host root signature refused error=The parameter is incorrect. (0x80070057) ... flags=0xc00 ``` ## Cause `d354c69` ("agility: opt into D3D12SDKVersion only when local D3D12Core.dll exists") changed the exported value from a static `621` to an `AtomicU32` initialized to `0`, then stored `621` from `main()`: ```rust pub static D3D12SDKVersion: AtomicU32 = AtomicU32::new(0); // ... fn main() -> Result<()> { #[cfg(windows)] agility::init(); // stores 621 ``` `d3d12.dll` reads `D3D12SDKVersion` **when it is loaded**, before `main` runs. It sees `0`, uses the OS in-box runtime, and Windows 10's in-box runtime refuses the SM 6.6 directly-indexed heap root-signature flags (`0xc00`). Every host pipeline is then refused and the title crashes at init with `0xC0000005`. ## Fix Put `621` back in the file and drop the runtime store: ```rust pub static D3D12SDKVersion: u32 = SDK_VERSION; ``` `SDK_VERSION` remains `621`, matching the shipped `D3D12Core.dll` 1.621.0. One file, +7/−23, `apps/victory/src/main.rs` only. ## Trade-off With the version in the file, a host without `D3D12\D3D12Core.dll` fails device creation with `D3D12_ERROR_INVALID_REDIST` (`0x887E0003`) instead of silently falling back to the in-box runtime. That is the documented Agility SDK behavior and the README already tells users to install the folder; the silent fallback is what caused this regression. ## Testing - Windows 10 22H2 (19045.6466), RX 9060 XT, `D3D12Core.dll` 1.621.0 next to `victory.exe`. - Before: `0xC0000005` at init; the log has the in-box / SM 6.6 error and refused root signatures. - After: `host D3D12 device ready` with **no** in-box / SM 6.6 / root-signature messages, and the title continues into streaming init. - Verified the built PE export holds `621` in initialized `.rdata` (not a zeroed `.bss` slot). ## Credits - Reported and diagnosed on Windows 10 + RX 9060 XT: **@⁠gianlukin2001-ops**. - Regression introduced by **@⁠zeex64** in `d354c69`. - Original Windows 10 Agility SDK opt-in: **@⁠megancheetus** (PR #8). - Project and D3D12 host: **@⁠ReTerryDavis**. - Implemented with AI assistance (OpenCode, DeepSeek V4.1 Flash Free), then reviewed and tested locally.
d354c69 stored 621 from main() to avoid D3D12_ERROR_INVALID_REDIST when the D3D12 folder is absent, but d3d12.dll reads the export when it loads, before main. The loader saw 0, used the in-box Windows 10 runtime, refused SM6.6 root signature flags (0xc00), and the title crashed with 0xC0000005 at init. Export the static value again; the local D3D12 folder is required and present.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 05:39:17 +00:00
Author
Owner

@⁠dokidokinh on GitHub · 2026-12-04 06:51 UTC · original

ReVIctory simply won't run on Windows 10 at all. Both versions 0.2.0 and 0.4.0 do the same thing: they throw an error during the warm-up phase, and even if you force it to run, not a single frame gets rendered.

**@⁠dokidokinh** on GitHub · 2026-12-04 06:51 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/38#issuecomment-7403975530) ReVIctory simply won't run on Windows 10 at all. Both versions 0.2.0 and 0.4.0 do the same thing: they throw an error during the warm-up phase, and even if you force it to run, not a single frame gets rendered.
github-bot force-pushed github-bot/gh-38 from 23acc223fc to 6e5fa0db65 2026-12-04 07:06:26 +00:00 Compare
github manually merged commit 9985bb8cdc into main 2026-12-04 07:06:26 +00:00
Author
Owner

@⁠ReTerryDavis on GitHub · 2026-12-04 07:03 UTC · original

Thanks for catching the load-time bug on Windows 10!

Exporting a static D3D12SDKVersion = 621 breaks Windows 11 hosts that don't have a local D3D12\D3D12Core.dll (D3D12CreateDevice fails with 0x887E0003 / D3D12_ERROR_INVALID_REDIST). Instead, I updated this PR to keep D3D12SDKVersion initialized to 0 and link d3d12.dll with /DELAYLOAD:d3d12.dll (+ delayimp.lib) in apps/victory/build.rs so agility::init() runs at the top of main() before d3d12.dll loads.

Verified live on Windows:

  • Without D3D12\D3D12Core.dll: loads C:\WINDOWS\SYSTEM32\D3D12Core.dll (no 0x887E0003).
  • With D3D12\D3D12Core.dll (1.621.0): agility::init() writes 621 before delay-load and d3d12.dll loads the local D3D12\D3D12Core.dll.

Merging now!

**@⁠ReTerryDavis** on GitHub · 2026-12-04 07:03 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/38#issuecomment-7404209604) Thanks for catching the load-time bug on Windows 10! Exporting a static `D3D12SDKVersion = 621` breaks Windows 11 hosts that don't have a local `D3D12\D3D12Core.dll` (`D3D12CreateDevice` fails with `0x887E0003` / `D3D12_ERROR_INVALID_REDIST`). Instead, I updated this PR to keep `D3D12SDKVersion` initialized to `0` and link `d3d12.dll` with `/DELAYLOAD:d3d12.dll` (+ `delayimp.lib`) in `apps/victory/build.rs` so `agility::init()` runs at the top of `main()` **before** `d3d12.dll` loads. Verified live on Windows: - Without `D3D12\D3D12Core.dll`: loads `C:\WINDOWS\SYSTEM32\D3D12Core.dll` (no `0x887E0003`). - With `D3D12\D3D12Core.dll` (1.621.0): `agility::init()` writes `621` before delay-load and `d3d12.dll` loads the local `D3D12\D3D12Core.dll`. Merging now!
This discussion has been locked. Commenting is limited to contributors.
No description provided.