GPU: load the Agility SDK through ID3D12SDKConfiguration1 (#749) #969

Open
mgunes1311-lab wants to merge 17 commits from upstream-pr/969 into main
mgunes1311-lab commented 2026-11-24 14:36:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-24T14:36:09Z.


Loads the DirectX 12 Agility SDK (D3D12Core.dll) at runtime via ID3D12SDKConfiguration1::CreateDeviceFactory without exporting D3D12SDKVersion or D3D12SDKPath from victory.exe.

Summary of Changes

  • crates/victory-shader/src/emit/agility.rs & mod.rs:
    • Resolves D3D12Core.dll from VICTORY_D3D12_AGILITY (if set) or D3D12\D3D12Core.dll beside the executable, supporting a DLL path, directory, or unpacked NuGet package (build\native\bin\x64\D3D12Core.dll).
    • Parses D3D12SDKVersion from D3D12Core.dll's PE export table (sdk_version) without loading or executing the DLL.
    • Queries ID3D12SDKConfiguration1 and creates a process-wide ID3D12DeviceFactory (Factory::load), configuring D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE, ApplyToGlobalState, CLSID_D3D12Debug, and CLSID_D3D12DeviceRemovedExtendedData.
    • Adds serialize_versioned_root_signature, routing serialization through ID3D12DeviceConfiguration::SerializeVersionedRootSignature when supported by the device so 0xc01 heap-indexing root signatures work on Windows 10 without touching an older in-box d3d12.dll serializer.
    • The main GPU host falls back to system d3d12.dll when no Agility SDK is configured or loading fails. The shader test/host path uses the system runtime when no SDK is configured, but propagates an SDK loading error instead of falling back.
    • Adds unit tests for PE export parsing, core discovery, relative path formatting, and a live VICTORY_D3D12_AGILITY device + 0xc01 root-signature test.
  • crates/victory-shader/src/emit/host.rs: Uses agility::Factory::load() and agility::serialize_versioned_root_signature.
  • crates/victory-gpu/Cargo.toml, src/host.rs, src/pipeline/host.rs: Enables the host feature on victory-shader for Windows and wires Factory (including apply_global, debug layer, DRED, WARP/hardware device creation) and serialize_versioned_root_signature into the host GPU.
  • README.md: Documents Windows 10 (22H2 with KB5029331 or newer) Agility SDK setup (D3D12\D3D12Core.dll or VICTORY_D3D12_AGILITY=<dir>).

Verification

  • Verified with cargo test, Clippy, xtask asset policy checks, and live GPU tests against Agility SDK v620.

Closes #749

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584223337 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969). Originally posted by [mgunes1311-lab](https://github.com/mgunes1311-lab) on 2026-11-24T14:36:09Z. --- Loads the DirectX 12 Agility SDK (`D3D12Core.dll`) at runtime via `ID3D12SDKConfiguration1::CreateDeviceFactory` without exporting `D3D12SDKVersion` or `D3D12SDKPath` from `victory.exe`. ### Summary of Changes - **`crates/victory-shader/src/emit/agility.rs` & `mod.rs`:** - Resolves `D3D12Core.dll` from `VICTORY_D3D12_AGILITY` (if set) or `D3D12\D3D12Core.dll` beside the executable, supporting a DLL path, directory, or unpacked NuGet package (`build\native\bin\x64\D3D12Core.dll`). - Parses `D3D12SDKVersion` from `D3D12Core.dll`'s PE export table (`sdk_version`) without loading or executing the DLL. - Queries `ID3D12SDKConfiguration1` and creates a process-wide `ID3D12DeviceFactory` (`Factory::load`), configuring `D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE`, `ApplyToGlobalState`, `CLSID_D3D12Debug`, and `CLSID_D3D12DeviceRemovedExtendedData`. - Adds `serialize_versioned_root_signature`, routing serialization through `ID3D12DeviceConfiguration::SerializeVersionedRootSignature` when supported by the device so `0xc01` heap-indexing root signatures work on Windows 10 without touching an older in-box `d3d12.dll` serializer. - The main GPU host falls back to system `d3d12.dll` when no Agility SDK is configured or loading fails. The shader test/host path uses the system runtime when no SDK is configured, but propagates an SDK loading error instead of falling back. - Adds unit tests for PE export parsing, core discovery, relative path formatting, and a live `VICTORY_D3D12_AGILITY` device + `0xc01` root-signature test. - **`crates/victory-shader/src/emit/host.rs`:** Uses `agility::Factory::load()` and `agility::serialize_versioned_root_signature`. - **`crates/victory-gpu/Cargo.toml`, `src/host.rs`, `src/pipeline/host.rs`:** Enables the `host` feature on `victory-shader` for Windows and wires `Factory` (including `apply_global`, debug layer, DRED, WARP/hardware device creation) and `serialize_versioned_root_signature` into the host GPU. - **`README.md`:** Documents Windows 10 (22H2 with KB5029331 or newer) Agility SDK setup (`D3D12\D3D12Core.dll` or `VICTORY_D3D12_AGILITY=<dir>`). ### Verification - Verified with `cargo test`, Clippy, `xtask` asset policy checks, and live GPU tests against Agility SDK v620. Closes #749
EduBertozzi commented 2026-11-24 15:04:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by EduBertozzi on 2026-11-24T14:38:41Z.


Tested f3457f8 (on current main) on Windows 10 22H2 19045.6456 with a GTX 1060 6 GB (Pascal, driver 32.0.15.8266). The in-box runtime there stops at SM 6.5. I used the 1.620.2 D3D12Core.dll.

VICTORY_D3D12_AGILITY unset set to the folder holding D3D12Core.dll
cargo test -p victory-shader --lib GPU tests fail: neither hardware nor WARP SM 6.6 device available 123 passed, 0 failed, 1 ignored, including creates_device_and_serializes_heap_indexed_root_signature_when_configured
cargo test -p victory-gpu --lib n/a 50 passed, 0 failed, 1 ignored

So on this Windows 10 build, CreateDeviceFactory loads the newer core and the 0xc01 root signatures serialize, without D3D12SDKVersion / D3D12SDKPath exports.

One consequence worth noting next to #175, #463, #362 and #486: because no exe exports are needed, test binaries get SM 6.6 from the environment variable alone. On this machine that made the Windows 10 test-binary work (#486, #362) unnecessary for these two crates.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134712938 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7134712938). Originally posted by [EduBertozzi](https://github.com/EduBertozzi) on 2026-11-24T14:38:41Z. --- Tested `f3457f8` (on current `main`) on **Windows 10 22H2 19045.6456** with a **GTX 1060 6 GB** (Pascal, driver 32.0.15.8266). The in-box runtime there stops at SM 6.5. I used the 1.620.2 `D3D12Core.dll`. | | `VICTORY_D3D12_AGILITY` unset | set to the folder holding `D3D12Core.dll` | |---|---|---| | `cargo test -p victory-shader --lib` | GPU tests fail: `neither hardware nor WARP SM 6.6 device available` | **123 passed**, 0 failed, 1 ignored, including `creates_device_and_serializes_heap_indexed_root_signature_when_configured` | | `cargo test -p victory-gpu --lib` | n/a | **50 passed**, 0 failed, 1 ignored | So on this Windows 10 build, `CreateDeviceFactory` loads the newer core and the `0xc01` root signatures serialize, without `D3D12SDKVersion` / `D3D12SDKPath` exports. One consequence worth noting next to #175, #463, #362 and #486: because no exe exports are needed, **test binaries get SM 6.6 from the environment variable alone**. On this machine that made the Windows 10 test-binary work (#486, #362) unnecessary for these two crates. AI-assisted (Claude Code).
Zipettte commented 2026-11-24 16:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:13:10Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at f3457f8: cargo test -p victory-gpu -p victory-shader passes, 173 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135654125 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7135654125). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:13:10Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at f3457f8: `cargo test -p victory-gpu -p victory-shader` passes, 173 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
mauri9911 commented 2026-11-24 19:04:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mauri9911 on 2026-11-24T18:48:57Z.


Tested this branch (f3457f8) on a configuration that is not in the PR description:

  • Windows 10 IoT Enterprise LTSC 21H2, build 19044, without KB5029331 (Get-HotFix shows it is not installed), so below the 22H2 + KB5029331 the README asks for
  • NVIDIA GeForce RTX 5060 Ti (driver 32.0.16.2101, WDDM 2.7)
  • Agility SDK 1.619.6, VICTORY_D3D12_AGILITY pointing at the folder with D3D12Core.dll

Results:

  • cargo test -p victory-shader --release: 123 passed, 1 ignored. On main the GPU ones (valu_tests, waterfall_tests) fail here with "neither hardware nor WARP SM 6.6 device available".
  • cargo test -p victory-gpu --release: 50 passed, 1 ignored.
  • Running the title (run ... --execute, 45 s): log shows Agility SDK ready version=619, no root signature flags c01 warnings, and frames presented with draws=5319 drawn=5319 (on main it was drawn=0).

So the CreateDeviceFactory route works on 19044 too. In my own attempt (#1518, exports only) the runtime-only ID3D12SDKConfiguration::SetSDKVersion returned DXGI_ERROR_INVALID_CALL for every path and version I tried, and the exe-exports route needs the exe to carry them and leaves the unit tests without SM 6.6.

I'll close #1518 as a duplicate of this one if the maintainer prefers this approach.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141191027 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7141191027). Originally posted by [mauri9911](https://github.com/mauri9911) on 2026-11-24T18:48:57Z. --- Tested this branch (f3457f8) on a configuration that is not in the PR description: - Windows 10 IoT Enterprise LTSC 21H2, build **19044**, **without KB5029331** (`Get-HotFix` shows it is not installed), so below the 22H2 + KB5029331 the README asks for - NVIDIA GeForce RTX 5060 Ti (driver 32.0.16.2101, WDDM 2.7) - Agility SDK 1.619.6, `VICTORY_D3D12_AGILITY` pointing at the folder with `D3D12Core.dll` Results: - `cargo test -p victory-shader --release`: 123 passed, 1 ignored. On `main` the GPU ones (`valu_tests`, `waterfall_tests`) fail here with "neither hardware nor WARP SM 6.6 device available". - `cargo test -p victory-gpu --release`: 50 passed, 1 ignored. - Running the title (`run ... --execute`, 45 s): log shows `Agility SDK ready version=619`, no `root signature flags c01` warnings, and frames presented with `draws=5319 drawn=5319` (on `main` it was `drawn=0`). So the `CreateDeviceFactory` route works on 19044 too. In my own attempt (#1518, exports only) the runtime-only `ID3D12SDKConfiguration::SetSDKVersion` returned `DXGI_ERROR_INVALID_CALL` for every path and version I tried, and the exe-exports route needs the exe to carry them and leaves the unit tests without SM 6.6. I'll close #1518 as a duplicate of this one if the maintainer prefers this approach. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 01:07:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:30:42Z.


Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-shader/src/emit/host.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note: the code read as sound, but it needs the maintainer's decision, since it loads and runs a user-chosen D3D12Core.dll from outside the repo (one of several approaches to #749).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148583710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7148583710). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:30:42Z. --- <!-- victory-triage v1 head=bb176b66a837d7f3bd6a09b8ba9488ae23e10fd9 verdict=needs-rebase at=2026-11-25T22:18:30Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-shader/src/emit/host.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note: the code read as sound, but it needs the maintainer's decision, since it loads and runs a user-chosen `D3D12Core.dll` from outside the repo (one of several approaches to #749). --- _Generated by [Claude Code](https://claude.ai/code)_
AsterionXeity commented 2026-11-25 03:03:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AsterionXeity on 2026-11-25T02:45:41Z.


Can confirm this works on my 4080S on windows 10

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151151598 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7151151598). Originally posted by [AsterionXeity](https://github.com/AsterionXeity) on 2026-11-25T02:45:41Z. --- Can confirm this works on my 4080S on windows 10
thegl0w commented 2026-11-25 04:07:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by thegl0w on 2026-11-25T03:39:55Z.


This comment was written by an AI assistant (Claude Code) from measurements on my machine; I reviewed it before posting.

A data point on the minimum Windows 10 version for the CreateDeviceFactory route.

  • Machine: Windows 10 IoT Enterprise LTSC 2021, build 19044.1288, the October 2021 release with no later cumulative updates. Inbox d3d12.dll and D3D12Core.dll are 10.0.19041.1266. AMD gfx1013, on a launch PS5 via ps5win.
  • The route fails here: D3D12GetInterface(CLSID_D3D12SDKConfiguration, ...) returns E_NOINTERFACE (0x80004002), so ID3D12SDKConfiguration1::CreateDeviceFactory is never reached.
    • I measured this with a small standalone probe that makes the same calls, not with this branch. The failure is in the first call, before anything branch-specific.
  • What works on the same machine: the exe-export route (D3D12SDKVersion 620 + D3D12SDKPath, as in #463). It loads Agility 1.620.2, and the device reports SM 6.6.
  • Fits with mauri9911's report above (19044 without KB5029331, where this route worked): the requirement seems to be a servicing level of the inbox runtime above 10.0.19041.1266, not 22H2 or that KB specifically. I can't name the exact build.
  • Suggestion: a log line when D3D12GetInterface fails, or keeping the export route as a fallback, would help machines this old.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7152128623 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7152128623). Originally posted by [thegl0w](https://github.com/thegl0w) on 2026-11-25T03:39:55Z. --- > *This comment was written by an AI assistant (Claude Code) from measurements on my machine; I reviewed it before posting.* **A data point on the minimum Windows 10 version for the `CreateDeviceFactory` route.** - **Machine:** Windows 10 IoT Enterprise LTSC 2021, build **19044.1288**, the October 2021 release with no later cumulative updates. Inbox `d3d12.dll` and `D3D12Core.dll` are **10.0.19041.1266**. AMD gfx1013, on a launch PS5 via [ps5win](https://github.com/thegl0w/ps5win). - **The route fails here:** `D3D12GetInterface(CLSID_D3D12SDKConfiguration, ...)` returns **E_NOINTERFACE (0x80004002)**, so `ID3D12SDKConfiguration1::CreateDeviceFactory` is never reached. - I measured this with a small standalone probe that makes the same calls, not with this branch. The failure is in the first call, before anything branch-specific. - **What works on the same machine:** the exe-export route (`D3D12SDKVersion` 620 + `D3D12SDKPath`, as in #463). It loads Agility 1.620.2, and the device reports SM 6.6. - **Fits with mauri9911's report above** (19044 without KB5029331, where this route worked): the requirement seems to be a servicing level of the inbox runtime above 10.0.19041.1266, not 22H2 or that KB specifically. I can't name the exact build. - **Suggestion:** a log line when `D3D12GetInterface` fails, or keeping the export route as a fallback, would help machines this old.
HAL9000RELOADED commented 2026-11-25 23:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by HAL9000RELOADED on 2026-11-25T22:53:17Z.


Windows 10 + AMD data point for bb176b6: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045.6456), Agility SDK 1.620.2 from NuGet, VICTORY_D3D12_AGILITY pointing at its folder. Merged on main 13f91ca.

  • victory-shader: 273 passed, 0 failed. The new creates_device_and_serializes_heap_indexed_root_signature_when_configured passes, so CreateDeviceFactory works on this Windows 10 build with a Radeon.
  • victory-gpu: 195 passed, 0 failed.
  • Same build without the variable: the in-box runtime stops at SM 6.5 and 80 victory-shader tests fail, as on main. So the opt-in leaves the default path unchanged.

No Developer Mode, no exports on the test executables.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176901935 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7176901935). Originally posted by [HAL9000RELOADED](https://github.com/HAL9000RELOADED) on 2026-11-25T22:53:17Z. --- Windows 10 + AMD data point for `bb176b6`: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045.6456), Agility SDK 1.620.2 from NuGet, `VICTORY_D3D12_AGILITY` pointing at its folder. Merged on main `13f91ca`. - `victory-shader`: 273 passed, 0 failed. The new `creates_device_and_serializes_heap_indexed_root_signature_when_configured` passes, so `CreateDeviceFactory` works on this Windows 10 build with a Radeon. - `victory-gpu`: 195 passed, 0 failed. - Same build without the variable: the in-box runtime stops at SM 6.5 and 80 `victory-shader` tests fail, as on main. So the opt-in leaves the default path unchanged. No Developer Mode, no exports on the test executables.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/969:upstream-pr/969'
git switch 'upstream-pr/969'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/969'
git switch 'upstream-pr/969'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/969'
git switch 'upstream-pr/969'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/969'
git switch 'main'
git merge --squash 'upstream-pr/969'
git switch 'main'
git merge --ff-only 'upstream-pr/969'
git switch 'main'
git merge 'upstream-pr/969'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!969
No description provided.