GPU: compile the indirect-argument clamp with DXC when D3DCompile refuses it (Wine/Proton) #178

Closed
github-bot wants to merge 3 commits from gh-pr/178/head into gh-pr/178/base
Owner

@⁠Ortomanic on GitHub · 2026-11-24 01:08 UTC · original
Ortomanic:pr/indirect-clamp-dxc → main · +158 −8 · 3 files · 3 commits · closed without merging

What

Under Wine/Proton, D3DCompile is Wine's d3dcompiler_47 (vkd3d-shader HLSL), which rejects the argument clamp:
clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.
clamp() then fails and every indirect execution is dropped on Linux.

Change

If D3DCompile fails, the same source is compiled with DXC (dxcompiler.dll, which shader validation already needs) as cs_6_0; the root signature stays inside the shader. Behaviour on Windows, where D3DCompile succeeds, is unchanged. Adds the Win32_Graphics_Direct3D_Dxc feature to windows (no new crates; Cargo.lock unchanged).

Testing

  • cargo check for x86_64-pc-windows-msvc, with and without diagnostics.
  • GTA VI under Wine 11.22 + vkd3d-proton (RTX 5080): the log shows the D3DCompile refusal followed by the DXC path, and indirect executions now run instead of all being dropped.
**@⁠Ortomanic** on GitHub · 2026-11-24 01:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/178) `Ortomanic:pr/indirect-clamp-dxc` → `main` · +158 −8 · 3 files · 3 commits · closed without merging ## What Under Wine/Proton, `D3DCompile` is Wine's `d3dcompiler_47` (vkd3d-shader HLSL), which rejects the argument clamp: `clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.` `clamp()` then fails and **every** indirect execution is dropped on Linux. ## Change If `D3DCompile` fails, the same source is compiled with DXC (`dxcompiler.dll`, which shader validation already needs) as `cs_6_0`; the root signature stays inside the shader. Behaviour on Windows, where `D3DCompile` succeeds, is unchanged. Adds the `Win32_Graphics_Direct3D_Dxc` feature to `windows` (no new crates; `Cargo.lock` unchanged). ## Testing - `cargo check` for `x86_64-pc-windows-msvc`, with and without `diagnostics`. - GTA VI under Wine 11.22 + vkd3d-proton (RTX 5080): the log shows the D3DCompile refusal followed by the DXC path, and indirect executions now run instead of all being dropped.
Wine's d3dcompiler_47 (vkd3d-shader HLSL) rejects RWByteAddressBuffer.Load
(E5005), so under Wine every indirect execution was dropped. The same source
now goes to dxcompiler.dll (cs_6_0, root signature inside) instead.
Review on #178: load DXC from VICTORY_DXC, beside the dxil.dll that shader
validation finds, then only the executable's folder and System32 (no bare
LoadLibraryW search path). When DXC refuses the clamp, its error text is
logged. README notes the Wine/Proton requirement.
The Windows SDK 26100 DXC DLL can compile a valid shader without finding its sibling signing library. Native D3D12 then rejects the unsigned shader. Sign only zero-digest output with the existing DXIL validator, resolving a sibling from the loaded compiler path.

(cherry picked from commit f7411d0129f1631a717dd50ab659e173072e8671)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:31 +00:00
github-bot closed this pull request 2026-11-26 03:53:31 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:18 UTC · original

Tested dd6f75a under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with cargo xwin ... --target x86_64-pc-windows-msvc: the fallback works, and it fixes the clamp on the Wine path.

  • With Wine's builtin d3dcompiler_47 (which rejects the clamp with E5005) and no dxcompiler.dll: indirect::tests::argument_clamp_builds still fails, i.e. the fallback needs the DLL.
  • With dxcompiler.dll on the DLL search path (taken from an installed Chromium build): argument_clamp_builds passes, and the suite is 41 passed, 2 failed, 1 ignored — the two failures are the environment-only a_rejected_blob_gives_an_empty_library (vkd3d wants a non-empty blob) and #128. With Microsoft's d3dcompiler instead, the result is the same 41/2, so DXC and FXC both give a working clamp here.
  • Deployment note: Wine does not ship dxcompiler.dll; anyone running this path needs to provide it (DXC redistributable or a game's copy) for indirect execution to work. Worth a line in the README next to the Wine notes.

With the 12 indirect tests from #40 merged on top this would exercise the whole path; on its own branch those tests are not present yet.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7118976388) Tested `dd6f75a` under **Wine 11.22 + vkd3d-proton 3.1** on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with `cargo xwin ... --target x86_64-pc-windows-msvc`: **the fallback works**, and it fixes the clamp on the Wine path. - With Wine's builtin `d3dcompiler_47` (which rejects the clamp with `E5005`) and **no** `dxcompiler.dll`: `indirect::tests::argument_clamp_builds` still fails, i.e. the fallback needs the DLL. - With `dxcompiler.dll` on the DLL search path (taken from an installed Chromium build): `argument_clamp_builds` **passes**, and the suite is **41 passed, 2 failed, 1 ignored** — the two failures are the environment-only `a_rejected_blob_gives_an_empty_library` (vkd3d wants a non-empty blob) and #128. With Microsoft's `d3dcompiler` instead, the result is the same 41/2, so DXC and FXC both give a working clamp here. - Deployment note: Wine does not ship `dxcompiler.dll`; anyone running this path needs to provide it (DXC redistributable or a game's copy) for indirect execution to work. Worth a line in the README next to the Wine notes. With the 12 indirect tests from #40 merged on top this would exercise the whole path; on its own branch those tests are not present yet. No game data used.
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:28 UTC · original

Tested this independently on Linux under UMU-Proton. I used only crate tests: no game data, no title run, and VICTORY_GAME_DIR was unset.

Environment

  • Host: Arch-based Linux, kernel 7.2.15. GPU: RTX 2060 SUPER on NVIDIA 615.78.08.
  • Proton: UMU-Proton-11.0-2e (wine-11.0) with its bundled vkd3d-proton (vkd3d-1.1-5153-g212991fc). It ran inside the steamrt4 container, launched the same way umu-run does (_v2-entry-point --verb=waitforexitandrun -- proton waitforexitandrun), in a fresh prefix.
  • Build: cross-built from Linux with cargo xwin (xwin CRT/SDK, clang-cl, lld-link), toolchain 1.98.1.
  • Head tested: dd6f75a (fetched from pull/178/head), compared against main at d2a4bae.

Build

  • cargo xwin check -p victory-gpu --target x86_64-pc-windows-msvc passes.
  • cargo xwin check -p victory-gpu --features diagnostics --target x86_64-pc-windows-msvc passes.
  • cargo xwin test -p victory-gpu --target x86_64-pc-windows-msvc --no-run builds.

Tests under Proton
The existing indirect::tests::argument_clamp_builds exercises the changed path end to end: vkd3d-proton gives a real host device, so the test does not skip. For these runs I added a local tracing subscriber to the test so the log lines show up; that change was never committed.

Build argument_clamp_builds Full victory-gpu suite
main FAIL 40 pass / 3 fail / 1 ignored
PR, no dxcompiler.dll on the search path FAIL (same as main) 40 / 3 / 1
PR, dxcompiler.dll + dxil.dll (DXC v1.9.2609) next to the exe PASS 41 / 2 / 1

What the logs show:

  • On main, the system compiler refuses the clamp with E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. The log then says no argument clamp: indirect execution dropped (0x80004005). That is the bug described in this PR, reproduced.
  • On the PR with DXC present, the log shows the same refusal and then trying DXC. The clamp is built: CreateRootSignature and the compute PSO succeed under vkd3d-proton.
  • On the PR without DXC, LoadLibraryW fails with Module not found (0x8007007E) and the run falls back to the old behaviour. That is not a regression, but stock Proton does not ship dxcompiler.dll. On Linux the fix only takes effect if VIctory's existing shader-translation requirement already puts DXC on the search path.

The two remaining failures fail the same way on main, so they are already there and unrelated to this PR:

  • pipeline::library::tests::a_rejected_blob_gives_an_empty_library
  • resource::tests::buffer_data_reaches_the_host_texture (fails its row 0 assert)

Non-blocking nit: when DXC's GetStatus fails, the DXC error text (DXC_OUT_ERRORS) isn't logged. That would help if the shader ever stops compiling under DXC.

Recommendation: merge, from a Linux/Proton point of view. The fallback does what it says, nothing changes on the path where D3DCompile succeeds, and no tests regressed.

**@⁠SkippySteve** on GitHub · 2026-11-24 01:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7119136240) Tested this independently on Linux under UMU-Proton. I used only crate tests: no game data, no title run, and `VICTORY_GAME_DIR` was unset. **Environment** - Host: Arch-based Linux, kernel 7.2.15. GPU: RTX 2060 SUPER on NVIDIA 615.78.08. - Proton: UMU-Proton-11.0-2e (wine-11.0) with its bundled vkd3d-proton (`vkd3d-1.1-5153-g212991fc`). It ran inside the steamrt4 container, launched the same way `umu-run` does (`_v2-entry-point --verb=waitforexitandrun -- proton waitforexitandrun`), in a fresh prefix. - Build: cross-built from Linux with `cargo xwin` (xwin CRT/SDK, clang-cl, lld-link), toolchain 1.98.1. - Head tested: `dd6f75a` (fetched from `pull/178/head`), compared against `main` at `d2a4bae`. **Build** - `cargo xwin check -p victory-gpu --target x86_64-pc-windows-msvc` passes. - `cargo xwin check -p victory-gpu --features diagnostics --target x86_64-pc-windows-msvc` passes. - `cargo xwin test -p victory-gpu --target x86_64-pc-windows-msvc --no-run` builds. **Tests under Proton** The existing `indirect::tests::argument_clamp_builds` exercises the changed path end to end: vkd3d-proton gives a real host device, so the test does not skip. For these runs I added a local tracing subscriber to the test so the log lines show up; that change was never committed. | Build | `argument_clamp_builds` | Full `victory-gpu` suite | |---|---|---| | `main` | FAIL | 40 pass / 3 fail / 1 ignored | | PR, no `dxcompiler.dll` on the search path | FAIL (same as main) | 40 / 3 / 1 | | PR, `dxcompiler.dll` + `dxil.dll` (DXC v1.9.2609) next to the exe | **PASS** | **41 / 2 / 1** | What the logs show: - On `main`, the system compiler refuses the clamp with `E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'`. The log then says `no argument clamp: indirect execution dropped (0x80004005)`. That is the bug described in this PR, reproduced. - On the PR with DXC present, the log shows the same refusal and then `trying DXC`. The clamp is built: CreateRootSignature and the compute PSO succeed under vkd3d-proton. - On the PR without DXC, `LoadLibraryW` fails with `Module not found (0x8007007E)` and the run falls back to the old behaviour. That is not a regression, but stock Proton does not ship `dxcompiler.dll`. On Linux the fix only takes effect if VIctory's existing shader-translation requirement already puts DXC on the search path. The two remaining failures fail the same way on `main`, so they are already there and unrelated to this PR: - `pipeline::library::tests::a_rejected_blob_gives_an_empty_library` - `resource::tests::buffer_data_reaches_the_host_texture` (fails its `row 0` assert) **Non-blocking nit:** when DXC's `GetStatus` fails, the DXC error text (`DXC_OUT_ERRORS`) isn't logged. That would help if the shader ever stops compiling under DXC. **Recommendation:** merge, from a Linux/Proton point of view. The fallback does what it says, nothing changes on the path where D3DCompile succeeds, and no tests regressed.
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 01:29 UTC · original

The fallback idea makes sense for Wine, but nothing in VIctory ships or locates dxcompiler.dll. Translation only loads dxil.dll (from VICTORY_DXIL or the Windows Kits folder, victory-shader/src/emit/validator.rs:121), so the comment at indirect.rs:153 saying shader translation "already needs" it isn't accurate. As written, LoadLibraryW(w!("dxcompiler.dll")) (crates/victory-gpu/src/indirect.rs:85) only works if the user has put the DLL on the search path. It also loads by bare name, while the rest of the crate restricts system DLLs with LOAD_LIBRARY_SEARCH_SYSTEM32 (root.rs:64).

Maybe look for dxcompiler.dll beside the dxil.dll that Validator::default_path() finds (the SDK ships them together), with an env override, and note the requirement in the Proton docs (#149)?

Static review, not built or run.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7119152513) The fallback idea makes sense for Wine, but nothing in VIctory ships or locates `dxcompiler.dll`. Translation only loads `dxil.dll` (from `VICTORY_DXIL` or the Windows Kits folder, `victory-shader/src/emit/validator.rs:121`), so the comment at `indirect.rs:153` saying shader translation "already needs" it isn't accurate. As written, `LoadLibraryW(w!("dxcompiler.dll"))` (`crates/victory-gpu/src/indirect.rs:85`) only works if the user has put the DLL on the search path. It also loads by bare name, while the rest of the crate restricts system DLLs with `LOAD_LIBRARY_SEARCH_SYSTEM32` (`root.rs:64`). Maybe look for `dxcompiler.dll` beside the `dxil.dll` that `Validator::default_path()` finds (the SDK ships them together), with an env override, and note the requirement in the Proton docs (#149)? Static review, not built or run.
Author
Owner

@⁠Ortomanic on GitHub · 2026-11-24 02:08 UTC · original

Thanks for testing (RADV, UMU-Proton/RTX 2060 SUPER) and for the review. Pushed f435ad1, which addresses it:

  • dxcompiler.dll is now loaded explicitly: VICTORY_DXC (the DLL or its folder), then beside the dxil.dll that Validator::default_path() finds (the SDK ships them together), then only the executable's folder and System32 (LoadLibraryExW with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | DEFAULT_DIRS for paths, APPLICATION_DIR | SYSTEM32 for the bare name). No more bare LoadLibraryW.
  • When DXC refuses the source, its error buffer is logged (@⁠SkippySteve's nit).
  • The misleading comment is fixed, and the README notes that Wine/Proton users need dxcompiler.dll + dxil.dll for indirect execution.

Checked: cargo check for x86_64-pc-windows-msvc with and without diagnostics.

**@⁠Ortomanic** on GitHub · 2026-11-24 02:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7119789949) Thanks for testing (RADV, UMU-Proton/RTX 2060 SUPER) and for the review. Pushed f435ad1, which addresses it: - `dxcompiler.dll` is now loaded explicitly: `VICTORY_DXC` (the DLL or its folder), then beside the `dxil.dll` that `Validator::default_path()` finds (the SDK ships them together), then only the executable's folder and System32 (`LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | DEFAULT_DIRS` for paths, `APPLICATION_DIR | SYSTEM32` for the bare name). No more bare `LoadLibraryW`. - When DXC refuses the source, its error buffer is logged (@⁠SkippySteve's nit). - The misleading comment is fixed, and the README notes that Wine/Proton users need `dxcompiler.dll` + `dxil.dll` for indirect execution. Checked: `cargo check` for x86_64-pc-windows-msvc with and without `diagnostics`.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 07:33 UTC · original

I composed #40 at 22b9ed1 with #178 at f435ad1. The in-process x64 Windows SDK DXC 1.7.2308.16 successfully compiled the clamp and reported that its DXIL signing library was unavailable. The resulting container had a zero digest, and native D3D12 rejected its pipeline as unsigned.

The focused change uses VIctory's existing DXIL validator with the selected compiler's companion library to validate and sign an unsigned fallback blob. The resulting digest matched the same SDK's dxc.exe output. With the change, all 14 indirect cases passed on both AMD and WARP in enhanced and forced legacy modes, with native FXC and with the DXC path forced. Full GPU-based validation was enabled. The isolated fix cherry-picks cleanly onto your exact #178 head. Signer fix · Composition and reproduction

**@⁠aycow** on GitHub · 2026-11-24 07:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7125117323) I composed #40 at `22b9ed1` with #178 at `f435ad1`. The in-process x64 Windows SDK DXC 1.7.2308.16 successfully compiled the clamp and reported that its DXIL signing library was unavailable. The resulting container had a zero digest, and native D3D12 rejected its pipeline as unsigned. The focused change uses VIctory's existing DXIL validator with the selected compiler's companion library to validate and sign an unsigned fallback blob. The resulting digest matched the same SDK's `dxc.exe` output. With the change, all 14 indirect cases passed on both AMD and WARP in enhanced and forced legacy modes, with native FXC and with the DXC path forced. Full GPU-based validation was enabled. The isolated fix cherry-picks cleanly onto your exact #178 head. [Signer fix](https://github.com/aycow/VIctory/commit/f7411d0129f1631a717dd50ab659e173072e8671) · [Composition and reproduction](https://github.com/aycow/VIctory/tree/test/indirect-dxc-178)
Author
Owner

@⁠Ortomanic on GitHub · 2026-11-24 11:06 UTC · original

Thanks @⁠aycow, good catch on the unsigned container from older SDK DXC. Cherry-picked your signer fix onto this PR with attribution (eb635f7, -x of f7411d0). It reuses VIctory's validator (VICTORY_DXIL, then the dxil.dll beside the compiler, then the Windows Kits one) to sign the blob only when the digest is zero. Windows type-check passes; the branch still merges cleanly with current main (ffe310e). Thanks also @⁠deadkid14 for the RTX 5070 Ti run.

**@⁠Ortomanic** on GitHub · 2026-11-24 11:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7129656872) Thanks @⁠aycow, good catch on the unsigned container from older SDK DXC. Cherry-picked your signer fix onto this PR with attribution (`eb635f7`, `-x` of f7411d0). It reuses VIctory's validator (`VICTORY_DXIL`, then the `dxil.dll` beside the compiler, then the Windows Kits one) to sign the blob only when the digest is zero. Windows type-check passes; the branch still merges cleanly with current `main` (ffe310e). Thanks also @⁠deadkid14 for the RTX 5070 Ti run.
Author
Owner

@⁠Ortomanic on GitHub · 2026-11-24 17:05 UTC · original

Heads-up for reviewers: #994 (4828716, @⁠Slaktarn700) solves the same problem differently. It writes the clamp with structured buffers, so Wine's d3dcompiler_47 accepts it and no DXC is needed. I ported it to our Linux/NVIDIA branch and it works there; its 2 GPU tests pass under Wine + vkd3d-proton. If #994 (or that commit on its own) lands, this PR is unnecessary, and I'll close it.

**@⁠Ortomanic** on GitHub · 2026-11-24 17:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7138658565) Heads-up for reviewers: #994 (4828716, @⁠Slaktarn700) solves the same problem differently. It writes the clamp with structured buffers, so Wine's d3dcompiler_47 accepts it and no DXC is needed. I ported it to our Linux/NVIDIA branch and it works there; its 2 GPU tests pass under Wine + vkd3d-proton. If #994 (or that commit on its own) lands, this PR is unnecessary, and I'll close it.
Author
Owner

@⁠deadkid14 on GitHub · 2026-11-24 07:18 UTC · original · edited 2026-11-24 17:51 UTC

Tested on Linux: RTX 5070 Ti, driver 620.73.04, GE-Proton11-14's vkd3d-proton. #178 was merged into a diag build of d2a4bae with other open PRs (#177, #454, #189, #493, …), with DXC 1.9.2609's dxcompiler.dll and dxil.dll in a folder named by VICTORY_DXC.

The log shows Wine's D3DCompile refusing the clamp (E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer') and then the DXC path building it. No "DXC failed too".

In one traced world frame, dropped operations went from 4,273 (every indirect execution, "not bounded") to 2,836, and the G-buffer's writers that run went from 211 to 1,043. Details in #71.

AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.

**@⁠deadkid14** on GitHub · 2026-11-24 07:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7124848136) · edited 2026-11-24 17:51 UTC Tested on Linux: RTX 5070 Ti, driver 620.73.04, GE-Proton11-14's vkd3d-proton. #178 was merged into a diag build of d2a4bae with other open PRs (#177, #454, #189, #493, …), with DXC 1.9.2609's `dxcompiler.dll` and `dxil.dll` in a folder named by `VICTORY_DXC`. The log shows Wine's `D3DCompile` refusing the clamp (`E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'`) and then the DXC path building it. No "DXC failed too". In one traced world frame, dropped operations went from 4,273 (every indirect execution, "not bounded") to 2,836, and the G-buffer's writers that run went from 211 to 1,043. Details in #71. *AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:00 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1279. Wine-only: when D3DCompile refuses the indirect-argument clamp it loads dxcompiler.dll (from VICTORY_DXC, beside dxil.dll, the exe folder or System32) and adds a windows-crate feature. #1279 solves the same problem by writing the clamp in HLSL both compilers take, with no external DLL and no Cargo change.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/178#issuecomment-7148033682) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1279. Wine-only: when D3DCompile refuses the indirect-argument clamp it loads dxcompiler.dll (from VICTORY_DXC, beside dxil.dll, the exe folder or System32) and adds a windows-crate feature. #1279 solves the same problem by writing the clamp in HLSL both compilers take, with no external DLL and no Cargo change. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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/Marvisak--VIctory!178
No description provided.