Build: export D3D12SDKVersion and D3D12SDKPath from GNU targets #1903

Manually merged
github merged 1 commit from github-bot/gh-1903 into gh-pr/1903/base 2026-11-29 08:21:29 +00:00 AGit
Owner

@⁠wzl271 on GitHub · 2026-11-29 02:07 UTC · original
wzl271:gnu-d3d12-exports → main · +24 −6 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

Fixes #1899

What it changes

apps/victory/build.rs added /EXPORT:D3D12SDKVersion,DATA, /EXPORT:D3D12SDKPath,DATA, /DELAYLOAD:d3d12.dll and delayimp.lib only when CARGO_CFG_TARGET_ENV == "msvc". Those are MSVC linker switches; a GNU linker has neither, so an x86_64-pc-windows-gnu build shipped an empty export directory, Windows never read a version from the executable, and every start asked its own Direct3D 12 for shader model 6.6 — which Windows 10's stops at 6.5, so the title was refused before a frame was drawn:

Error: this PC's Direct3D 12 runs shader model 6.5, and the game needs 6.6: every shader would be
refused and the game would close at once. Microsoft's newer runtime is in place (D3D12 beside
victory.exe), so it is the graphics driver: update it, or use Windows 11

The MSVC arm is untouched. The other arm writes victory-exports.def into OUT_DIR and hands it to the linker as an input; exporting the two names also keeps them from --gc-sections. d3d12.dll stays a normal import there, so it is loaded before main and reads the 614 the static starts with — which is what the D3D12 folder beside the executable holds. Delay-loading it on GNU as well would be the better long-term shape if someone drops a different Agility version in place; not done here to keep this to the defect.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RX 7900 GRE 16 GB, Series X 2560x1440, DLSS off, frame generation off, no ray tracing; Windows 10 19045; Adrenalin 32.0.32029.2010; GTA6 930.048.020-vb_sub_story (Series X dump)

  • Build: rustc 1.100.1 stable-x86_64-pc-windows-gnu, MinGW-W64 gcc 16.2.0, cargo build --release --locked -p victory --target x86_64-pc-windows-gnu

  • Before: exits with the error above, no window, no log beyond the first line

  • After: objdump -p target/x86_64-pc-windows-gnu/release/victory.exe lists D3D12SDKPath and D3D12SDKVersion in the export table, and the run logs

    INFO victory_gpu::device: D3D12.X device version=0x20004
    INFO victory_gpu::host: host shader model model=6.8 runtime=Some("D:\GTA6\...\D3D12\D3D12Core.dll")
    INFO victory_gpu::host: host D3D12 device ready
    

    then loads and renders the intro (this build is main, which crashes later for an unrelated reason — see #1900, it is not this change)

  • For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a, build script only

  • cargo test passed for the crates it touches: yes — cargo test -p victory --locked --target x86_64-pc-windows-gnu → 29 passed, 2 passed, 0 failed. cargo clippy -p victory --all-targets --no-deps -- -D warnings reports no error from build.rs (the warnings it does print come from this machine's newer 1.100.1 than the pinned 1.98.1, and from other crates).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1899. The D3D12-runtime PRs (#1154, #210) change which d3d12.dll the game ends up with at run time, not the exports the build script asks the linker for; nothing else touches apps/victory/build.rs.
**@⁠wzl271** on GitHub · 2026-11-29 02:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1903) `wzl271:gnu-d3d12-exports` → `main` · +24 −6 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC Fixes #1899 ## What it changes `apps/victory/build.rs` added `/EXPORT:D3D12SDKVersion,DATA`, `/EXPORT:D3D12SDKPath,DATA`, `/DELAYLOAD:d3d12.dll` and `delayimp.lib` only when `CARGO_CFG_TARGET_ENV == "msvc"`. Those are MSVC linker switches; a GNU linker has neither, so an `x86_64-pc-windows-gnu` build shipped an **empty export directory**, Windows never read a version from the executable, and every start asked its own Direct3D 12 for shader model 6.6 — which Windows 10's stops at 6.5, so the title was refused before a frame was drawn: ``` Error: this PC's Direct3D 12 runs shader model 6.5, and the game needs 6.6: every shader would be refused and the game would close at once. Microsoft's newer runtime is in place (D3D12 beside victory.exe), so it is the graphics driver: update it, or use Windows 11 ``` The MSVC arm is untouched. The other arm writes `victory-exports.def` into `OUT_DIR` and hands it to the linker as an input; exporting the two names also keeps them from `--gc-sections`. `d3d12.dll` stays a normal import there, so it is loaded before `main` and reads the 614 the static starts with — which is what the `D3D12` folder beside the executable holds. Delay-loading it on GNU as well would be the better long-term shape if someone drops a different Agility version in place; not done here to keep this to the defect. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RX 7900 GRE 16 GB, Series X 2560x1440, DLSS off, frame generation off, no ray tracing; Windows 10 19045; Adrenalin 32.0.32029.2010; GTA6 930.048.020-vb_sub_story (Series X dump) - Build: rustc 1.100.1 `stable-x86_64-pc-windows-gnu`, MinGW-W64 gcc 16.2.0, `cargo build --release --locked -p victory --target x86_64-pc-windows-gnu` - Before: exits with the error above, no window, no log beyond the first line - After: `objdump -p target/x86_64-pc-windows-gnu/release/victory.exe` lists `D3D12SDKPath` and `D3D12SDKVersion` in the export table, and the run logs ``` INFO victory_gpu::device: D3D12.X device version=0x20004 INFO victory_gpu::host: host shader model model=6.8 runtime=Some("D:\GTA6\...\D3D12\D3D12Core.dll") INFO victory_gpu::host: host D3D12 device ready ``` then loads and renders the intro (this build is `main`, which crashes later for an unrelated reason — see #1900, it is not this change) - For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a, build script only - `cargo test` passed for the crates it touches: yes — `cargo test -p victory --locked --target x86_64-pc-windows-gnu` → 29 passed, 2 passed, 0 failed. `cargo clippy -p victory --all-targets --no-deps -- -D warnings` reports no error from `build.rs` (the warnings it does print come from this machine's newer 1.100.1 than the pinned 1.98.1, and from other crates). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1899. The D3D12-runtime PRs (#1154, #210) change which `d3d12.dll` the game ends up with at run time, not the exports the build script asks the linker for; nothing else touches `apps/victory/build.rs`.
Both are exported for MSVC only: `/EXPORT:` and `/DELAYLOAD:` are its
switches. A GNU linker has neither, so its executable's export directory
stays empty, Windows never reads a version, and every start asks its own
Direct3D 12 for shader model 6.6 — which Windows 10's stops at 6.5, and
the game is refused before a frame is drawn:

    Error: this PC's Direct3D 12 runs shader model 6.5, and the game needs 6.6

A module definition file gives GNU ld the same two exported names (DATA,
or the linker is free to find them unneeded and `--gc-sections` drops
them). `d3d12.dll` is imported the usual way there, so it loads before
`main` and reads the 614 the static starts with, which is the version the
`D3D12` folder beside the executable holds.

Tested with rustc 1.100.1 stable-x86_64-pc-windows-gnu and MinGW-W64 gcc
16.2.0 on Windows 10 19045: `objdump -p` lists both names after the
change, and `host shader model model=6.8 runtime=...\D3D12\D3D12Core.dll`
appears in the log where the title used to be refused.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 02:12:04 +00:00
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-29 02:17 UTC · original

For a regression check at 7ef182e, the GNU build could require both exact names in the export table of the linked PE. I tested this on Linux with one synthetic x64 COFF object defining both data symbols and GNU ld 2.44 (-mi386pep --gc-sections). Checking the named rows of objdump -p passed with both .def entries, reported both names missing without the .def, and identified exactly the missing name when either entry was omitted. The same four controls passed with LLD using MSVC-style /EXPORT:name,DATA switches. The check allows unrelated exports. It inspects names only; the PEs were never run, and Microsoft’s linker and the D3D12 runtime were outside this test.

**@⁠ANDREANIADS** on GitHub · 2026-11-29 02:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1903#issuecomment-7249338821) For a regression check at `7ef182e`, the GNU build could require both exact names in the export table of the linked PE. I tested this on Linux with one synthetic x64 COFF object defining both data symbols and GNU ld 2.44 (`-mi386pep --gc-sections`). Checking the named rows of `objdump -p` passed with both `.def` entries, reported both names missing without the `.def`, and identified exactly the missing name when either entry was omitted. The same four controls passed with LLD using MSVC-style `/EXPORT:name,DATA` switches. The check allows unrelated exports. It inspects names only; the PEs were never run, and Microsoft’s linker and the D3D12 runtime were outside this test.
github-bot changed title from [pr-fix] Build: export D3D12SDKVersion and D3D12SDKPath from GNU targets to Build: export D3D12SDKVersion and D3D12SDKPath from GNU targets 2026-11-29 02:28:40 +00:00
github-bot changed target branch from main to gh-pr/1903/base 2026-11-29 08:21:23 +00:00
github manually merged commit 7ef182e7dd into gh-pr/1903/base 2026-11-29 08:21:25 +00:00
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/trustno1-coder--VIctory-NVIDIA!1903
No description provided.