GPU: the executable exports the Agility runtime, so Windows 10 gets shader model 6.6 #165

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

@⁠Calvix2k on GitHub · 2026-11-26 08:49 UTC · original
Calvix2k:pr/windows10-agility → main · +47 −0 · 3 files · 1 commits · open

Windows 10 runs your build to the world only with these two exports, and right now the tree has none.

What happens without them

On Windows 10 22H2 (10.0.19045), RX 7800 XT 16 GB (RDNA3), driver 32.0.32029.2010, every launch dies about 300 ms in, at the same place:

frame presented ... frame=32 draws=48 drawn=0
first-chance exception 0xc0000005 at victory-image-<hash>.dll+0xb5a5f8
         (read 0x68: nothing mapped there)

Reproduced with VICTORY_RELAY=0 and 1, VICTORY_LATE_WAIT=0 and 1, and with --unimplemented trap as well as zero, so it is not a submission-wait or import-policy problem. Windows 10's in-box D3D12 stops at shader model 6.5 and refuses the root signatures that index the descriptor heaps directly, which every translated pipeline uses: the device the runtime gets is the older one and the title walks into a null interface.

I hit the identical crash, at the identical frame, on ZSlayer's runtime and on DexNom's fork of it — which is where I found it first. So it is not one fork's bug: any tree without the opt-in is unstartable on Windows 10, and only the Windows 11 machines in the README numbers would have hidden it.

The patch

Three files, no logic changes — the same mechanism upstream VIctory uses for its own executables:

  • apps/victory/src/agility.rs — the two #[unsafe(no_mangle)] statics, D3D12SDKVersion = 620 and D3D12SDKPath = ".\D3D12\".
  • apps/victory/build.rs — cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKVersion,DATA and the same for the path, gated on CARGO_CFG_TARGET_ENV = msvc (only the MSVC linker takes /EXPORT on a binary).
  • apps/victory/src/main.rs — mod agility; and one reference so the symbols stay in the binary.

Staging the runtime is the user's step: D3D12Core.dll 1.620.2 in D3D12/ beside the executable. Nothing is downloaded by the build. Without that folder the exports are compiled in but unused, and D3D12 keeps the in-box runtime, exactly as today — so a Windows 11 checkout or a newer system runtime is unchanged.

Verification

  • Windows 10, patch applied, runtime staged: the same launches now run for minutes — menus at 30 fps, into the world, no exception at 0xb5a5f8.
  • Windows 10, patch applied, nothing staged: unchanged, the old crash at frame 32.
  • Windows 10, patch absent: the crash above.
  • Rebased onto 722c0e1 and built with the pinned toolchain (profile diag, --features diagnostics).

Two measurements from the same machine (no code here, just numbers)

These cost nothing to try and may be worth a line in the README:

  1. 60 Hz is about twice as fast as 240 Hz on this title. Same scene, same build: 240 Hz → 300 ms/frame, 60 Hz → 166 ms/frame. The title couples its pacing to the display and throws away most 240 Hz opportunities; with AFMF the 30 fps base also cannot be filled evenly at 240 Hz, which reads as stutter and tearing. At 60 Hz the start screen is almost smooth.
  2. VICTORY_WIDE_REFRESH=1 and VICTORY_WIDE_MERGE=1 stabilise the copies: copies went from 37–229 ms (swinging) to a steady 26–32 ms for 159–189 MB, copy-back from 55–98 to 42–56 ms. Your launcher sets WIDE_BACK but neither of these.

Current state there: 4.3–6 fps in the prologue scenes (GPU ~100 ms, preparing ~60, copy-back ~50), with 4770X/7800 XT/Win10 and 32 GB RAM — 0 hard page faults, so it is not memory.

What I did not put in this PR

A window fix I run locally: fit() uses the work area (2488x1400 on a 1440p screen) and the title's window keeps its caption, so its 4K picture is scaled into a decorated window; making it the monitor's size and bare (WS_POPUP) maps it 1:1. Also GetModuleHandleW/A mapping title DLLs on demand, which is what finally loads the FidelityFX upscaler behind the FidelityFX loader (Series S still shows nothing, but the DLL loads now). Both change behaviour, so they belong in their own PR — say the word.

No game files, code or data from the title are in this branch. AI-assisted (DeepSeek V4.1), tested on the machine described above.

**@⁠Calvix2k** on GitHub · 2026-11-26 08:49 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/165) `Calvix2k:pr/windows10-agility` → `main` · +47 −0 · 3 files · 1 commits · open Windows 10 runs your build to the world only with these two exports, and right now the tree has none. ## What happens without them On Windows 10 22H2 (10.0.19045), RX 7800 XT 16 GB (RDNA3), driver 32.0.32029.2010, every launch dies about 300 ms in, at the same place: ``` frame presented ... frame=32 draws=48 drawn=0 first-chance exception 0xc0000005 at victory-image-<hash>.dll+0xb5a5f8 (read 0x68: nothing mapped there) ``` Reproduced with `VICTORY_RELAY=0` and `1`, `VICTORY_LATE_WAIT=0` and `1`, and with `--unimplemented trap` as well as `zero`, so it is not a submission-wait or import-policy problem. Windows 10's in-box D3D12 stops at shader model 6.5 and refuses the root signatures that index the descriptor heaps directly, which every translated pipeline uses: the device the runtime gets is the older one and the title walks into a null interface. I hit the identical crash, at the identical frame, on ZSlayer's runtime and on DexNom's fork of it — which is where I found it first. So it is not one fork's bug: **any tree without the opt-in is unstartable on Windows 10**, and only the Windows 11 machines in the README numbers would have hidden it. ## The patch Three files, no logic changes — the same mechanism upstream VIctory uses for its own executables: - `apps/victory/src/agility.rs` — the two `#[unsafe(no_mangle)]` statics, `D3D12SDKVersion = 620` and `D3D12SDKPath = ".\D3D12\"`. - `apps/victory/build.rs` — `cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKVersion,DATA` and the same for the path, gated on `CARGO_CFG_TARGET_ENV = msvc` (only the MSVC linker takes `/EXPORT` on a binary). - `apps/victory/src/main.rs` — `mod agility;` and one reference so the symbols stay in the binary. Staging the runtime is the user's step: `D3D12Core.dll` 1.620.2 in `D3D12/` beside the executable. Nothing is downloaded by the build. **Without that folder the exports are compiled in but unused**, and D3D12 keeps the in-box runtime, exactly as today — so a Windows 11 checkout or a newer system runtime is unchanged. ## Verification - **Windows 10, patch applied, runtime staged:** the same launches now run for minutes — menus at 30 fps, into the world, no exception at `0xb5a5f8`. - **Windows 10, patch applied, nothing staged:** unchanged, the old crash at frame 32. - **Windows 10, patch absent:** the crash above. - Rebased onto `722c0e1` and built with the pinned toolchain (`profile diag`, `--features diagnostics`). ## Two measurements from the same machine (no code here, just numbers) These cost nothing to try and may be worth a line in the README: 1. **60 Hz is about twice as fast as 240 Hz on this title.** Same scene, same build: 240 Hz → 300 ms/frame, 60 Hz → **166 ms/frame**. The title couples its pacing to the display and throws away most 240 Hz opportunities; with AFMF the 30 fps base also cannot be filled evenly at 240 Hz, which reads as stutter and tearing. At 60 Hz the start screen is almost smooth. 2. **`VICTORY_WIDE_REFRESH=1` and `VICTORY_WIDE_MERGE=1` stabilise the copies**: copies went from 37–229 ms (swinging) to a steady 26–32 ms for 159–189 MB, copy-back from 55–98 to 42–56 ms. Your launcher sets `WIDE_BACK` but neither of these. Current state there: 4.3–6 fps in the prologue scenes (GPU ~100 ms, preparing ~60, copy-back ~50), with 4770X/7800 XT/Win10 and 32 GB RAM — 0 hard page faults, so it is not memory. ## What I did not put in this PR A window fix I run locally: `fit()` uses the work area (2488x1400 on a 1440p screen) and the title's window keeps its caption, so its 4K picture is scaled into a decorated window; making it the monitor's size and bare (`WS_POPUP`) maps it 1:1. Also `GetModuleHandleW/A` mapping title DLLs on demand, which is what finally loads the FidelityFX upscaler behind the FidelityFX loader (Series S still shows nothing, but the DLL loads now). Both change behaviour, so they belong in their own PR — say the word. No game files, code or data from the title are in this branch. AI-assisted (DeepSeek V4.1), tested on the machine described above.
Windows 10's in-box D3D12 stops at 6.5 and refuses the root signatures every translated pipeline uses. Without these two exports the title walks into a null interface at frame 32 of the boot:

  first-chance exception 0xc0000005 at victory-image+0xb5a5f8 (read 0x68)

Reproduced on Windows 10 22H2 with an RX 7800 XT, with VICTORY_RELAY 0 and 1,
VICTORY_LATE_WAIT 0 and 1, and --unimplemented trap and zero - so not a
submission-wait or import-policy problem. The identical crash at the identical
frame happens on ZSlayer's runtime and on DexNom's fork of it, which is where I
saw it first; any tree without the opt-in is affected.

With D3D12Core.dll 1.620.2 staged in D3D12/ beside the executable, the same
launches reach the menus and the world instead. The exports are only emitted
when the runtime is there: a checkout without it stays on the in-box runtime,
exactly as before, so Windows 11 is unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:53:22 +00:00
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-26 16:32 UTC · original

A second Windows 10 + RDNA3 machine for c0c19d2: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, i7-13700KF, Windows 10 22H2 (19045), Agility SDK 1.620.2 in target\diag\D3D12\. Merged on main 9576c45, later on a9400a6.

  • With this PR and the folder: the device is made and the title runs to the world in every session (25-35 minutes each, no device removed). At 4K output, Series X, scripts\play.ps1 set plus renderer patches 1, 2, 5 and 6: about 24.7 fps (40.6 ms at ~4,800 draws), card ~95% busy. Series S: about 26.8 fps.
  • Without the folder, victory translate --pipelines on an empty folder stops with D3D12_ERROR_INVALID_REDIST: the exports are always there. Main without this PR stops at SM 6.5 with or without the folder.

Belobug/VIctory-Belobug-AMD#44 hit the same and now exports only when the runtime is staged at build time. Another option is to write the system runtime's own version into the export at start when the folder is missing (fxceless/victory-fork#856, LeonardoS11's follow-up); on this Windows 10 that version is 2 and the device then comes up on the in-box runtime.

AI-assisted (Claude Code): tests run on my machine, text drafted with Claude.

**@⁠HAL9000RELOADED** on GitHub · 2026-11-26 16:32 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/165#issuecomment-7197775461) A second Windows 10 + RDNA3 machine for `c0c19d2`: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, i7-13700KF, Windows 10 22H2 (19045), Agility SDK 1.620.2 in `target\diag\D3D12\`. Merged on main `9576c45`, later on `a9400a6`. - With this PR and the folder: the device is made and the title runs to the world in every session (25-35 minutes each, no device removed). At 4K output, Series X, `scripts\play.ps1` set plus renderer patches 1, 2, 5 and 6: about 24.7 fps (40.6 ms at ~4,800 draws), card ~95% busy. Series S: about 26.8 fps. - Without the folder, `victory translate --pipelines` on an empty folder stops with `D3D12_ERROR_INVALID_REDIST`: the exports are always there. Main without this PR stops at SM 6.5 with or without the folder. Belobug/VIctory-Belobug-AMD#44 hit the same and now exports only when the runtime is staged at build time. Another option is to write the system runtime's own version into the export at start when the folder is missing (fxceless/victory-fork#856, LeonardoS11's follow-up); on this Windows 10 that version is 2 and the device then comes up on the in-box runtime. _AI-assisted (Claude Code): tests run on my machine, text drafted with Claude._
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-26 18:49 UTC · original

Thanks for the second machine - that is exactly the confirmation this needed.

Same picture here, on a third configuration: Windows 10 22H2 (19045), RX 7800 XT (RDNA3), Agility 1.620.2 in D3D12\ beside the executable. With the PR the device is made and the title reaches the world in every session; without the folder the runtime stops earlier, as you describe.

One data point you may find useful for the MR itself: on current main (c9c932c) plus this change, with renderer ports 1, 2, 5, 6 and 7 on and a 0.75 render scale (1440p output), the prologue went from 253 ms a frame on the old tree to 167 ms at ~6,800 draws (about 6 fps), GPU 95 ms, copies 14 ms / 84 MB, copy-back 25 ms / 39 MB. At 4K output without the ports it is 213-238 ms at ~4,300-5,200 draws. So the merge you describe is not just correctness on Windows 10 - it is the difference between the title being measurable and not.

Noted on Belobug #44 and fxeless #856 as alternatives; the export-only-when-staged form is what the other trees seem to converge on, so a follow-up that writes the in-box version when the folder is absent sounds right to me.

**@⁠Calvix2k** on GitHub · 2026-11-26 18:49 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/165#issuecomment-7200898159) Thanks for the second machine - that is exactly the confirmation this needed. Same picture here, on a third configuration: Windows 10 22H2 (19045), RX 7800 XT (RDNA3), Agility 1.620.2 in `D3D12\` beside the executable. With the PR the device is made and the title reaches the world in every session; without the folder the runtime stops earlier, as you describe. One data point you may find useful for the MR itself: on current main (`c9c932c`) plus this change, with renderer ports 1, 2, 5, 6 and 7 on and a 0.75 render scale (1440p output), the prologue went from 253 ms a frame on the old tree to 167 ms at ~6,800 draws (about 6 fps), GPU 95 ms, copies 14 ms / 84 MB, copy-back 25 ms / 39 MB. At 4K output without the ports it is 213-238 ms at ~4,300-5,200 draws. So the merge you describe is not just correctness on Windows 10 - it is the difference between the title being measurable and not. Noted on Belobug #44 and fxeless #856 as alternatives; the export-only-when-staged form is what the other trees seem to converge on, so a follow-up that writes the in-box version when the folder is absent sounds right to me.
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-26 19:24 UTC · original

Follow-up to my run above, with a fix for the missing-folder case: branch avatar-agility-tests on our fork, two commits on top of main c9c932c + this PR (5c1cdef, b7f7460).

  • victory.exe exports D3D12SDKVersion/D3D12SDKPath only when target\<profile>\D3D12\D3D12Core.dll was there at build time. Without the folder the in-box runtime is used instead of D3D12_ERROR_INVALID_REDIST; with it, the behaviour of this PR.
  • The unit-test executables of victory-shader and victory-gpu get the same exports, through a test-only .drectve directive, when the runtime is staged. Integration tests in tests/ still link.

Same design as Belobug/VIctory-Belobug-AMD#44 and fxceless/victory-fork#402. On Windows 10 + RX 7900 XTX with the runtime staged, all 1022 tests of cargo test --workspace -- --skip census pass (census starts victory.exe) (the SM 6.5 failures of the shader and GPU tests are gone); without it the results are those of main + this PR. The two commits keep their authorship and GPL notes, so they can be cherry-picked onto this PR as they are.

AI-assisted (Claude Code): tests run on my machine, text drafted with Claude.

**@⁠HAL9000RELOADED** on GitHub · 2026-11-26 19:24 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/165#issuecomment-7201556313) Follow-up to my run above, with a fix for the missing-folder case: branch [`avatar-agility-tests`](https://github.com/HAL9000RELOADED/victory-fork/tree/avatar-agility-tests) on our fork, two commits on top of main `c9c932c` + this PR (`5c1cdef`, `b7f7460`). - `victory.exe` exports `D3D12SDKVersion`/`D3D12SDKPath` only when `target\<profile>\D3D12\D3D12Core.dll` was there at build time. Without the folder the in-box runtime is used instead of `D3D12_ERROR_INVALID_REDIST`; with it, the behaviour of this PR. - The unit-test executables of `victory-shader` and `victory-gpu` get the same exports, through a test-only `.drectve` directive, when the runtime is staged. Integration tests in `tests/` still link. Same design as Belobug/VIctory-Belobug-AMD#44 and fxceless/victory-fork#402. On Windows 10 + RX 7900 XTX with the runtime staged, all 1022 tests of `cargo test --workspace -- --skip census` pass (census starts victory.exe) (the SM 6.5 failures of the shader and GPU tests are gone); without it the results are those of main + this PR. The two commits keep their authorship and GPL notes, so they can be cherry-picked onto this PR as they are. _AI-assisted (Claude Code): tests run on my machine, text drafted with Claude._
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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