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

Open
github-bot wants to merge 14 commits from github-bot/gh-969 into main AGit
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-24 14:36 UTC · original
mgunes1311-lab:agility-device-factory → main · +569 −22 · 6 files · 14 commits · open

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

**@⁠mgunes1311-lab** on GitHub · 2026-11-24 14:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/969) `mgunes1311-lab:agility-device-factory` → `main` · +569 −22 · 6 files · 14 commits · open 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:15:18 +00:00
Author
Owner

@⁠EduBertozzi on GitHub · 2026-11-24 14:38 UTC · original

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

**@⁠EduBertozzi** on GitHub · 2026-11-24 14:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7134712938) 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).
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:13 UTC · original

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

**@⁠Zipettte** on GitHub · 2026-11-24 15:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7135654125) 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)._
Author
Owner

@⁠mauri9911 on GitHub · 2026-11-24 18:48 UTC · original

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

**@⁠mauri9911** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7141191027) 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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:30 UTC · original · edited 2026-11-25 22:16 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7148583710) · edited 2026-11-25 22:16 UTC <!-- 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)_
Author
Owner

@⁠AsterionXeity on GitHub · 2026-11-25 02:45 UTC · original

Can confirm this works on my 4080S on windows 10

**@⁠AsterionXeity** on GitHub · 2026-11-25 02:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7151151598) Can confirm this works on my 4080S on windows 10
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 22:53 UTC · original

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.

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 22:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/969#issuecomment-7176901935) 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 has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-shader/src/emit/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/969/head:github-bot/gh-969'
git switch 'github-bot/gh-969'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-969'
git switch 'github-bot/gh-969'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-969'
git switch 'github-bot/gh-969'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-969'
git switch 'main'
git merge --squash 'github-bot/gh-969'
git switch 'main'
git merge --ff-only 'github-bot/gh-969'
git switch 'main'
git merge 'github-bot/gh-969'
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!969
No description provided.