Wine: the argument clamp falls back to DXC (cs_6_0) when d3dcompiler_47 refuses it #243

Open
github-bot wants to merge 1 commit from github-bot/gh-243 into main AGit
Owner

@⁠TobiasFornell on GitHub · 2026-11-26 09:17 UTC · original
TobiasFornell:dxc-clamp-fallback → main · +52 −5 · 2 files · 1 commits · open

Follow-up to #183 (as offered there): when Wine's d3dcompiler_47 refuses the indirect-argument clamp shader, compile the same HLSL with DXC (dxcompiler.dll, beside the executable or system-wide) as cs_6_0 instead. The HLSL is unchanged; the cs_6_0 container carries the root signature the same way.

  • Only runs after D3DCompile fails, so Windows behaviour is unchanged.
  • If dxcompiler.dll is missing or DXC fails too, the previous error path is kept.
  • Touches crates/victory-gpu/src/indirect.rs and adds the Win32_Graphics_Direct3D_Dxc feature.

Tested only on Linux: CachyOS, RX 9070 XT (RDNA4, RADV), Proton Experimental, on our Belobug-based branch (clamp without the #1011 rewrite): the clamp shaders compile and indirect draws are no longer dropped. On this PR's base (4f62c2a) it was only build-checked (cargo check -p victory-gpu --target x86_64-pc-windows-msvc).

@⁠YaBulochka: this is the clamp case you had not measured; it would make sense to share one DXC helper with your host::compile fallback.

No game files included.

**@⁠TobiasFornell** on GitHub · 2026-11-26 09:17 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/243) `TobiasFornell:dxc-clamp-fallback` → `main` · +52 −5 · 2 files · 1 commits · open Follow-up to #183 (as offered there): when Wine's `d3dcompiler_47` refuses the indirect-argument clamp shader, compile the same HLSL with DXC (`dxcompiler.dll`, beside the executable or system-wide) as `cs_6_0` instead. The HLSL is unchanged; the `cs_6_0` container carries the root signature the same way. - Only runs after `D3DCompile` fails, so Windows behaviour is unchanged. - If `dxcompiler.dll` is missing or DXC fails too, the previous error path is kept. - Touches `crates/victory-gpu/src/indirect.rs` and adds the `Win32_Graphics_Direct3D_Dxc` feature. Tested only on Linux: CachyOS, RX 9070 XT (RDNA4, RADV), Proton Experimental, on our Belobug-based branch (clamp without the #1011 rewrite): the clamp shaders compile and indirect draws are no longer dropped. On this PR's base (`4f62c2a`) it was only build-checked (`cargo check -p victory-gpu --target x86_64-pc-windows-msvc`). @⁠YaBulochka: this is the clamp case you had not measured; it would make sense to share one DXC helper with your `host::compile` fallback. No game files included.
Wine's d3dcompiler_47 cannot compile the clamp (no InterlockedMax or store
to a raw buffer), so under Proton every indirect execution was dropped and
the world drew nothing. dxcompiler.dll beside the executable compiles it as
cs_6_0, whose container carries the root signature the same way.

(cherry picked from commit 3897d7243578724bf261255550e525c29b9d390b)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:55:33 +00:00
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 15:41 UTC · original · reviewed

AI-assisted static review; I inspected the dynamic-load and COM lifetime path, but did not run tests or the game.

**@⁠gut0to** on GitHub · 2026-11-26 15:41 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/243#pullrequestreview-6076927443) · **reviewed** AI-assisted static review; I inspected the dynamic-load and COM lifetime path, but did not run tests or the game.
@ -120,0 +131,4 @@
// SAFETY: loading the compiler and calling its documented entry point
// with out pointers of ours; the buffer and arguments outlive the calls.
unsafe {
let library = LoadLibraryW(w!("dxcompiler.dll"))?;
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 15:41 UTC · original

LoadLibraryW increments the module reference count, but this function never calls FreeLibrary. Each fallback compilation therefore keeps another dxcompiler.dll reference for the process lifetime, including failures after the load. Could the module handle use an RAII guard that is dropped after the compiler/result objects?

**@⁠gut0to** on GitHub · 2026-11-26 15:41 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/243#discussion_r4710585277) `LoadLibraryW` increments the module reference count, but this function never calls `FreeLibrary`. Each fallback compilation therefore keeps another `dxcompiler.dll` reference for the process lifetime, including failures after the load. Could the module handle use an RAII guard that is dropped after the compiler/result objects?
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/243/head:github-bot/gh-243'
git switch 'github-bot/gh-243'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-243'
git switch 'github-bot/gh-243'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-243'
git switch 'github-bot/gh-243'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-243'
git switch 'main'
git merge --squash 'github-bot/gh-243'
git switch 'main'
git merge --ff-only 'github-bot/gh-243'
git switch 'main'
git merge 'github-bot/gh-243'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.