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

Closed
oeirughrepuiohg wants to merge 1 commit from upstream-pr/21 into main
oeirughrepuiohg commented 2026-11-24 20:09:49 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by oeirughrepuiohg on 2026-11-24T20:09:49Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6590447662 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/21). Originally posted by [oeirughrepuiohg](https://github.com/oeirughrepuiohg) on 2026-11-24T20:09:49Z. --- 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](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 21:30:16 +00:00
copilot-pull-request-reviewer[bot commented 2026-11-24 21:30:17 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T20:10:07Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:fxceless/victory-fork:review:6046561890 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/21#pullrequestreview-6046561890). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-24T20:10:07Z. **Review:** COMMENTED --- 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 commented 2026-11-24 21:30:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by oeirughrepuiohg on 2026-11-24T20:43:59Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7143983141 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/21#issuecomment-7143983141). Originally posted by [oeirughrepuiohg](https://github.com/oeirughrepuiohg) on 2026-11-24T20:43:59Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!21
No description provided.