Wine: clamps Wine's HLSL compiler builds, one back edge per loop header, a large stack for pipeline workers #245
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/Belobug--VIctory-Belobug-AMD!245
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-245"
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?
@simon0302010 on GitHub · 2026-11-26 10:54 UTC · original
wine-clamps-and-loop-latches→rx9070xt· +544 −83 · 9 files · 4 commits · closed without mergingThree fixes for running under Wine/Proton. Together they take the title from a freeze while loading to the world rendering on Linux.
1. Indirect clamps that Wine's HLSL compiler builds (#183)
Under Wine,
D3DCompileis vkd3d-shader's compiler. It refuses both the argument clamp (indirect.rs) and the batched clamp (indirect/batch.rs):So every indirect draw was dropped. This uses the rewrite described in #183 (from fxceless/victory-fork#1011), applied to both clamps:
RWStructuredBuffer<uint>indexed in words, so the bytes written are the same; the budget's diagnostics stay at the old byte offsets 4/8/12/16 (words 1–4)Interlocked*are called as functions on the word[allow_uav_condition]is droppedroot_signature(), because Wine's compiler embeds none from[RootSignature]Strides, argument offsets and the batch table's places are multiples of 4: D3D12 requires it, and
Table::placechecks it.This complements #243 (DXC fallback). That PR changes the same function (
make_from), so whichever is merged second needs a small rebase. With this one,D3DCompilesucceeds under Wine, so the fallback wouldn't be reached for the clamps.2. One back edge per loop header (port of Marvisak/VIctory#1885,
d48ec767)vkd3d-proton's DXIL conversion (dxil-spirv) keeps one back edge per loop header. With several, it recurses without end. Under Wine that stack overflow doesn't fail the pipeline, it hangs: here the overflowing thread was holding the process heap lock, so the whole process froze:
Module::single_latchessends a header's back edges through one new block that joins their phi values, as DXC's output has. It runs right beforewrite()inShader. The upstream unit test is included, placed at the end ofbitcode.rs'smod tests.3. 256 MiB stack for the pipeline workers (port of Marvisak/VIctory#1885,
5aa10e54)PIPELINE_STACKis 256 MiB, only reserved. The largest ray-tracing passes overflow the default 2 MiB even without the endless recursion. Only thevictory-pipelines-Nworkers get it. The upstream change to the offlinetranslatecommand is left out.Both ports needed manual merging; neither upstream patch applied cleanly here.
Testing
Linux (Arch, kernel 7.2), Radeon 8050S (Strix Halo, RDNA 3.5), RADV / Mesa 26.2.6, GE-Proton11-14 (vkd3d-proton 3.2), Series X profile, the same save, before and after:
81ebb7b)Not covered:
indirect execution dropped (first time for this signature)). The clamp itself builds now; I didn't look into why these are dropped.x86_64-pc-windows-gnufrom Linux. On Windows,D3DCompileshould take the rewritten clamps the same way, but I haven't run them there.cargo check --tests -p victory-shader), but I couldn't run the GPU or shader tests here.No game files, captures or screenshots are included.
AI use: Claude Code (Claude Opus 5.5) ported the changes, ran the before/after tests on my machine and wrote this description; I reviewed it.
🤖 Generated with Claude Code
@gut0to on GitHub · 2026-11-26 16:22 UTC · original · reviewed
AI-assisted review. I inspected the CFG rewrite and its added unit test statically; I did not run shader tests or a Wine/game build. This review suggests one focused control-flow shape to cover.
@ -552,0 +563,4 @@/// for a forward edge and then recurses without end over the cycle that/// makes (in programs with wave shuffles). The back edges of a header/// with several go through a new block that joins their phi values.pub fn single_latches(&mut self) {@gut0to on GitHub · 2026-11-26 16:22 UTC · original
AI-assisted review; I did not run tests. Could the CFG test also include nested loop headers where both loops have multiple back edges and header phis? The current fixture verifies one header with two latches; a nested case would exercise the per-header rewrite order and ensure the inner latch phi remains a valid incoming value for the outer loop after both blocks are split.
Pull request closed