Wine: the clamp and the window check do not compile there, so every indirect draw is dropped (working form + benchmark) #183
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD#183
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@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 withfxceless/victory-fork's #1011.What happens. Under Wine,
D3DCompileis vkd3d-shader's compiler. It refuses the clamp's shader (and the window check's) with:The runtime then logs
no argument clamp: indirect execution droppedand 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:
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.ByteAddressBuffer(Loadon 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.[RootSignature].GroupMemoryBarrierWithGroupSync, noInterlockedAdd, 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, commitd9e68eb): https://github.com/fxceless/victory-fork/pull/1011 — yourSOURCEis a superset of theirs (six constants, the count buffer), so the same rewrite applies; your window check'shits.InterlockedAddneeds the same treatment.I have a Belobug clone at
000ffddand can send a ported diff if you would rather review than write it. No game files or screenshots are included here.@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_47refuses the clamp shader, compile it withdxcompiler.dllascs_6_0instead. 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.
@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:
cs_6_0viadxcompiler.dll, with the #1011 rewrite reverted, to confirm the fallback alone restores the world;If it helps,
dxcompiler.dll1.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: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, whenD3DCompilerefuses a shader, the same source is compiled throughdxcompiler.dllas<stage>_6_0(DxcCreateInstance+IDxcCompiler3::Compile,DXC_OUT_OBJECTfor the blob,DXC_OUT_ERRORSlogged).VICTORY_DXC=1forces 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.dll1.9.2609 next to the executable, retail 1.0.2.1.Results:
corner/overD3DCompilevs_6_0,ps_6_0— fineE5005: GetDimensions ...then a black worldcs_6_0,the upscaler's output is made by a plain stretch, picture on screenWith
VICTORY_DXC=1unset the fallback still buildscs_6_0on its own:D3DCompilefails 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
D3DCompilesucceeds 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.