GPU: helper shaders compiled at run time fall back to DXC (Wine's compiler refuses many and drops [RootSignature]) #925

Manually merged
github merged 3 commits from github-bot/gh-925 into main 2026-11-29 00:27:53 +00:00 AGit
Owner

@⁠kc01-8 on GitHub · 2026-11-28 09:10 UTC · original
kc01-8:pr/dxc-helpers → main · +381 −119 · 6 files · 3 commits · merged 2026-11-29 00:24 UTC

Summary

  • Every helper shader victory compiles at run time now falls back to DXC when the system's compiler refuses it. That covers the indirect-argument clamp, the card compare, the ambient light's stand-in, the depth planes' pass, the scatter, the upload check, the tiles' look, keeping the card awake, and the composer.
  • Why this matters under Wine/Proton. The system's d3dcompiler_47 refuses many of these helpers. Worse, it accepts [RootSignature(...)] but leaves it out of the code. vkd3d-proton then finds no RTS0 part and fails CreateRootSignature with E_FAIL, and the helper quietly turns itself off. Such code now counts as refused, so DXC compiles it.
  • On Windows nothing changes. The system's compiler takes every helper as before, and DXC is never loaded.

How

  • crates/victory-gpu/src/hlsl.rs (new): compile_for(name, source, entry, target).
    • It tries the system's D3DCompile first, then DXC at the 6.0 model of the same stage (cs_5_1 becomes cs_6_0, and so on).
    • DXC is dxcompiler.dll, looked for in this order: VICTORY_DXC (the DLL or its folder), then the executable's folder, then System32.
    • A system result is refused when its source declares a root signature for that entry and its container has no RTS0 part.
  • The callers. host::compile, the card compare, the composer and the indirect clamp go through it. The depth planes' vertex shader follows its pixel shader to DXC, so a pipeline's two stages are of one kind.
  • Build. The Win32_Graphics_Direct3D_Dxc feature of windows.

Testing

  • Build: victory.exe cross-builds (x86_64-pc-windows-gnullvm, release) on this branch, which is 63b902fe plus these commits.
  • Unit tests: hlsl::tests (3) pass under Proton Experimental's Wine with DXC.
  • In play: under Proton Experimental with vkd3d-proton master, RTX 3080 Ti, NVIDIA 620.73.04, every helper named above is made.
    • Before, the depth planes' pass and keeping the card awake failed with E_FAIL.
    • The scatter, the upload check and the tiles' look were off without a word.
  • Not tested: Windows, with this exact branch.

Where this comes from

This is part of kc01-8/VIctoryNVIDIALINUX (branch kc/foxhound). It is this tree running on an NVIDIA GeForce card under Linux and Proton. So far, on an RTX 3080 Ti:

  • Memory: 12–14 GB that cannot be reclaimed, for a whole run. Title memory is read in place instead of copied, because NVIDIA's Linux driver pins every page of a buffer it is given.
  • Shaders: 2,533 of the 2,534 shaders the title asked for in a run translate (99.96 %), and all 2,185 host pipelines were made.
  • Frame rate: 8–14 fps at 1,400–3,700 draws a frame under Proton.

Its README has the progress by run, what works and what doesn't, and a ranked list of next steps for people and agents taking it further.

Credits

  • The DXC fallback for helper shaders began in JMAN730/victory dffc5924 ("Optionally cross-compile the built-in GPU helper shaders with host DXC", Codex).
  • Extended here to every helper, and to Wine's dropped root signatures.

🤖 Generated with Claude Code

**@⁠kc01-8** on GitHub · 2026-11-28 09:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/925) `kc01-8:pr/dxc-helpers` → `main` · +381 −119 · 6 files · 3 commits · merged 2026-11-29 00:24 UTC ## Summary - **Every helper shader victory compiles at run time now falls back to DXC when the system's compiler refuses it.** That covers the indirect-argument clamp, the card compare, the ambient light's stand-in, the depth planes' pass, the scatter, the upload check, the tiles' look, keeping the card awake, and the composer. - **Why this matters under Wine/Proton.** The system's `d3dcompiler_47` refuses many of these helpers. Worse, it accepts `[RootSignature(...)]` but leaves it out of the code. vkd3d-proton then finds no `RTS0` part and fails `CreateRootSignature` with `E_FAIL`, and the helper quietly turns itself off. Such code now counts as refused, so DXC compiles it. - **On Windows nothing changes.** The system's compiler takes every helper as before, and DXC is never loaded. ## How - **`crates/victory-gpu/src/hlsl.rs` (new): `compile_for(name, source, entry, target)`.** - It tries the system's `D3DCompile` first, then DXC at the 6.0 model of the same stage (`cs_5_1` becomes `cs_6_0`, and so on). - DXC is `dxcompiler.dll`, looked for in this order: `VICTORY_DXC` (the DLL or its folder), then the executable's folder, then System32. - A system result is refused when its source declares a root signature for that entry and its container has no `RTS0` part. - **The callers.** `host::compile`, the card compare, the composer and the indirect clamp go through it. The depth planes' vertex shader follows its pixel shader to DXC, so a pipeline's two stages are of one kind. - **Build.** The `Win32_Graphics_Direct3D_Dxc` feature of `windows`. ## Testing - **Build:** `victory.exe` cross-builds (x86_64-pc-windows-gnullvm, release) on this branch, which is `63b902fe` plus these commits. - **Unit tests:** `hlsl::tests` (3) pass under Proton Experimental's Wine with DXC. - **In play:** under Proton Experimental with vkd3d-proton master, RTX 3080 Ti, NVIDIA 620.73.04, every helper named above is made. - Before, the depth planes' pass and keeping the card awake failed with `E_FAIL`. - The scatter, the upload check and the tiles' look were off without a word. - **Not tested:** Windows, with this exact branch. ## Where this comes from This is part of **[kc01-8/VIctoryNVIDIALINUX](https://github.com/kc01-8/VIctoryNVIDIALINUX)** (branch `kc/foxhound`). It is this tree running on an NVIDIA GeForce card under **Linux and Proton**. So far, on an RTX 3080 Ti: - **Memory:** 12–14 GB that cannot be reclaimed, for a whole run. Title memory is read in place instead of copied, because NVIDIA's Linux driver pins every page of a buffer it is given. - **Shaders:** 2,533 of the 2,534 shaders the title asked for in a run translate (99.96 %), and all 2,185 host pipelines were made. - **Frame rate:** 8–14 fps at 1,400–3,700 draws a frame under Proton. Its README has the progress by run, what works and what doesn't, and a ranked list of next steps for people and agents taking it further. ## Credits - The DXC fallback for helper shaders began in [JMAN730/victory](https://github.com/JMAN730/victory) `dffc5924` ("Optionally cross-compile the built-in GPU helper shaders with host DXC", Codex). - Extended here to every helper, and to Wine's dropped root signatures. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Under Wine, the builtin d3dcompiler_47 refuses the clamp's raw buffer
loads, and with no clamp every indirect draw and dispatch is dropped.
crate::hlsl (from kc/nvidia, after JMAN730/victory dffc5924 by Codex)
compiles a compute shader with the system's D3DCompile and falls back to
DXC (VICTORY_DXC); on Windows the system's compiler takes it as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 9d4ffd7efc5b197c5a18842822d01caeac6f4486)
Under Proton run 35 lost, to Wine's builtin d3dcompiler_47 refusing them,
the ambient light's stand-in for the title's ray tracing ("no stand-in for
the indirect light"), the card compare ("no host copies in the card's
memory"), keeping the card awake, and the depth planes' passes. They all
compile through crate::host::compile or beside it. crate::hlsl::compile_for
compiles any entry point for a _5_1 target with the system's compiler,
then with DXC at the 6.0 model of the same stage; host::compile, the card
compare and the composer use it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b97ad9950e8b8d400629f45c814c557bd75fd878)
Wine's builtin HLSL compiler accepts [RootSignature(...)] and leaves it
out of the code, and vkd3d-proton then finds no RTS0 part and fails
CreateRootSignature with E_FAIL. Every helper that reads its root
signature out of its code was off under Wine for that: the depth planes'
pass, keeping the card awake, the scatter, the upload check and the
tiles' look (the last three failed silently). Such code is now refused,
so DXC compiles it; the depth planes' vertex shader follows its pixel
shader to DXC, so the pipeline's stages are of one kind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 0b13dc8e3ba07ba3953f2ce99a35b366f9b5a79c)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:30:21 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 09:18 UTC · original · approved these changes

Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge; cargo xtask policy passed (295 files ok).
  • Tests (RTX 5090):
    • cargo test -p victory-gpu --lib hlsl passed (3 passed; 0 failed: a_root_signature_is_declared_for_its_function, compiled_code_holds_its_root_signature, raw_buffer_shader_compiles_with_a_fallback).
    • cargo test -p victory-gpu --lib ambient:: passed (5 passed; 0 failed).
    • cargo test -p victory-gpu --lib host::card_steps:: passed (9 passed; 0 failed; 1 ignored).
  • Compiled with 0 warnings.

Clean DXC fallback and root-signature preservation for runtime-compiled helper shaders. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 09:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/925#pullrequestreview-6096936194) · **approved these changes** Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge; `cargo xtask policy` passed (`295 files ok`). - **Tests (RTX 5090)**: - `cargo test -p victory-gpu --lib hlsl` passed (`3 passed; 0 failed`: `a_root_signature_is_declared_for_its_function`, `compiled_code_holds_its_root_signature`, `raw_buffer_shader_compiles_with_a_fallback`). - `cargo test -p victory-gpu --lib ambient::` passed (`5 passed; 0 failed`). - `cargo test -p victory-gpu --lib host::card_steps::` passed (`9 passed; 0 failed; 1 ignored`). - Compiled with 0 warnings. Clean DXC fallback and root-signature preservation for runtime-compiled helper shaders. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-28 09:32 UTC · original

This overlaps a compiler defect we independently isolated on RTX 4060/16 GB under GE-Proton11-14: the system-only host::compile returned a scatter shader whose root-signature creation failed with E_FAIL, so the ordinary submission-owned upload path never ran. Routing that one pass to the existing DXC fallback restored actual upload work (#628 measurements). Thank you for addressing the wider class of helper shaders here; credits to kc01-8 and JMAN730/victory dffc5924 as noted in the PR.

Independent numerical validation of your exact head 8fb73e2d50899c8f467ce1c3c966b707b71e979f: I added a test-only fixture invoking the actual host/send.rs::pass() constructor, then dispatched that unchanged scatter shader into an owned 256-byte device-local buffer. The buffer was initialized from 64 distinct CPU words, and the input pairs at byte offset 16 requested three aligned in-bounds updates at word indices 3, 29 and 61. Fenced whole-output readback matched the independent CPU expectation for all 64 words, including every untouched word. No game files mounted, no hardware skip. Windows MSVC release cross-build, verified physical RTX 4060, NVIDIA 620.73.04, GE11-14/vkd3d-proton 3.2.0, DXC 1.9.2609.

scatter readback: 64/64 words correct, 3 changed and 61 untouched
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 492 filtered out; finished in 0.89s

Actual game: exact PR with only the already-tested Linux file-backing adaptation (and the above cfg(test) fixture, absent from the release), Series X 1080to1440, DLSS/FG off, cloned profile/fresh external caches, full write-back, ordinary waits and effects intact. No private compiler adapter or compact bucket experiment layered onto this PR. Four DXC successes (two generic host helper root-signature omissions, the card compare's Load4 refusal, and the clamp's InterlockedOr refusal), zero DXC failures. Submission-own send summaries: 26/49 nonzero, maximum reported 21.8 MB/frame; the prior system-only scatter configuration reported zero throughout. This confirms broader fallback compilation and real restored upload activity; the generic log label does not identify every helper, so I cannot claim local coverage of all named passes.

The launch still reaches loading artwork and a black overlay, then actual exit 5 after 127.9 s, minimum available host RAM 1914 MiB. Our previous scatter-only fallback run with standard allocation buckets was 133.7 s / 2312 MiB / exit 5. No guard stop, OOM increment, recorded GPU fault or reported device/fence failure. Not an in-world FPS or visual-quality comparison; no title check or watchdog changes. No game files, dumps or extracted data attached.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).

**@⁠ArturoWolff** on GitHub · 2026-11-28 09:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/925#issuecomment-7237303697) This overlaps a compiler defect we independently isolated on RTX 4060/16 GB under GE-Proton11-14: the system-only `host::compile` returned a scatter shader whose root-signature creation failed with E_FAIL, so the ordinary submission-owned upload path never ran. Routing that one pass to the existing DXC fallback restored actual upload work ([#628 measurements](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/628)). Thank you for addressing the wider class of helper shaders here; credits to kc01-8 and JMAN730/victory `dffc5924` as noted in the PR. **Independent numerical validation of your exact head `8fb73e2d50899c8f467ce1c3c966b707b71e979f`:** I added a test-only fixture invoking the actual `host/send.rs::pass()` constructor, then dispatched that unchanged scatter shader into an owned 256-byte device-local buffer. The buffer was initialized from 64 distinct CPU words, and the input pairs at byte offset 16 requested three aligned in-bounds updates at word indices 3, 29 and 61. Fenced whole-output readback matched the independent CPU expectation for all 64 words, including every untouched word. No game files mounted, no hardware skip. Windows MSVC release cross-build, verified physical RTX 4060, NVIDIA 620.73.04, GE11-14/vkd3d-proton 3.2.0, DXC 1.9.2609. ```text scatter readback: 64/64 words correct, 3 changed and 61 untouched test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 492 filtered out; finished in 0.89s ``` **Actual game:** exact PR with only the already-tested Linux file-backing adaptation (and the above `cfg(test)` fixture, absent from the release), Series X 1080to1440, DLSS/FG off, cloned profile/fresh external caches, full write-back, ordinary waits and effects intact. No private compiler adapter or compact bucket experiment layered onto this PR. Four DXC successes (two generic host helper root-signature omissions, the card compare's Load4 refusal, and the clamp's InterlockedOr refusal), zero DXC failures. Submission-own send summaries: 26/49 nonzero, maximum reported 21.8 MB/frame; the prior system-only scatter configuration reported zero throughout. This confirms broader fallback compilation and real restored upload activity; the generic log label does not identify every helper, so I cannot claim local coverage of all named passes. The launch still reaches loading artwork and a black overlay, then actual exit 5 after 127.9 s, minimum available host RAM 1914 MiB. Our previous scatter-only fallback run with standard allocation buckets was 133.7 s / 2312 MiB / exit 5. No guard stop, OOM increment, recorded GPU fault or reported device/fence failure. Not an in-world FPS or visual-quality comparison; no title check or watchdog changes. No game files, dumps or extracted data attached. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Author
Owner

@⁠Aniseto on GitHub · 2026-11-28 09:38 UTC · original

Ran the HLSL fallback tests at 8fb73e2 on Windows with an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.

cargo test -p victory-gpu --lib hlsl::tests -- --test-threads=1
3 passed; 0 failed; 0 ignored; 0 measured; 489 filtered out      (exit 0)

All three tests pass. The PR description says the hlsl::tests were run under Wine/Proton and that Windows with this exact branch was not tested; this run fills that gap. On Windows the system compiler takes every helper, so the DXC fallback path itself is not exercised here. The thread has an RTX 4060/Proton report but no 5070 Ti or Windows run.

Not tested: the Wine/Proton fallback path, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-28 09:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/925#issuecomment-7237372642) Ran the HLSL fallback tests at `8fb73e2` on Windows with an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build. ``` cargo test -p victory-gpu --lib hlsl::tests -- --test-threads=1 3 passed; 0 failed; 0 ignored; 0 measured; 489 filtered out (exit 0) ``` All three tests pass. The PR description says the `hlsl::tests` were run under Wine/Proton and that Windows with this exact branch was **not** tested; this run fills that gap. On Windows the system compiler takes every helper, so the DXC fallback path itself is not exercised here. The thread has an RTX 4060/Proton report but no 5070 Ti or Windows run. Not tested: the Wine/Proton fallback path, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
github-bot referenced this pull request from a commit 2026-11-29 00:27:22 +00:00
github manually merged commit 77dfc7a82f into main 2026-11-29 00:27:53 +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!925
No description provided.