gpu: host shaders fall back to dxcompiler.dll when D3DCompile refuses them (indirect clamp on Wine) #1285
No reviewers
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/fxceless--victory-fork!1285
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1285/head"
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-26 10:31 UTC · original
YaBulochka:dxc-fallback→main· +358 −3 · 4 files · 1 commits · closed without mergingWine's
d3dcompiler_47is vkd3d-shader's compiler, and it refuses two host shaders we cannot do without. WhenD3DCompilefails, compile the same source throughdxcompiler.dllas<stage>_6_0instead.What fails today
Under Wine the indirect clamp never builds:
With no clamp every indirect execution is dropped — kinds 0/1/2/10, about 2,500+ a frame on the retail title — so the world is black or a flat colour and only menus draw (12 draws a frame). The two-plane composer fails the same way (
E5005: GetDimensions is not defined on type 'RWTexture2D<float4>', thentwo-plane composer not made; showing base plane only), which costs the 2D layer.The change
crates/victory-gpu/src/dxc.rs:DxcCreateInstance+IDxcCompiler3::CompilethroughLoadLibraryW("dxcompiler.dll"),DXC_OUT_OBJECTfor the blob,DXC_OUT_ERRORSlogged when the compile fails. The profile is the requested one with_5_1mapped to_6_0.host::compile: on aD3DCompilefailure, try DXC;VICTORY_DXC=1forces the fallback (for testing and for A/B runs).indirect::make_from: the clamp is compiled by DXC first when the DLL is present, with the FXC path unchanged otherwise.build()takes the bytes, so either compiler's output goes to the same root signature and pipeline code.On Windows nothing changes:
D3DCompilesucceeds, the fallback is never reached, and the DLL is not required. On Wine 11.22 and Proton Experimental's wine the shader builds and the world renders. Wine 10.0 cannot compile it either way — it lacksGroupMemoryBarrierWithGroupSync,InterlockedAddand structured-buffer stores — so the docs should say 11.22+.Measured
Retail 1.0.2.1, Radeon RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton from master,
mainf6a09d3plus this patch only, Series S,VICTORY_TEXTURE_BUDGET_MB=4096,VICTORY_RELAY=2,VICTORY_JOIN_COPIES=1,VICTORY_CARD_STEPS=2,dxcompiler.dll/dxil.dll1.9.2609 next to the executable:E5005)cs_6_0Seven host shaders were built by DXC in that run. No other local patches were applied.
Not in this PR
The two-plane composer and the Series S stretch exist only in forks; the same one-line call into
dxc::compilefixes them, and I can send that as a second PR if wanted.VICTORY_DXC=1is the only new switch; a path-valued version (a directory holding the two DLLs) is what a similar patch in another tree uses, and is easy to switch to if you prefer it.No game files, captures or logs are included; numbers only.
@YaBulochka on GitHub · 2026-11-26 11:02 UTC · original
Closing this: the fallback compiles, and the picture it gives is wrong.
What the DXC-built clamp does to the image
With the fallback in place the world draws at the rate reported above, but characters come out with axis-aligned rectangles of another surface over their skin, hair and clothes (a decoration-bake atlas, blurred frame content). They stay put while the camera holds still and only change when new content streams in, i.e. the arguments the clamp resolves are wrong for part of the indirect clusters, not a texture that has not arrived yet.
Ruled out over several runs: placed-texture keys (#502), placed-alias sources (#1150), remap coherence (#1156),
VICTORY_BAKE_SOURCES=1,VICTORY_LEVELS_ON_DEMAND=0, a 12 GB texture budget, and a bare environment with none of the local switches.What works instead
Microsoft's own
d3dcompiler_47.dll, x64 and x86, copied into the prefix over Wine's vkd3d-shader build, withd3dcompiler_47=ninWINEDLLOVERRIDESand nodxcompiler.dllnext to the executable:D3DCompileas on Windows;E5005, no dropped indirect execution;Retail 1.0.2.1, RX 7600 XT 8 GB, RADV (Mesa 27.0.0), Wine 11.22, vkd3d-proton from master, a fork of
f6a09d3with local switches (VICTORY_TEXTURE_BUDGET_MB=4608,VICTORY_CARD_BUFFERS_MB=1024): 1,794 draws a frame, 6.6 of 8.2 GB of VRAM, median 294 ms over 7 world frames while the scene was still streaming.So the Wine story belongs in the README rather than in the tree: on a host without Microsoft's compiler the clamp cannot be built, and building it with DXC yields a wrong image. The same DLL swap is what
Impre-visible/victory-gtx1660documents for its Linux configuration.No game files, captures or logs are included; numbers only.
Pull request closed