Repository navigation
Wine/Proton: root signatures made in code, clamps Wine's compiler builds, loop latches and a large pipeline stack - #10
Merged
Conversation
Under Wine, D3DCompile is vkd3d-shader's compiler. It refuses both clamp shaders (no Load/Interlocked* methods on RWByteAddressBuffer, no [allow_uav_condition]), so every indirect draw was dropped and the world did not render. Both clamps now write through RWStructuredBuffer<uint> indexed in words (the same bytes), call Interlocked* as functions, and drop [allow_uav_condition]. Their root signatures are serialized here, as Wine's compiler embeds none. Ported from fxceless/victory-fork#1011, as described in Belobug/VIctory-Belobug-AMD#183. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
vkd3d-proton's DXIL conversion (dxil-spirv) keeps one back edge per loop header, as DXC's code has. With several, it takes the others for forward edges and recurses without end over the cycle that makes (in programs with wave shuffles). Under Wine the stack overflow then hangs the thread, and with it the process (seen here as a deadlock on the heap lock). Before writing, Module::single_latches sends the back edges of a header with several through one new block that joins their phi values. Ported from Marvisak/VIctory#1885 (d48ec767, by powplusplus); see also Marvisak/VIctory#2754. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
vkd3d-proton converts DXIL on the thread that creates the pipeline, recursively over its control flow. The largest ray-tracing passes overflow the default 2 MiB, and under Wine the overflow hangs the thread instead of failing. The pipeline workers now get 256 MiB, reserved only. Ported from Marvisak/VIctory#1885 (5aa10e54, by powplusplus), without its change to the offline translate command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
Under Wine, D3DCompile is vkd3d-shader's compiler, which embeds no [RootSignature] in the blob, so CreateRootSignature on the vertex shader's bytes failed (E_FAIL). The composer was never made and only the base plane was shown: a black screen in the Series S profile. The root signature (two SRVs at t0 for the pixel shader, a linear clamping sampler at s0) is now serialized here, and D3DCompile's errors are logged instead of dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
…ake passes here
Under Wine, D3DCompile is vkd3d-shader's compiler, which ignores
[RootSignature] and embeds none, so CreateRootSignature on the shader's
bytes failed (E_FAIL) and three of our passes were never made:
- the stand-in for the indirect light ("no stand-in for the indirect
light"): everything out of direct light much too dark
- the depth plane drawn from its twin ("no pipeline to draw a depth plane
from its twin"): those depth planes stayed as they were
- the keep-awake pass ("the card is not kept awake")
`rootsig::make` serializes what each shader's RS string describes, with
that string's default flags. The ambient pass also tests NaN and
infinity by their exponent bits, since Wine's compiler has no
isnan/isinf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five fixes for running under Wine/Proton. Without them, the Series S profile shows a black screen on Linux. With them, the world renders and every one of our helper passes is made.
Most of these come down to one difference: under Wine,
D3DCompileis vkd3d-shader's compiler. It ignores[RootSignature]and embeds none in the blob, soCreateRootSignature(0, <shader bytes>)fails withE_FAIL(0x80004005). It also lacks some methods and intrinsics that Microsoft's compiler has.What changes
Two-plane composer (
compose.rs). Its root signature is now serialized in code, andD3DCompile's errors are logged instead of dropped. Before, the composer was never made, so in the Series S profile only the base plane was shown: a black screen (two-plane composer not made; showing base plane only, 2,915 times in one run).Ambient, depth-plane and keep-awake passes, via a new
rootsig.rs.rootsig::makeserializes what each shader's RS string describes, with the defaults a version 1.1 RS string gets. It's used by:no stand-in for the indirect light): without it, everything out of direct light is much too dark. Its shader also testedisnan/isinf, which Wine's compiler lacks (E5005: Function "isnan" is not defined). It now tests the exponent bits instead, with the same result.no pipeline to draw a depth plane from its twin)the card is not kept awake)The HLSL keeps its
[RootSignature], so on Windows the shaders are unchanged; only where the root signature comes from differs.Indirect argument clamps (
indirect.rs,indirect/batch.rs). Wine's compiler refuses both (E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'), so every indirect draw was dropped. The written buffers becomeRWStructuredBuffer<uint>indexed in words, so they hold the same bytes.Interlocked*are called as functions,[allow_uav_condition]is dropped, and the root signatures are made in code. Ported from Indirect: the argument clamp in a form Wine's HLSL compiler builds too fxceless/victory-fork#1011, as described in Wine: the clamp and the window check do not compile there, so every indirect draw is dropped (working form + benchmark) Belobug/VIctory-Belobug-AMD#183.One back edge per loop header (
emit/bitcode.rs,emit/shader.rs), ported from Shaders, GPU: one back edge per loop header, and a large stack for pipeline threads Marvisak/VIctory#1885 (d48ec767). vkd3d-proton's dxil-spirv recurses without end on loop headers with several back edges. Under Wine the stack overflow hangs the thread instead of failing; in one run here it held the process heap lock and froze the whole process. The upstream unit test is included.256 MiB stack for the pipeline workers (
pipeline/make.rs,emit/mod.rs), ported from Shaders, GPU: one back edge per loop header, and a large stack for pipeline threads Marvisak/VIctory#1885 (5aa10e54). Only reserved. The largest ray-tracing passes overflow 2 MiB even without the endless recursion. The upstream change to the offlinetranslatecommand is left out.Items 3–5 are the same changes as Belobug/VIctory-Belobug-AMD#245.
Testing
Linux (Arch, kernel 7.2), Radeon 8050S (Strix Halo, RDNA 3.5, 512 MB carve-out, 32 GB RAM), RADV / Mesa 26.2.6, GE-Proton11-14 (vkd3d-proton 3.2), Series S profile, the launcher's
pareto-residencysettings, no ray tracing:f4b48ad(main)isnanrefusedmainnever got past the black screen here, so it didn't reach the clamps or the loop latches. The "before" for items 3–5 is from builds of other forks on the same machine, with the same code in those places: the clamps were refused (no argument clamp: indirect execution dropped), and there were 2–5 stack overflows in pipeline creation, once followed by the heap-lock freeze. With these changes, neither showed up in any run.Not covered:
0x218), and a few hundred indirect executions a frame are dropped. I didn't look into either.x86_64-pc-windows-gnufrom Linux. On Windows the root signatures made in code describe what the RS strings did, but I haven't run them there.cargo check --testspasses; 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) wrote and ported the changes, ran the tests on my machine and wrote this description; I reviewed it.
🤖 Generated with Claude Code