GPU: compile the indirect-argument clamp with DXC when D3DCompile refuses it (Wine/Proton) #178
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!178
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/178/head"
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?
@Ortomanic on GitHub · 2026-11-24 01:08 UTC · original
Ortomanic:pr/indirect-clamp-dxc→main· +158 −8 · 3 files · 3 commits · closed without mergingWhat
Under Wine/Proton,
D3DCompileis Wine'sd3dcompiler_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
D3DCompilefails, the same source is compiled with DXC (dxcompiler.dll, which shader validation already needs) ascs_6_0; the root signature stays inside the shader. Behaviour on Windows, whereD3DCompilesucceeds, is unchanged. Adds theWin32_Graphics_Direct3D_Dxcfeature towindows(no new crates;Cargo.lockunchanged).Testing
cargo checkforx86_64-pc-windows-msvc, with and withoutdiagnostics.@DaviTostes on GitHub · 2026-11-24 01:18 UTC · original
Tested
dd6f75aunder Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build withcargo xwin ... --target x86_64-pc-windows-msvc: the fallback works, and it fixes the clamp on the Wine path.d3dcompiler_47(which rejects the clamp withE5005) and nodxcompiler.dll:indirect::tests::argument_clamp_buildsstill fails, i.e. the fallback needs the DLL.dxcompiler.dllon the DLL search path (taken from an installed Chromium build):argument_clamp_buildspasses, and the suite is 41 passed, 2 failed, 1 ignored — the two failures are the environment-onlya_rejected_blob_gives_an_empty_library(vkd3d wants a non-empty blob) and #128. With Microsoft'sd3dcompilerinstead, the result is the same 41/2, so DXC and FXC both give a working clamp here.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.
@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_DIRwas unset.Environment
vkd3d-1.1-5153-g212991fc). It ran inside the steamrt4 container, launched the same wayumu-rundoes (_v2-entry-point --verb=waitforexitandrun -- proton waitforexitandrun), in a fresh prefix.cargo xwin(xwin CRT/SDK, clang-cl, lld-link), toolchain 1.98.1.dd6f75a(fetched frompull/178/head), compared againstmainatd2a4bae.Build
cargo xwin check -p victory-gpu --target x86_64-pc-windows-msvcpasses.cargo xwin check -p victory-gpu --features diagnostics --target x86_64-pc-windows-msvcpasses.cargo xwin test -p victory-gpu --target x86_64-pc-windows-msvc --no-runbuilds.Tests under Proton
The existing
indirect::tests::argument_clamp_buildsexercises 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.argument_clamp_buildsvictory-gpusuitemaindxcompiler.dllon the search pathdxcompiler.dll+dxil.dll(DXC v1.9.2609) next to the exeWhat the logs show:
main, the system compiler refuses the clamp withE5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. The log then saysno argument clamp: indirect execution dropped (0x80004005). That is the bug described in this PR, reproduced.trying DXC. The clamp is built: CreateRootSignature and the compute PSO succeed under vkd3d-proton.LoadLibraryWfails withModule not found (0x8007007E)and the run falls back to the old behaviour. That is not a regression, but stock Proton does not shipdxcompiler.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_libraryresource::tests::buffer_data_reaches_the_host_texture(fails itsrow 0assert)Non-blocking nit: when DXC's
GetStatusfails, 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.
@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 loadsdxil.dll(fromVICTORY_DXILor the Windows Kits folder,victory-shader/src/emit/validator.rs:121), so the comment atindirect.rs:153saying 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 withLOAD_LIBRARY_SEARCH_SYSTEM32(root.rs:64).Maybe look for
dxcompiler.dllbeside thedxil.dllthatValidator::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.
@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.dllis now loaded explicitly:VICTORY_DXC(the DLL or its folder), then beside thedxil.dllthatValidator::default_path()finds (the SDK ships them together), then only the executable's folder and System32 (LoadLibraryExWwithLOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | DEFAULT_DIRSfor paths,APPLICATION_DIR | SYSTEM32for the bare name). No more bareLoadLibraryW.dxcompiler.dll+dxil.dllfor indirect execution.Checked:
cargo checkfor x86_64-pc-windows-msvc with and withoutdiagnostics.@aycow on GitHub · 2026-11-24 07:33 UTC · original
I composed #40 at
22b9ed1with #178 atf435ad1. 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.exeoutput. 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@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,-xof f7411d0). It reuses VIctory's validator (VICTORY_DXIL, then thedxil.dllbeside 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 currentmain(ffe310e). Thanks also @deadkid14 for the RTX 5070 Ti run.@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.@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
d2a4baewith other open PRs (#177, #454, #189, #493, …), with DXC 1.9.2609'sdxcompiler.dllanddxil.dllin a folder named byVICTORY_DXC.The log shows Wine's
D3DCompilerefusing 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.
@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.
Pull request closed