Wine: the indirect clamp can be built by Wine's compiler (tested on the retail title: 12 -> 4,515 draws/frame) #2744
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#2744
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:27 UTC · original
Wine: the indirect argument clamp can be written so Wine's own compiler builds it — the world renders once it is (before/after on the retail title)
This is the practical half of #170: a rewritten clamp does get around
E5005on Wine 11.22, and the difference on the retail package is black-or-flat versus a real 3D frame. The working form is PR #1011 infxceless/victory-fork;mainhas noRWStructuredBufferinindirect.rsand noInterlockedMax, so it is not in yet.Why the earlier rewrites failed.
D3DCompileunder Wine is vkd3d-shader's compiler, not Microsoft's. It has noLoad/StoreonRWByteAddressBuffer, noInterlocked*on it, and no[allow_uav_condition]. The form that it does take:RWStructuredBuffer<uint>, indexed in words (dst_at = id.x * (stride / 4), copied words at+ off / 4; budget words 0, 1 and 2 are the old bytes 0, 4 and 8) — a store to a structured buffer is implemented there, a store to a raw one is not;ByteAddressBuffer, becauseLoadon those builds;Interlocked*are called as functions on the word, not methods;[allow_uav_condition]is dropped (Microsoft's compiler builds the loop without it);[RootSignature]attribute.Wine 10.0 cannot build it at all (
GroupMemoryBarrierWithGroupSync,InterlockedAdd, structured-buffer stores are missing); 11.22 and Proton Experimental's wine can. That is worth saying in the docs, because "Wine" spans both.Before/after on the retail 1.0.2.1 package, same machine, CachyOS 7.3.5, Ryzen 5 9600X, 30 GB, RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton built from master,
x86_64-pc-windows-gnu:E5005: Method 'InterlockedMax' is not defined on type 'RWByteAddressBuffer'no argument clamp: indirect execution droppedI put the same numbers under #170 and the visual side of another Wine-only gap in
fxceless/victory-fork#1072. Happy to hand the patch over as a diff or a branch if a collaborator wants to open the PR; it is one file plus the clamp constants, and it does not change the rules (MOST_DRAW, the 2^27 budget, one charge per group of 64).No game files, dumps or screenshots are included.
@Marvisak on GitHub · 2026-11-25 21:46 UTC · original
Automated triage for the maintainers.
Thanks for the before/after numbers. The cause is confirmed and tracked in #170.
make()incrates/victory-gpu/src/indirect.rsonmain(61bfc77) still compiles theRWByteAddressBufferform, and nothing merged since changes that.An open PR here already carries the same change: #1279 ("GPU: an argument clamp Wine's compiler builds too"). It uses
RWStructuredBuffer<uint>indexed in words and serializes the root signature in code. It needs a rebase. Pull requests are open to everyone. If the fork's version differs from #1279 in a way that matters (for example, the call form ofInterlocked*or dropping[allow_uav_condition]), please say so in a review on #1279 or open your own PR linking #170. The note that Wine 10 / Proton 10 cannot build it and Wine 11.22 can belongs in the docs; Wine notes are proposed in open PR #2082.Generated by Claude Code
@YaBulochka on GitHub · 2026-11-26 07:38 UTC · original
One more data point for the route question: a
dxcompiler.dllfallback for host shaders works too, and it covers both the clamp and a second shader the rewrite does not touch.I implemented it in
host::compile: whenD3DCompilefails, the same HLSL is compiled by DXC as<stage>_6_0(DxcCreateInstance+IDxcCompiler3::Compile, blob fromDXC_OUT_OBJECT).VICTORY_DXC=1forces it; otherwise it only runs on a failure.D3DCompilesucceeds and DXC is never asked — that case is untested by me, so I cannot say whether the fallback alone would have replaced #1011.GetDimensionson aRWTexture2D) fails withE5005under Wine, and with the fallback it builds ascs_6_0. I reverted the hand patch I had written for it and the Series S profile still draws:the upscaler's output is made by a plain stretch.Measured on CachyOS 7.3.5, RX 7600 XT 8 GB, RADV Mesa 27.0.0, Wine 11.22, retail 1.0.2.1: Series S, 152 consecutive world frames, average 3.99 fps, median frame 215 ms, 4,320 draws.
So the two routes are: rewrite each shader (no dependency, same SM5 as Windows), or a fallback (covers the whole class, adds two DLLs, and shifts those shaders to DXIL 6.0 through vkd3d). Which would the maintainers rather have here? If it is the fallback, I can send it as a diff; TobiasFornell independently confirmed the same approach under Proton on a 9070 XT (Belobug#183), so there would be two testers.
No game files or screenshots, numbers only.