Wine: the clamp and the window check do not compile there, so every indirect draw is dropped (working form + benchmark) #183

Open
opened 2026-11-26 03:37:28 +00:00 by github-bot · 3 comments
Owner

@⁠YaBulochka on GitHub · 2026-11-25 19:36 UTC · original

On Wine the world never renders: indirect.rs's clamp does not compile there, and every indirect draw is dropped. Wine 11.22 can build the same clamp in a different shape — tested on the retail 1.0.2.1 package with fxceless/victory-fork's #1011.

What happens. Under Wine, D3DCompile is vkd3d-shader's compiler. It refuses the clamp's shader (and the window check's) with:

E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'
E5005: Method 'InterlockedMax' is not defined on type 'RWByteAddressBuffer'
E5005: Aborting due to not yet implemented feature: Structured buffers store is not implemented.

The runtime then logs no argument clamp: indirect execution dropped and drops indirect kinds 0/1/2/10 — about 2,500+ draws a frame — so only menus and 2D reach the screen (12 draws/frame).

What compiles. The form #1011 uses, which Wine 11.22 and Proton Experimental's wine accept, and which writes the same bytes:

  • the buffers the shader writes become RWStructuredBuffer<uint>, indexed in words: dst_at = id.x * (stride / 4), copied words at + off / 4, budget words 0/1/2 are the old bytes 0/4/8. A store to a structured buffer is implemented in that compiler; a store to a raw one is not.
  • read-only buffers stay ByteAddressBuffer (Load on those builds).
  • Interlocked* are called as functions on the word (InterlockedAdd(budget[0], ...)), not as methods.
  • [allow_uav_condition] is dropped; Microsoft's compiler builds the loop without it.
  • the root signature is serialized by the runtime, because that compiler writes none from [RootSignature].
  • Wine 10.0 cannot build it at all (no GroupMemoryBarrierWithGroupSync, no InterlockedAdd, no structured-buffer stores), so the docs should say Wine 11.22+.

Before/after on the same machine (CachyOS 7.3.5, Ryzen 5 9600X, 30 GB, RX 7600 XT 8 GB, RADV Mesa 27.0.0, Wine 11.22): 12 draws/frame and a flat colour before, 4,515 draws/frame and a real interior/character/street after; indirect drops 2,500+/frame → 0.

The patch is one file in fxceless/victory-fork (PR #1011, commit d9e68eb): https://github.com/fxceless/victory-fork/pull/1011 — your SOURCE is a superset of theirs (six constants, the count buffer), so the same rewrite applies; your window check's hits.InterlockedAdd needs the same treatment.

I have a Belobug clone at 000ffdd and can send a ported diff if you would rather review than write it. No game files or screenshots are included here.

**@⁠YaBulochka** on GitHub · 2026-11-25 19:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/183) On Wine the world never renders: `indirect.rs`'s clamp does not compile there, and every indirect draw is dropped. Wine 11.22 can build the same clamp in a different shape — tested on the retail 1.0.2.1 package with `fxceless/victory-fork`'s #1011. **What happens.** Under Wine, `D3DCompile` is vkd3d-shader's compiler. It refuses the clamp's shader (and the window check's) with: ``` E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer' E5005: Method 'InterlockedMax' is not defined on type 'RWByteAddressBuffer' E5005: Aborting due to not yet implemented feature: Structured buffers store is not implemented. ``` The runtime then logs `no argument clamp: indirect execution dropped` and drops indirect kinds 0/1/2/10 — about 2,500+ draws a frame — so only menus and 2D reach the screen (12 draws/frame). **What compiles.** The form #1011 uses, which Wine 11.22 and Proton Experimental's wine accept, and which writes the same bytes: - the buffers the shader *writes* become `RWStructuredBuffer<uint>`, indexed in words: `dst_at = id.x * (stride / 4)`, copied words at `+ off / 4`, budget words 0/1/2 are the old bytes 0/4/8. A store to a structured buffer is implemented in that compiler; a store to a raw one is not. - read-only buffers stay `ByteAddressBuffer` (`Load` on those builds). - `Interlocked*` are called as functions on the word (`InterlockedAdd(budget[0], ...)`), not as methods. - `[allow_uav_condition]` is dropped; Microsoft's compiler builds the loop without it. - the root signature is serialized by the runtime, because that compiler writes none from `[RootSignature]`. - Wine 10.0 cannot build it at all (no `GroupMemoryBarrierWithGroupSync`, no `InterlockedAdd`, no structured-buffer stores), so the docs should say Wine 11.22+. **Before/after on the same machine** (CachyOS 7.3.5, Ryzen 5 9600X, 30 GB, RX 7600 XT 8 GB, RADV Mesa 27.0.0, Wine 11.22): 12 draws/frame and a flat colour before, 4,515 draws/frame and a real interior/character/street after; indirect drops 2,500+/frame → 0. The patch is one file in `fxceless/victory-fork` (PR #1011, commit `d9e68eb`): https://github.com/fxceless/victory-fork/pull/1011 — your `SOURCE` is a superset of theirs (six constants, the count buffer), so the same rewrite applies; your window check's `hits.InterlockedAdd` needs the same treatment. I have a Belobug clone at `000ffdd` and can send a ported diff if you would rather review than write it. No game files or screenshots are included here.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:28 +00:00
Author
Owner

@⁠TobiasFornell on GitHub · 2026-11-25 21:37 UTC · original

Another data point, on Proton Experimental (CachyOS, RX 9070 XT, RADV): the same failure shows up there, and I got past it without rewriting the HLSL.

In a local branch I added a fallback: if d3dcompiler_47 refuses the clamp shader, compile it with dxcompiler.dll as cs_6_0 instead. With that, the clamp shaders compile and the indirect draws are no longer dropped. I did not compare it against the #1011 rewrite, so I can't say which route is better; the rewrite avoids the extra DLL dependency, the fallback leaves the HLSL untouched.

If a DXC fallback is of interest next to the rewrite, I can send the diff as a PR against current main. No game files included.

**@⁠TobiasFornell** on GitHub · 2026-11-25 21:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/183#issuecomment-7175325896) Another data point, on Proton Experimental (CachyOS, RX 9070 XT, RADV): the same failure shows up there, and I got past it without rewriting the HLSL. In a local branch I added a fallback: if `d3dcompiler_47` refuses the clamp shader, compile it with `dxcompiler.dll` as `cs_6_0` instead. With that, the clamp shaders compile and the indirect draws are no longer dropped. I did not compare it against the #1011 rewrite, so I can't say which route is better; the rewrite avoids the extra DLL dependency, the fallback leaves the HLSL untouched. If a DXC fallback is of interest next to the rewrite, I can send the diff as a PR against current main. No game files included.
Author
Owner

@⁠YaBulochka on GitHub · 2026-11-26 07:10 UTC · original

Yes please — send the diff (or a PR against current main), and I will test it here and report back with numbers.

Context: we already run the #1011 rewrite on Wine 11.22 (fxceless/victory-fork, RX 7600 XT 8 GB, RADV/Mesa 27.0.0) and it does restore the world — 12 draws/frame in menus to 4,515 in the world. Having the fallback as well is worth it precisely because it also covers host shaders we have not rewritten yet: the Series S stretch pass fails the same way (E5005: Method 'GetDimensions' is not defined on type 'RWTexture2D<float4>'), and I had to patch it by hand (over.rs, sizes as constants) to get the Series S profile to draw at all.

So the test I would run on the fallback:

  1. clamp and window-check shaders as cs_6_0 via dxcompiler.dll, with the #1011 rewrite reverted, to confirm the fallback alone restores the world;
  2. the Series S stretch with the hand patch reverted, to see whether the fallback alone builds it;
  3. frame time and draw counts against the rewrite-only build, so we can say whether the extra DLL path costs anything measurable on a 8 GB card.

If it helps, dxcompiler.dll 1.9.2609 is already sitting next to the executable here, so the test is just a rebuild.

No game files or screenshots involved, numbers only.

**@⁠YaBulochka** on GitHub · 2026-11-26 07:10 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/183#issuecomment-7185179558) Yes please — send the diff (or a PR against current main), and I will test it here and report back with numbers. Context: we already run the #1011 rewrite on Wine 11.22 (`fxceless/victory-fork`, RX 7600 XT 8 GB, RADV/Mesa 27.0.0) and it does restore the world — 12 draws/frame in menus to 4,515 in the world. Having the fallback as well is worth it precisely because it also covers host shaders we have not rewritten yet: the Series S stretch pass fails the same way (`E5005: Method 'GetDimensions' is not defined on type 'RWTexture2D<float4>'`), and I had to patch it by hand (`over.rs`, sizes as constants) to get the Series S profile to draw at all. So the test I would run on the fallback: 1. clamp and window-check shaders as `cs_6_0` via `dxcompiler.dll`, with the #1011 rewrite reverted, to confirm the fallback alone restores the world; 2. the Series S stretch with the hand patch reverted, to see whether the fallback alone builds it; 3. frame time and draw counts against the rewrite-only build, so we can say whether the extra DLL path costs anything measurable on a 8 GB card. If it helps, `dxcompiler.dll` 1.9.2609 is already sitting next to the executable here, so the test is just a rebuild. No game files or screenshots involved, numbers only.
Author
Owner

@⁠YaBulochka on GitHub · 2026-11-26 07:24 UTC · original

Implemented the fallback here and it works on RADV; it also replaces a hand patch we were carrying, which is the strongest argument for having both routes.

What I did: in host::compile, when D3DCompile refuses a shader, the same source is compiled through dxcompiler.dll as <stage>_6_0 (DxcCreateInstance + IDxcCompiler3::Compile, DXC_OUT_OBJECT for the blob, DXC_OUT_ERRORS logged). VICTORY_DXC=1 forces the fallback for testing; without it, it only runs after a failure.

Environment: CachyOS 7.3.5, Ryzen 5 9600X, 30 GB, RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton from master, dxcompiler.dll/dxil.dll 1.9.2609 next to the executable, retail 1.0.2.1.

Results:

shader before with the fallback
overlay corner/over built by D3DCompile vs_6_0, ps_6_0 — fine
Series S stretch (hand patch reverted) E5005: GetDimensions ... then a black world cs_6_0, the upscaler's output is made by a plain stretch, picture on screen
forced mode, whole run — same frame times as the rewrite build (859 ms in the interior scene)

With VICTORY_DXC=1 unset the fallback still builds cs_6_0 on its own: D3DCompile fails first, the fallback takes over, Series S draws. So we can drop the hand-written HLSL patch for the stretch entirely, and the #1011 clamp rewrite becomes optional rather than required.

What I have not measured: the fallback alone for the clamp (our tree still carries #1011, so D3DCompile succeeds for it and DXC is never asked). If your diff is already tested for that case, I would still like it — the two implementations should probably be the same code.

No game files or screenshots, numbers only.

**@⁠YaBulochka** on GitHub · 2026-11-26 07:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/183#issuecomment-7185417650) Implemented the fallback here and it works on RADV; it also replaces a hand patch we were carrying, which is the strongest argument for having both routes. **What I did:** in `host::compile`, when `D3DCompile` refuses a shader, the same source is compiled through `dxcompiler.dll` as `<stage>_6_0` (`DxcCreateInstance` + `IDxcCompiler3::Compile`, `DXC_OUT_OBJECT` for the blob, `DXC_OUT_ERRORS` logged). `VICTORY_DXC=1` forces the fallback for testing; without it, it only runs after a failure. **Environment:** CachyOS 7.3.5, Ryzen 5 9600X, 30 GB, RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton from master, `dxcompiler.dll`/`dxil.dll` 1.9.2609 next to the executable, retail 1.0.2.1. **Results:** | shader | before | with the fallback | |---|---|---| | overlay `corner`/`over` | built by `D3DCompile` | `vs_6_0`, `ps_6_0` — fine | | Series S stretch (hand patch reverted) | `E5005: GetDimensions ...` then a black world | `cs_6_0`, `the upscaler's output is made by a plain stretch`, picture on screen | | forced mode, whole run | — | same frame times as the rewrite build (859 ms in the interior scene) | With `VICTORY_DXC=1` unset the fallback still builds `cs_6_0` on its own: `D3DCompile` fails first, the fallback takes over, Series S draws. So we can drop the hand-written HLSL patch for the stretch entirely, and the #1011 clamp rewrite becomes optional rather than required. What I have not measured: the fallback alone for the clamp (our tree still carries #1011, so `D3DCompile` succeeds for it and DXC is never asked). If your diff is already tested for that case, I would still like it — the two implementations should probably be the same code. No game files or screenshots, numbers only.
This discussion has been locked. Commenting is limited to contributors.
No description provided.