GPU: load optional D3D12 Agility SDK at runtime for Windows 10 SM 6.6 #12

Open
github-bot wants to merge 1 commit from github-bot/gh-12 into main AGit
Owner

@⁠molodayamama on GitHub · 2026-11-25 17:53 UTC · original
molodayamama:gpu/agility-sdk-runtime → main · +722 −30 · 8 files · 1 commits · open

Summary

Adds optional runtime loading of the Microsoft DirectX 12 Agility SDK (D3D12Core.dll) through ID3D12SDKConfiguration1::CreateDeviceFactory, enabling Shader Model 6.6 and directly indexed descriptor heaps on Windows 10 (build 19041+) without embedding D3D12SDKVersion/D3D12SDKPath exports or shipping any binary files in the repository.

When no Agility SDK is configured or present beside the executable, behavior is unchanged and the system d3d12.dll is used as before.

Changes

  • crates/victory-shader/src/emit/agility.rs (classified in OUTSIDE_TRANSLATION in lib.rs so cached shader translations are not invalidated):
    • Discovers D3D12Core.dll from VICTORY_D3D12_AGILITY (direct DLL path, containing folder, D3D12\ subfolder, or unpacked Microsoft.Direct3D.D3D12 NuGet root) or from D3D12\D3D12Core.dll beside the executable.
    • Reads the exported D3D12SDKVersion u32 directly from the PE/PE32+ export table without loading or executing the DLL.
    • Formats the SDK directory relative to the executable directory for ID3D12SDKConfiguration1::CreateDeviceFactory and creates a process-wide ID3D12DeviceFactory (D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE, ApplyToGlobalState, and GetConfigurationInterface for Debug Layer / DRED).
    • Adds serialize_versioned_root_signature, routing serialization through ID3D12DeviceConfiguration::SerializeVersionedRootSignature when supported by the device so SM 6.6 CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED root signatures succeed on Windows 10.
    • Adds unit and live opt-in tests for PE export parsing, core discovery layouts, relative path formatting, and SM 6.6 device + heap-indexed root signature creation.
  • crates/victory-shader/src/emit/host.rs: Uses agility::load() and agility::serialize_versioned_root_signature when creating shader test devices and root signatures.
  • crates/victory-gpu/Cargo.toml, src/host.rs, src/pipeline/host.rs: Enables victory-shader/host on Windows (no new crates, Cargo.lock unchanged), uses the Agility SDK factory for device/debug/DRED creation with a clean fallback to system d3d12.dll if unavailable, and serializes root signatures via serialize_versioned_root_signature.
  • README.md: Documents the opt-in Windows 10 Agility SDK setup (D3D12\D3D12Core.dll or VICTORY_D3D12_AGILITY).

Testing

Tested on Windows 10 22H2 (build 19045.5794, in-box d3d12.dll capped at SM 6.5) with an NVIDIA GeForce RTX 4060 and Microsoft DirectX 12 Agility SDK 1.614.1 (D3D12SDKVersion = 614, placed outside the repository):

  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)
  • cargo test --locked -p xtask: 4 passed, 0 failed (repository_passes_policy passed)
  • cargo test --locked -p victory-shader --lib emit::agility (without VICTORY_D3D12_AGILITY and with VICTORY_D3D12_AGILITY): 4 passed, 0 failed in both modes
  • cargo test --locked -p victory-gpu --lib with VICTORY_D3D12_AGILITY: 188 passed, 0 failed (previously failed pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws with E_INVALIDARG on in-box D3D12SerializeVersionedRootSignature)
  • cargo test --locked -p victory-shader --lib with VICTORY_D3D12_AGILITY: all 24 previously failing SM 6.6 hardware GPU tests (32/64-bit BVH intersection, VALU, waterfall, wave64-on-wave32) passed on hardware (3 unrelated failures remain on this box: 2 pre-existing dxil.dll PSV0 rejections from Windows SDK 10.0.22621.0, and 1 WARP-only test because Windows 10's in-box WARP stays at SM 6.2).
  • git diff --check: clean. In-game gameplay was not tested (no local game files on this machine).
**@⁠molodayamama** on GitHub · 2026-11-25 17:53 UTC · [original](https://github.com/DexNom/VIctory/pull/12) `molodayamama:gpu/agility-sdk-runtime` → `main` · +722 −30 · 8 files · 1 commits · open ## Summary Adds optional runtime loading of the Microsoft DirectX 12 Agility SDK (`D3D12Core.dll`) through `ID3D12SDKConfiguration1::CreateDeviceFactory`, enabling Shader Model 6.6 and directly indexed descriptor heaps on Windows 10 (build 19041+) without embedding `D3D12SDKVersion`/`D3D12SDKPath` exports or shipping any binary files in the repository. When no Agility SDK is configured or present beside the executable, behavior is unchanged and the system `d3d12.dll` is used as before. ## Changes - **`crates/victory-shader/src/emit/agility.rs`** (classified in `OUTSIDE_TRANSLATION` in `lib.rs` so cached shader translations are not invalidated): - Discovers `D3D12Core.dll` from `VICTORY_D3D12_AGILITY` (direct DLL path, containing folder, `D3D12\` subfolder, or unpacked `Microsoft.Direct3D.D3D12` NuGet root) or from `D3D12\D3D12Core.dll` beside the executable. - Reads the exported `D3D12SDKVersion` `u32` directly from the PE/PE32+ export table without loading or executing the DLL. - Formats the SDK directory relative to the executable directory for `ID3D12SDKConfiguration1::CreateDeviceFactory` and creates a process-wide `ID3D12DeviceFactory` (`D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE`, `ApplyToGlobalState`, and `GetConfigurationInterface` for Debug Layer / DRED). - Adds `serialize_versioned_root_signature`, routing serialization through `ID3D12DeviceConfiguration::SerializeVersionedRootSignature` when supported by the device so SM 6.6 `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED` root signatures succeed on Windows 10. - Adds unit and live opt-in tests for PE export parsing, core discovery layouts, relative path formatting, and SM 6.6 device + heap-indexed root signature creation. - **`crates/victory-shader/src/emit/host.rs`**: Uses `agility::load()` and `agility::serialize_versioned_root_signature` when creating shader test devices and root signatures. - **`crates/victory-gpu/Cargo.toml`, `src/host.rs`, `src/pipeline/host.rs`**: Enables `victory-shader/host` on Windows (no new crates, `Cargo.lock` unchanged), uses the Agility SDK factory for device/debug/DRED creation with a clean fallback to system `d3d12.dll` if unavailable, and serializes root signatures via `serialize_versioned_root_signature`. - **`README.md`**: Documents the opt-in Windows 10 Agility SDK setup (`D3D12\D3D12Core.dll` or `VICTORY_D3D12_AGILITY`). ## Testing Tested on Windows 10 22H2 (build 19045.5794, in-box `d3d12.dll` capped at SM 6.5) with an NVIDIA GeForce RTX 4060 and Microsoft DirectX 12 Agility SDK `1.614.1` (`D3D12SDKVersion = 614`, placed outside the repository): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed (0 warnings) - `cargo test --locked -p xtask`: **4 passed, 0 failed** (`repository_passes_policy` passed) - `cargo test --locked -p victory-shader --lib emit::agility` (without `VICTORY_D3D12_AGILITY` and with `VICTORY_D3D12_AGILITY`): **4 passed, 0 failed** in both modes - `cargo test --locked -p victory-gpu --lib` with `VICTORY_D3D12_AGILITY`: **188 passed, 0 failed** (previously failed `pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws` with `E_INVALIDARG` on in-box `D3D12SerializeVersionedRootSignature`) - `cargo test --locked -p victory-shader --lib` with `VICTORY_D3D12_AGILITY`: all 24 previously failing SM 6.6 hardware GPU tests (32/64-bit BVH intersection, VALU, waterfall, wave64-on-wave32) passed on hardware (3 unrelated failures remain on this box: 2 pre-existing `dxil.dll` PSV0 rejections from Windows SDK `10.0.22621.0`, and 1 WARP-only test because Windows 10's in-box WARP stays at SM 6.2). - `git diff --check`: clean. In-game gameplay was not tested (no local game files on this machine).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:42 +00:00
Author
Owner

@⁠Artking175 on GitHub · 2026-11-25 18:48 UTC · original

Independently verified exact head 999fd75 on Windows 10 22H2 (19045), RTX 2060 (NVIDIA 531.41), and Rust 1.98.1 MSVC. I used the Microsoft Agility SDK 1.614.1 through VICTORY_D3D12_AGILITY in a separate checkout with no executable exports or system changes.

  • cargo test --locked -p victory-shader --lib emit::agility -- --nocapture --test-threads=1 passed all four tests both with the setting unset and with it set. With the SDK set, the live test confirmed SM 6.6 and heap-indexed root signature creation.
  • The exact same depth_bounds_pipeline_loads_and_filters_draws test executable reproduced 0x80070057 with the setting unset, then passed with Agility configured.
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 with Agility configured gave 188 passed, zero failed, and three ignored.

I did not run the game on this head.

**@⁠Artking175** on GitHub · 2026-11-25 18:48 UTC · [original](https://github.com/DexNom/VIctory/pull/12#issuecomment-7171434172) Independently verified exact head `999fd75` on Windows 10 22H2 (19045), RTX 2060 (NVIDIA 531.41), and Rust 1.98.1 MSVC. I used the Microsoft Agility SDK 1.614.1 through `VICTORY_D3D12_AGILITY` in a separate checkout with no executable exports or system changes. - `cargo test --locked -p victory-shader --lib emit::agility -- --nocapture --test-threads=1` passed all four tests both with the setting unset and with it set. With the SDK set, the live test confirmed SM 6.6 and heap-indexed root signature creation. - The exact same `depth_bounds_pipeline_loads_and_filters_draws` test executable reproduced `0x80070057` with the setting unset, then passed with Agility configured. - `cargo test --locked -p victory-gpu --lib -- --test-threads=1` with Agility configured gave 188 passed, zero failed, and three ignored. I did not run the game on this head.
Author
Owner

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

First Windows 10 + Radeon run of 999fd75: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045.6456), Agility SDK 1.620.2 through VICTORY_D3D12_AGILITY. Base: main 2e01ab4.

  • victory-gpu: 188 passed, 0 failed. depth_bounds_pipeline_loads_and_filters_draws passes too.
  • victory-shader: 240 passed, 1 failed. On main without the PR, 26 shader tests fail here (SM 6.5). The new emit::agility tests pass.
  • The one left is warp_ray_probe_distinguishes_active_visits_and_finite_triangle_candidates: "WARP is required to validate the probe: the device supports SM 0x62 only". It fails on main too. Its WARP device stays on SM 6.2 with the factory. On this machine the system WARP does reach SM 6.6 when the executable exports D3D12SDKVersion (another fork's #44), so maybe that test makes its WARP device outside the factory. I haven't checked.
**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 22:53 UTC · [original](https://github.com/DexNom/VIctory/pull/12#issuecomment-7176903158) First Windows 10 + Radeon run of `999fd75`: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045.6456), Agility SDK 1.620.2 through `VICTORY_D3D12_AGILITY`. Base: main `2e01ab4`. - `victory-gpu`: 188 passed, 0 failed. `depth_bounds_pipeline_loads_and_filters_draws` passes too. - `victory-shader`: 240 passed, 1 failed. On main without the PR, 26 shader tests fail here (SM 6.5). The new `emit::agility` tests pass. - The one left is `warp_ray_probe_distinguishes_active_visits_and_finite_triangle_candidates`: "WARP is required to validate the probe: the device supports SM 0x62 only". It fails on main too. Its WARP device stays on SM 6.2 with the factory. On this machine the system WARP does reach SM 6.6 when the executable exports `D3D12SDKVersion` (another fork's #44), so maybe that test makes its WARP device outside the factory. I haven't checked.
This pull request has changes conflicting with the target branch.
  • README.md
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/12/head:github-bot/gh-12'
git switch 'github-bot/gh-12'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-12'
git switch 'github-bot/gh-12'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-12'
git switch 'github-bot/gh-12'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-12'
git switch 'main'
git merge --squash 'github-bot/gh-12'
git switch 'main'
git merge --ff-only 'github-bot/gh-12'
git switch 'main'
git merge 'github-bot/gh-12'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.