Wine/vkd3d: indirect execution is dropped because the argument clamp cannot be compiled there; rewriting its HLSL does not help #170
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#170
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?
@LaunchDoesntCode on GitHub · 2026-11-24 01:05 UTC · original
Under Wine/Proton,
indirect::clamp()returnsNone, so every indirect draw and dispatch is dropped ("no argument clamp: indirect execution dropped"). #128 lists the failing test as an environment gap; this issue is about the runtime consequence and what does and does not fix it.Environment
mainatd2a4bae, cross-built forx86_64-pc-windows-msvcon Linux Mint, Proton 10.0 (wine-10.0 with its builtind3dcompiler_47, vkd3d-proton), NVIDIA RTX 5090, driver 595.99.2.What fails
indirect::tests::argument_clamp_buildsfails:D3DCompileofSOURCEincrates/victory-gpu/src/indirect.rsis rejected withE5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'(as reported in #128).What I tried: the same shader on indexed buffers
I rewrote the clamp to use
RWStructuredBuffer<uint>for both buffers (indexing instead ofLoad/Load3/Store*, and the free functionInterlockedAdd(budget[0], ...)). Wine's compiler answers:So two separate things are missing there, and no rewrite of the HLSL gets around both:
RWBufferstores may work, but a typed buffer cannot be a root descriptor, so that would mean a descriptor table and a heap of our own in the middle of the title's list.[RootSignature]attribute is ignored. Even a shader that compiled would carry no root signature, andCreateRootSignature(0, bytes)on the shader blob would fail.Options
d3dcompiler_47.dllin the prefix (not tested here; I don't have one in this setup).emit::host::stub_vsbuilds its vertex shader, and create the root signature from a description in code. vkd3d-proton already takes the DXIL this project emits. It would also drop the runtime dependency ond3dcompiler_47.dllon Windows.I am willing to do the second one if that direction is wanted; it is a moderately sized change (the clamp has branches, raw buffer loads and stores, and an atomic add), so I would rather ask first than send it unannounced.
No game data used. AI-assisted (Claude Code).
@AugustoZFJ on GitHub · 2026-11-24 02:28 UTC · original
The "no rewrite of the HLSL gets around both" part turns out to depend on the Wine version. I tried the same rewrite and it works on Wine 11. It doesn't on Proton 10, which matches what you saw.
The rewrite:
RWStructuredBuffer<uint>for both buffers with plain indexing, the free functionInterlockedAdd(budget[0], ...), and the root signature built in code throughpipeline::host::root_signature, since the[RootSignature]attribute is ignored.On GE-Proton11-14 (RX 6900 XT, RADV 26.2.6, the vkd3d-proton it ships)
argument_clamp_buildspasses with the rewrite. I also added a test that runs the clamp on the GPU and reads the records back. It checks that draw counts are cut to the bounds, that a dispatch over the group limit comes back empty, and that when three draws together go over the budget one of them is emptied. That passes too.So structured buffer stores must have landed in Wine's compiler somewhere between 10 and 11. The byte-address methods and the attribute are still missing in 11.
Which gives a third option besides #178 and #190: +84 -18 in
indirect.rs, test included, without DXC and without more DXIL to maintain. The cost is that Proton 10 still gets no indirect execution. #190 is the only one of the three that doesn't care what the host's compiler can do. I ran it here as well, merged ontod2a4bae: the clamp test passes, its two new tests pass, nothing else in the workspace moves.I can open a PR with the rewrite if you'd rather take that trade. Otherwise I'd go with #190.
I didn't use any game files for this, only the test suite.
@ghost on GitHub · 2026-11-24 07:35 UTC · original
An NVIDIA data point, with the two open fixes compared side by side.
Setup:
d3dcompiler_47(WINEDLLOVERRIDES=d3dcompiler_47=b, as Proton ships it), vkd3d-proton 3.1.victory-gputests cross-built forx86_64-pc-windows-gnu(rustc 1.98.1),mainatd2a4bae.indirect::tests::argument_clamp_buildsmainclamp()isNone), as reported heremainwith winetricks' natived3dcompiler_47main+ #190 (ffa1310)main+ #178 (f435ad1),dxcompiler.dllbesidedxil.dlldxcompiler.dllloaded)main+ #178, nodxcompiler.dllSo both fix it on NVIDIA too. The difference for Proton users is that #178 needs them to supply
dxcompiler.dll, while #190 needs nothing.The whole
victory-gpusuite passes (43 passed, 0 failed) onmain+ #190 + #680 + #347; details on #128.AI-assisted (Claude Code); the runs are mine.
@crashbashash on GitHub · 2026-11-24 13:13 UTC · original
Tested the native-compiler workaround mentioned above: it works, no code change needed.
Setup: CachyOS (kernel 7.3.4), RX 6800 XT (RDNA2, RADV, Mesa 26.2.6), GE-Proton11-14 (vkd3d-proton
cae8353ed),mainatffe310e, diagnostics build cross-compiled with cargo-xwin, Series X, 1.0.2.1.Before, with Proton's builtin
d3dcompiler_47:Every indirect kind (0, 1, 2, 10) was dropped as
not bounded (no clamp, or arguments not 4-byte aligned).Workaround:
This installs Microsoft's DLL (FileVersion 10.0.17134.12) and sets
d3dcompiler_47=n. If you startvictory.exewithproton runinprefix, Proton applies none of its DLL overrides, so set them yourself:WINEDLLOVERRIDES="d3d9=n;d3d10core=n;d3d11=n;dxgi=n;d3d12=n;d3d12core=n;d3dcompiler_47=n"After: the clamp builds, and the
E5005/no argument clamplines are gone. Nothing is dropped for a missing clamp any more. The remaining indirect drops areprepare failed, while a pipeline is still being built or its shaders don't translate. Signatures that change root arguments are still dropped, as on Windows (#757).The scene is still dark, as on Windows: 260 compute shaders didn't translate in that run.
This only matters until #178, #190 or the clamp in #844 lands. With any of those, nothing needs installing.
No game data used. AI-assisted (Claude Code).
@Ahmet-Dedeler on GitHub · 2026-11-24 15:15 UTC · original
A macOS data point for this (Apple Silicon, CrossOver 26.3, Wine + Rosetta 2, Apple's D3DMetal as the D3D12).
Same failure as on Linux. CrossOver's builtin
d3dcompiler_47refuses the clamp,indirect::clamp()isNone, and every indirect draw and dispatch is dropped. In the world that was 2,900 to 5,800 indirect executions dropped per frame, with only 210 to 640 draws reaching the host.What fixed it here is #178's route: with
dxcompiler.dllanddxil.dllnext to the exe the clamp builds, and 0 executions are dropped for a missing clamp. 2,100 to 2,900 draws reach the host per frame after that. I ran this onBeachesOfViceCity/VIctory-Linuxat f1e94ce (upstreamffe310eplus their Wine/Proton commits), which already carries that route, with a few Mac host commits of my own on top. A clamp container compiled ahead of time also works, for a host that has neither compiler.I did not try the native
d3dcompiler_47override or #190's writer.The picture did not change with it though. In the world I still get a horizon line and street and car lights on black, so the clamp was not what kept the scene dark on this host. What is still dropped per world frame after the fix, from one 140 s world run: 445 to 911 draws whose compute shader does not translate, 255 indirect draws with "prepare failed" although the pipeline exists, 124 to 151 compute pipelines that need 64-lane waves (D3DMetal only runs 32-lane waves), 60 to 81 whose mesh shader does not translate.
@Marvisak on GitHub · 2026-11-25 01:47 UTC · original · edited 2026-11-25 18:48 UTC
Automated triage for the maintainers.
Confirmed on current
main(13f91ca). Incrates/victory-gpu/src/indirect.rs,make()still compilesSOURCEat run time withD3DCompile(cs_5_1). That source usesRWByteAddressBuffermethods and takes its root signature from theRootSignatureattribute. Wine's, Proton's and CrossOver's built-ind3dcompiler_47refuse the methods and ignore the attribute, soclamp()returnsNoneand every indirect execution is dropped. The comments above confirm this on AMD, NVIDIA and macOS/CrossOver hosts.#178 (DXC fallback) and #190 (clamp built with the shader crate's own writer) were both closed without being merged. The open PR for this is #1279:
RWStructuredBuffer<uint>indexed in words, with the root signature serialized in code. It needs a rebase. New since the last triage: the same kind of rewrite on a third-party fork was run on Wine 11.22 (RX 7600 XT, RADV). With it the clamp builds, nothing is dropped for a missing clamp, and the world draws (about 4,500 draws per frame). This supports #1279's approach. Per the thread, Wine 11.22 or newer is needed, since Wine 10 and Proton 10 still cannot compile it.The workaround until then is Microsoft's
d3dcompiler_47.dllwithd3dcompiler_47=n, as described in the comments.Generated by Claude Code
@YaBulochka on GitHub · 2026-11-25 17:10 UTC · original
A rewritten clamp does restore the world on Wine 11.22, so the "no rewrite gets around it" part holds only for the rewrites tried above. The one that works is PR #1011 in
fxceless/victory-fork: the written buffers areRWStructuredBuffer<uint>indexed in words,Interlocked*are called as functions on the word,[allow_uav_condition]is dropped and the root signature is serialized. Per that PR it needs Wine 11.22 or newer; Debian's Wine 10.0 cannot build it.Build:
fxceless/victory-forkd9e68eb(PR #1011),x86_64-pc-windows-gnu,--features diagnostics, plainvictory run <exe> --execute.Environment: CachyOS kernel 7.3.5, Ryzen 5 9600X, 30 GB, Radeon RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton built from master in the prefix, package 1.0.2.1.
What was run: the retail executable through
victory run --execute, auto-Enter through the first prompts, default arena.argument_clamp_builds/D3DCompileE5005: Method 'InterlockedMax' is not defined on type 'RWByteAddressBuffer'no argument clamp: indirect execution droppedAdding #1033 on top of #1011 moved the same route from 0.67 to 0.74 average fps and the median world frame from 2,499 to 1,693 ms (4,409 to 3,620 draws per frame; the two samples are different moments, so treat the medians as indicative, not a clean A/B). #1031, #1023, #1032 and #1020 merged and built cleanly as well; #1018 conflicts with #1011 in this tree.
Remaining cost per frame, measured with the same run: 1.1-1.3 s "preparing" (copies ~250 MB, textures ~0.5 s), 0.6-0.8 s copying back ~80 MB, GPU 40-290 ms. So the world is correct now and the bottleneck is CPU-side preparation plus readback, not the shader path.
No game files or captures are included; this is counts only.