Skip to content

GPU: build our own HLSL with DXC when Wine's compiler refuses it - #21

Closed
oeirughrepuiohg wants to merge 1 commit into
fxceless:mainfrom
oeirughrepuiohg:gpu-dxc-fallback
Closed

oeirughrepuiohg wants to merge 1 commit into
fxceless:mainfrom
oeirughrepuiohg:gpu-dxc-fallback

Conversation

@oeirughrepuiohg

Copy link
Copy Markdown

Under Wine/Proton, D3DCompile is Wine's d3dcompiler_47 (vkd3d-shader), which has no RWByteAddressBuffer methods. The indirect-argument clamp then fails to build:

argument clamp: clamp:67:10: E5005: Method 'InterlockedMax' is not defined on type 'RWByteAddressBuffer'

and every indirect draw and dispatch is dropped, so the world stays black on Linux. Two testers on VIctory #844 (an RTX 5070 Ti and my RTX 4070 Ti) needed a DXC fallback to get this fork's lit first scene under Proton.

What is in it (one commit, on 7b0f736, +195/−22)

  • crates/victory-gpu/src/dxc.rs (new): load dxcompiler.dll (VICTORY_DXC, beside dxil.dll, else the exe's folder / System32), compile the same HLSL as SM 6.0, sign with dxil.dll when the digest is zero. Adapted from Marvisak/VIctory PR #178 by Ortomanic, generalized to any entry point and SM 5.x target.
  • indirect.rs (make_for), host.rs (compile, and the card-compare pass in make_card_work): when D3DCompile fails, use the DXC result instead of returning the error. The clamp logs the refusal at info level and warns only if DXC fails too.
  • Cargo.toml: the Win32_Graphics_Direct3D_Dxc feature of windows.

On Windows D3DCompile succeeds and none of this runs.

Tested

  • RTX 4070 Ti 12 GB, NVIDIA 620.70.06 open modules, Fedora 45, kernel 7.3.4; Wine from Proton Experimental, vkd3d-proton cae8353e, DXC 1.9.2609 (dxcompiler.dll + dxil.dll given via VICTORY_DXC). Diag build, cross-compiled for x86_64-pc-windows-msvc.
  • On d279e69 + VIctory #454 + this change: the log shows the clamp refused by Wine's compiler and then built by DXC, no further error; indirect work runs (~4000–5000 draws per frame in the world); the first gameplay scene renders lit and is controllable with a pad, ~2 fps (8-minute steady window: avg 1.96 fps, p50 507 ms, p99 624 ms). Two runs, ~25 min each, no device loss.
  • This branch (rebased on 7b0f736): builds for x86_64-pc-windows-msvc in release and in the diag profile, and cargo clippy --release -p victory-gpu reports no warnings. (My cross build needs blake3's pure feature, applied locally only; it is not in this PR.) The runs above used the same change on d279e69; I have not yet run this rebased commit in the game.

Not tested

  • Windows (the fallback path does not run there), AMD, the workspace test suite (no Windows machine here).

AI use
Claude Code (Claude Opus 5.5) wrote the change, ran the builds and tests on my machine and drafted this description.

🤖 Generated with Claude Code

Under Wine/Proton, D3DCompile is Wine's d3dcompiler_47 (vkd3d-shader),
which has no RWByteAddressBuffer methods. The indirect-argument clamp
fails with "E5005: Method 'InterlockedMax' is not defined on type
'RWByteAddressBuffer'", so every indirect draw and dispatch is dropped
and the 3D scene stays black on Linux.

When D3DCompile refuses a shader of ours, compile the same source with
DXC (dxcompiler.dll from VICTORY_DXC, beside dxil.dll, or the exe's
folder / System32) as SM 6.0, sign it with dxil.dll, and use that.
Applied at every runtime compile site: the clamp (indirect::make_for),
host::compile, and the card-compare pass. Windows is unchanged:
D3DCompile succeeds there and the fallback never runs.

Adapted from Marvisak/VIctory PR fxceless#178 by Ortomanic, generalized to any
entry point and SM 5.x target.

Assisted-by: Claude Code (Claude Opus 5.5)
Copilot AI balanced review requested due to automatic review settings November 24, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@oeirughrepuiohg

Copy link
Copy Markdown
Author

Closing in favour of #20 by @ErRusso, which was opened a few minutes earlier and covers more: the in-place probe and the root signature Wine's compiler drops, with tests. I've posted my in-game results there. Sorry for the duplicate; I missed #20 when I opened this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants