victory: opt into a staged D3D12 Agility SDK runtime #3667
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3667"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-28T04:47:25Z.
Summary
Windows 10's inbox D3D12 runtime stops at shader model 6.5. The shaders victory translates target 6.6 and index descriptor heaps directly, so their root signatures carry
D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED(flags0xc00,0xc01with input assembly) — seecrates/victory-shader/src/emit/host.rs:321. The inbox runtime refuses every one of them withE_INVALIDARG, and the title crashes early in boot. This is #753.This PR opts the executable into the D3D12 Agility SDK when — and only when — a runtime is staged next to the build output:
apps/victory/build.rs(new): whentarget/<profile>/D3D12/D3D12Core.dllexists, parses that DLL's PE export table for its realD3D12SDKVersionand emits the MSVC/EXPORTlink arguments. The version is never hard-coded, so the export cannot silently disagree with the staged runtime (the loader refuses a mismatch outright). The exports are scoped withrustc-link-arg-bin=victoryand carry the,DATAsuffix, so integration-test binaries still link. The watched input is theD3D12directory rather than the DLL, so copying a runtime in or out reconfigures the build even when the DLL keeps an older timestamp. Without the file the build behaves exactly as before: no exports, no opt-in, system runtime.apps/victory/src/main.rs: theD3D12SDKVersion/D3D12SDKPathexported statics (compiled only when the build script opted in), a startup check that names the missing file instead of failing later with what reads as a GPU problem, and the probe wiring.apps/victory/src/agility_probe.rs(new): hiddenvictory agility-probecommand that serializes0xc00/0xc01root signatures through the same title-facingvictory_gpu::root::serialize_versionedpath the game uses, then creates the hardware SM 6.6 devicevictory-shader's host builds — verifies a staged runtime without any title data.Supersedes the approach of #463 (credit to @Shaun-Fong for getting there first), addressing its review feedback: the integration-test link failure (@walterwallaceson:
rustc-link-argexported from every binary — here scoped tobin=victory), the missing,DATAsuffix, the stale incremental build after copying an older-timestamped DLL (@andrewpozdnakov7-jpg — here the directory is the watched input), the silent opt-in failure (@reboot0000-cmd — here a build-timecargo:warningeither way plus a run-time check), and the hard-coded version 614 (here parsed from the staged DLL itself). It is also based on currentmain.Closes #753.
Evidence
victory agility-probeon Windows 10 22H2, GTX 1050, Agility SDK 1.616 staged intarget/debug/D3D12:exit code 0. On the same host without the runtime, the inbox runtime rejects flags
0x400/0x800/0xc00/0xc01withE_INVALIDARG— matching #753's report exactly.Boot evidence, GTA VI: boot previously crashed at frame 1024 —
victory-image+0xb5a5f8, a null effect-variant dereference downstream of 21,507 failed root-signature serializations. With this change and the runtime staged, boot passes frames 1024 / 2048 / 4096 / 5980 with drawn == frame count at every checkpoint, zero exceptions, zero serialization failures.Runtime layout
The runtime cannot be redistributed in this repository, so users supply it themselves: download the Microsoft.Direct3D.D3D12 NuGet package and copy
build/native/bin/x64/D3D12Core.dll(optionallyd3d12SDKLayers.dll) into:i.e.
target/release/D3D12/D3D12Core.dllnext tovictory.exe, then rebuild — the build script picks the directory up on its own. Any Agility SDK version works; the exportedD3D12SDKVersionis read from whatever DLL is staged. Removing the directory and rebuilding returns to the inbox runtime.Test plan
cargo check -p victorywithout a staged runtime — negative path compiles, no opt-in, build unchangedcargo build -p victorywith the runtime staged — build script announcesopting the host D3D12 runtime into Agility SDK 616victory.exe agility-probeexits 0 with all four steps successful (output above)cargo test -p victory --no-runlinks with the runtime staged — integration tests build with noLNK2001(the failure mode reported on #463)cargo test -p victory --bin victory— 14/14 passcargo clippy -p victory --all-targets --locked -- -D warningsclean, with and without--all-featuresImported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T05:40:59Z.
I built the exact
02d9d92executable on Windows 10 22H2, build 19045, and ran its ownagility-probe. This used the same Cargo target for all three builds.E_INVALIDARGfor0xc00and0xc01S_OKfor bothE_INVALIDARGfor bothThe staged DLL's last-write time predated the baseline binary. Adding and removing it changed the build's exports. The probe's physical-device step was unavailable on the GeForce GTX 750 Ti in all three runs, so the staged probe still exited 1. This verifies the Windows 10 serialization path. A run with a supported hardware adapter is the next hardware check.
This probe also inherits
VICTORY_WARP=1through the shared device helper. 14f8acd makes its output adapter-neutral and documents that input. I built the follow-up and checked the updated label with the system runtime. kotekompotek can pick up the diagnostic wording if desired.Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.