Wine/Proton: root signatures made in code, clamps Wine's compiler builds, loop latches and a large pipeline stack #10

Manually merged
github merged 5 commits from gh-pr/10/head into gh-pr/10/base 2026-11-27 06:06:31 +00:00
Owner

@⁠simon0302010 on GitHub · 2026-11-26 13:06 UTC · original
simon0302010:wine-fixes → main · +453 −50 · 12 files · 5 commits · merged 2026-11-26 15:21 UTC

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, D3DCompile is vkd3d-shader's compiler. It ignores [RootSignature] and embeds none in the blob, so CreateRootSignature(0, <shader bytes>) fails with E_FAIL (0x80004005). It also lacks some methods and intrinsics that Microsoft's compiler has.

What changes

  1. Two-plane composer (compose.rs). Its root signature is now serialized in code, and D3DCompile'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).

  2. Ambient, depth-plane and keep-awake passes, via a new rootsig.rs. rootsig::make serializes what each shader's RS string describes, with the defaults a version 1.1 RS string gets. It's used by:

    • the stand-in for the indirect light (no stand-in for the indirect light): without it, everything out of direct light is much too dark. Its shader also tested isnan/isinf, which Wine's compiler lacks (E5005: Function "isnan" is not defined). It now tests the exponent bits instead, with the same result.
    • the depth plane drawn from its twin (no pipeline to draw a depth plane from its twin)
    • keep-awake (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.

  3. 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 become RWStructuredBuffer<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 fxceless/victory-fork#1011, as described in Belobug/VIctory-Belobug-AMD#183.

  4. One back edge per loop header (emit/bitcode.rs, emit/shader.rs), ported from 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.

  5. 256 MiB stack for the pipeline workers (pipeline/make.rs, emit/mod.rs), ported from Marvisak/VIctory#1885 (5aa10e54). Only reserved. The largest ray-tracing passes overflow 2 MiB even without the endless recursion. The upstream change to the offline translate command 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-residency settings, no ray tracing:

f4b48ad (main) + 1, 3–5 + all five
composer not made, black screen made made
ambient / depth plane / keep-awake — (never reached) all three not made, isnan refused all made
world reached no (≤ 10 draws/frame) yes yes
draws per frame in the world (mean) — 2,148 1,588
frame rate in the world (median) — 2.4 fps 2.4 fps

main never 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:

  • Frame rate. On this iGPU, a world frame is almost all CPU-side preparation (copies and texture uploads), with only tens of milliseconds on the GPU. These patches aren't about that.
  • Remaining drops. About 100–200 draws a frame are still dropped for want of a pipeline (a creation method that isn't implemented, slot 0x218), and a few hundred indirect executions a frame are dropped. I didn't look into either.
  • Windows/MSVC. I built with x86_64-pc-windows-gnu from Linux. On Windows the root signatures made in code describe what the RS strings did, but I haven't run them there.
  • Tests. cargo check --tests passes; 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

**@⁠simon0302010** on GitHub · 2026-11-26 13:06 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/10) `simon0302010:wine-fixes` → `main` · +453 −50 · 12 files · 5 commits · merged 2026-11-26 15:21 UTC 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, `D3DCompile` is vkd3d-shader's compiler. It **ignores `[RootSignature]` and embeds none in the blob**, so `CreateRootSignature(0, <shader bytes>)` fails with `E_FAIL` (0x80004005). It also lacks some methods and intrinsics that Microsoft's compiler has. ## What changes 1. **Two-plane composer** (`compose.rs`). Its root signature is now serialized in code, and `D3DCompile`'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). 2. **Ambient, depth-plane and keep-awake passes**, via a new `rootsig.rs`. `rootsig::make` serializes what each shader's RS string describes, with the defaults a version 1.1 RS string gets. It's used by: - the stand-in for the indirect light (`no stand-in for the indirect light`): without it, everything out of direct light is much too dark. Its shader also tested `isnan`/`isinf`, which Wine's compiler lacks (`E5005: Function "isnan" is not defined`). It now tests the exponent bits instead, with the same result. - the depth plane drawn from its twin (`no pipeline to draw a depth plane from its twin`) - keep-awake (`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. 3. **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 become `RWStructuredBuffer<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 fxceless/victory-fork#1011, as described in Belobug/VIctory-Belobug-AMD#183. 4. **One back edge per loop header** (`emit/bitcode.rs`, `emit/shader.rs`), ported from 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. 5. **256 MiB stack for the pipeline workers** (`pipeline/make.rs`, `emit/mod.rs`), ported from Marvisak/VIctory#1885 (`5aa10e54`). Only reserved. The largest ray-tracing passes overflow 2 MiB even without the endless recursion. The upstream change to the offline `translate` command 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-residency` settings, no ray tracing: | | `f4b48ad` (main) | + 1, 3–5 | + all five | |---|---|---|---| | composer | not made, black screen | made | made | | ambient / depth plane / keep-awake | — (never reached) | all three not made, `isnan` refused | **all made** | | world reached | no (≤ 10 draws/frame) | yes | yes | | draws per frame in the world (mean) | — | 2,148 | 1,588 | | frame rate in the world (median) | — | 2.4 fps | 2.4 fps | `main` never 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: - **Frame rate.** On this iGPU, a world frame is almost all CPU-side preparation (copies and texture uploads), with only tens of milliseconds on the GPU. These patches aren't about that. - **Remaining drops.** About 100–200 draws a frame are still dropped for want of a pipeline (a creation method that isn't implemented, slot `0x218`), and a few hundred indirect executions a frame are dropped. I didn't look into either. - **Windows/MSVC.** I built with `x86_64-pc-windows-gnu` from Linux. On Windows the root signatures made in code describe what the RS strings did, but I haven't run them there. - **Tests.** `cargo check --tests` passes; 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](https://claude.com/claude-code)
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ck4nRpEBizbYrjNarbDQc4
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 06:06:31 +00:00
github manually merged commit 601a003b28 into gh-pr/10/base 2026-11-27 06:06:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.