Skip to content

Linux: build leonida.exe and run it under Proton or Wine - #2577

Closed
shadowplay711 wants to merge 13 commits into
ProjectLeonida:mainfrom
shadowplay711:fix/linux-install-and-launch
Closed

shadowplay711 wants to merge 13 commits into
ProjectLeonida:mainfrom
shadowplay711:fix/linux-install-and-launch

Conversation

@shadowplay711

Copy link
Copy Markdown

What and why

On Linux, PLAY runs scripts/play-linux.sh, which only looked for leonida.exe beside itself, and nothing in a checkout built it: ./Build.sh builds the Vulkan loader, not d3d12/. The script also started the system's wine with Wine's own dxgi.dll (on wined3d), which crashed the game when it created its swap chain; docs/boot.md requires DXVK's dxgi.dll. Under Proton the picture then stayed black: the two-plane composer and the trainer menu took their root signatures from a [RootSignature] shader attribute that Wine's d3dcompiler_47 (vkd3d-shader) ignores (W5302: Ignoring unknown attribute "RootSignature"), so CreateRootSignature failed with E_FAIL, the composer was never made and only the base plane was presented. The runtime is now built on Linux, runs under any installed Proton build or the system's Wine with DXVK's dxgi.dll and a VKD3D-Proton that has dxil-spirv's new structurizer, presents both planes and can write its output to a log file.

  • scripts/build-d3d12-linux.sh (new): cross-builds leonida.exe with cargo-xwin and fetches VKD3D-Proton and DXVK's dxgi.dll into d3d12/target/. It stops before any download unless XWIN_ACCEPT_LICENSE=1 accepts Microsoft's SDK licence.
  • scripts/fetch_dxvk.py (new): fetches the 64-bit dxgi.dll of DXVK 3.1.1 with its licence and a source note, checked against pinned SHA-256 sums.
  • scripts/play-linux.sh:
    • Finds the runtime, VKD3D-Proton and DXVK beside itself or under d3d12/target/. Its errors name the command that builds or fetches them.
    • Uses LEONIDA_PROTON, else LEONIDA_WINE, else the usable Proton build with the highest version, else wine on PATH. Every folder with files/bin/wine counts as a Proton build, whatever its name, in the Steam folders (including Flatpak, Snap, libraryfolders.vdf and STEAM_EXTRA_COMPAT_TOOLS_PATHS) and the system's compatibilitytools.d; it is usable when it also has files/lib/wine, and LEONIDA_PROTON naming another one is refused with the reason. Without any Proton or Wine it stops and says what to install. --find-proton prints the Proton or Wine it would use, --list-protons every usable build.
    • Runs a Proton build's Wine with its library paths. Takes DXVK's dxgi.dll from that Proton or, when it has none and under the system's Wine, from LEONIDA_DXVK, the package, the distribution's DXVK or another Proton. Copies it into the prefix and sets dxgi=n.
    • Makes or updates the prefix with the same Wine when it changes or the prefix lacks the Proton's vkd3d libraries. VKD3D-Proton's shader cache goes to the Leonida cache folder.
    • When the bundled d3d12core.dll has no new structurizer, uses VKD3D-Proton from the Proton in use or, if that one lacks it too (such as proton-cachyos 11.0-20261015), from another installed Proton build that has one. The start banner names the Wine, the DXVK and the VKD3D-Proton in use.
    • --log writes the output to ~/.local/share/leonida/logs/play-MMdd-HHmmss.log, beside the prefix, and keeps the five newest logs.
  • d3d12/crates/leonida-gpu/src/host.rs: root_signature serializes a root signature from parameters and static samplers with D3D12SerializeVersionedRootSignature as version 1.1, the version the HLSL compiler builds for a [RootSignature] attribute, and creates it.
  • d3d12/crates/leonida-gpu/src/compose.rs: the descriptor table of two SRVs at t0 (pixel stage, range flag DATA_STATIC_WHILE_SET_AT_EXECUTE) and the linear, clamping static sampler at s0 are described in code with the values the attribute declared; the attribute and its #define are removed from the shader source.
  • d3d12/crates/leonida-gpu/src/host/trainer.rs: eight root constants at b0 and a descriptor table of one SRV at t0, described the same way; the attribute and its #define are removed.
  • Launcher: PLAY checks for a Proton or Wine first and starts the script with --log when chosen. Settings has a Proton or Wine list (Linux only) with the usable Proton builds, highest version first, and "System Wine"; the first entry is the default. Browse picks another Proton folder, and a line below the list appears only when that folder cannot be used. On Linux the logs and captures folders are under ~/.local/share/leonida, the same folder as the prefix. Tools, Rebuild the runtime runs the new build script on Linux after a licence confirmation. Windows behavior of the launcher is unchanged.
  • Tests: tests/test_play_linux.py (new) runs the script against Proton folders and a Wine it creates; tests/test_leonida_launcher.py covers the Proton or Wine setting, the list entries, the Linux data folders and the Linux commands.
  • Docs: docs/linux.md, docs/launcher.md, docs/boot.md.

Tested

  • python -I tests/test_play_linux.py, python -I tests/test_leonida_launcher.py, python -I tests/test_shell_launchers.py: pass.
  • scripts/play-linux.sh --list-protons lists GE-Proton11-14, Proton Experimental, proton-cachyos 11.0-20261015 and dwproton-11.0-17, and leaves out an incomplete Proton-Wineland folder (no files/lib/wine).
  • Built leonida.exe with scripts/build-d3d12-linux.sh and started it from the launcher under GE-Proton11-14 on CachyOS Linux, RX 9070 XT, Mesa 26.3.1-arch3.5: both planes are presented, the trainer menu opens.

GPUs tested: n/a (the GPU tests in runtime/test were not run)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code

scripts/build-d3d12-linux.sh builds leonida.exe with cargo-xwin and
fetches VKD3D-Proton and DXVK's dxgi.dll (scripts/fetch_dxvk.py, DXVK
3.1.1, SHA-256 pinned). play-linux.sh finds leonida.exe in a checkout
and runs it under the usable Proton build with the highest version, else
under the system's Wine (LEONIDA_PROTON and LEONIDA_WINE choose). Every
folder with files/bin/wine and files/lib/wine in the Steam and system
folders counts as a usable Proton build. DXVK's dxgi comes from that
Proton or, when it has none and under the system's Wine, from
LEONIDA_DXVK, the package, the distribution or another Proton. It keeps
the prefix in sync with the Wine in use, takes a VKD3D-Proton with the
new dxil-spirv structurizer from any installed Proton build, keeps the
shader cache out of the repo and can write stderr to a log file (--log).
--find-proton prints the Proton or Wine it would use and --list-protons
every usable Proton build.

The launcher's Proton or Wine setting on Linux lists the usable Proton
builds, highest version first and the first as the default, and "System
Wine", with Browse for another folder; a line below appears only when
that folder cannot be used. Tools runs the Linux build script, and PLAY
passes --log on Linux.

The present composer and the trainer menu build their root signatures in
code, serialized as version 1.1, instead of from a [RootSignature]
shader attribute that Wine's d3dcompiler ignores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The header of scripts/play-linux.sh names the Proton builds it runs under,
DXVK's dxgi.dll and the --log, --find-proton and --list-protons options.
The SAFETY comment of the trainer pipeline no longer says the root
signature is inside the shader blobs, since it is now built in code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed c99f7d131 merged locally with main c1ecf04ed. On Ubuntu 22.04 under WSL2, using synthetic Proton/Wine fixtures, all 70 checks passed across test_play_linux.py (42), test_leonida_launcher.py (21), and test_shell_launchers.py (7). Both shell scripts pass dash -n, and the changed files pass check_no_game_data.py.

One additional fixture reproduced the launch issue below. Coverage here is the launcher and shell paths with stub Wine processes.

AI-assisted.

Comment thread scripts/play-linux.sh Resolved
@shadowplay711
shadowplay711 deleted the fix/linux-install-and-launch branch November 28, 2026 15:58
A Proton build with only files/lib64/wine counted as usable, but its
DXVK dxgi.dll and VKD3D-Proton were looked for only under files/lib, and
WINEDLLPATH and LD_LIBRARY_PATH named only files/lib. play-linux.sh now
looks for both under files/lib and files/lib64 (with and without the
x86_64-windows folder), puts files/lib64/wine, files/lib64/vkd3d and
files/lib64 first in the paths and checks both for the prefix's vkd3d
libraries. Tests cover a Proton with only files/lib64, one with both and
the older layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shadowplay711
shadowplay711 restored the fix/linux-install-and-launch branch November 28, 2026 16:05
@shadowplay711 shadowplay711 reopened this Nov 28, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 28, 2026
The launcher's settings keep both the new Windows options of main
(series_s, dlss_mode, frame_gen, aspect, present_scale, adapter,
background) and the Linux proton_dir setting with SYSTEM_WINE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 28, 2026

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 32ae9bf82 (including f1113352 and the main merge) and re-tested on Ubuntu under WSL2.

Code audit:

  • scripts/play-linux.sh: proton_dxvk, proton_new_vkd3d, WINEDLLPATH, LD_LIBRARY_PATH, and the prefix libvkd3d-1.dll check now handle both files/lib and files/lib64 (with lib64 ordered first and older non-x86_64-windows layouts supported).
  • tests/test_play_linux.py: the 5 new fixtures cover lib64-only, both-roots ordering, and old-layout DXVK/VKD3D-Proton discovery.

Verification (Ubuntu under WSL2, synthetic Proton/Wine fixtures):

  • dash -n scripts/play-linux.sh: passed.
  • python3 -I tests/test_play_linux.py -v: 47/47 passed (1.62 s).
  • python3 -I tests/test_leonida_launcher.py -v: 23/23 passed (0.14 s).
  • python3 -I tests/test_shell_launchers.py -v: 7/7 passed (0.09 s).
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

@merzleckeier

merzleckeier commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

I verified this PR at 32ae9bf82bb9fbcc8319f2762e5f2e2dcdb068fb on a desktop RTX 4070 SUPER (12 GiB), NVIDIA 620.73.04, CachyOS (kernel 7.3.6-3), and system Wine 11.22. Both offline Series S runs used vkd3d-proton 71cae091 and DXVK DXGI 3.1.1-97-ga78a467cadb22be-pcos from the distro's Proton-CachyOS. Mandy, vkd3d, and driver caches started cold in separate state directories.

  • With baseline 27130ea23 and only DXVK DXGI added, the 1920 × 1080 host swapchain opened and the original Wine DXGI crash was gone. The two-plane compositor failed with E_FAIL, leaving the base-plane fallback.
  • At the PR head, the 1920 × 1080 swapchain composited both planes with the overlay active. The window had visible output and I stopped the run after 117 seconds. This check was limited to startup and presentation.

One test issue on a system with Proton installed. test_an_old_layout_proton_dxvk_under_lib64_is_used lets normal discovery run, so the system-wide Proton-CachyOS outranks the proton-5.13-6 fixture and starts its own wineboot. I reproduced the failure with just this test. The complete file passed with the system Proton directory hidden (46 passed, 1 skipped). Explicitly selecting the fixture with self.run_script(str(self.game), LEONIDA_PROTON=str(proton)) also made the focused case pass on the same machine. Other tests already cover automatic discovery. Affected test

CachyOS retest at 7ff494f3c. I kept the system Proton-CachyOS installation visible. The old-layout DXVK case still failed at 32ae9bf82, and it passed at 7ff494f3c. The full launcher file improved from 36 passed, 1 failed, 10 skipped to 37 passed, 0 failed, 10 skipped. test_leonida_launcher.py had 22 passed and 1 skipped, and test_shell_launchers.py had 7 passed. This confirms the fixture-selection fix on the affected host. The retest used temporary launcher fixtures offline.

AI-assisted with Codex.

The test let the normal Proton search run, so a Proton installed on the
machine ranked above the proton-5.13-6 fixture, was started instead and
failed the test. The test now sets LEONIDA_PROTON to its fixture; the
search itself is covered by the other tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Windows 11 + RTX 3090 D3D12 & WARP Verification (7ff494f3cf)

Verified commit 7ff494f3cf345c523738a46edded871d23fe9632 merged cleanly onto main (1bc055e6c2) on Windows 11 (x86_64-pc-windows-msvc) with physical NVIDIA GeForce RTX 3090 (Ampere, D3D12 driver 610.88) and WARP under the D3D12 debug layer (LEONIDA_D3D12_DEBUG=1).

Red -> Green Summary

  • Red (main 1bc055e6c2): python -I tests/test_leonida_launcher.py -> FAILED (failures=2, errors=5, skipped=3).
  • Green (7ff494f3cf + main 1bc055e6c2):
    1. D3D12 v1.1 Root Signature Serialization (compose.rs, host.rs::root_signature, host/trainer.rs):
      • LEONIDA_D3D12_DEBUG=1 cargo test --locked -p leonida-gpu --features diagnostics --lib -- --nocapture --test-threads=4 compose:
        • RTX 3090 (610.88): 3/3 passed (D3D12 display-plane readback RGBA: [127, 0, 0, 255, 64, 127, 0, 255, 0, 0, 255, 255], 0 D3D12 debug-layer errors).
        • WARP (LEONIDA_D3D12_WARP=1): 3/3 passed (D3D12 display-plane readback RGBA: [128, 0, 0, 255, 64, 128, 0, 255, 0, 0, 255, 255], 0 D3D12 debug-layer errors).
      • LEONIDA_D3D12_DEBUG=1 cargo test --locked -p leonida-gpu --features diagnostics --lib -- --nocapture --test-threads=4 trainer:
        • RTX 3090 (610.88): 4/4 passed (the_overlay_draws_the_menu_offscreen rendered cleanly, 0 D3D12 debug-layer errors).
        • WARP (LEONIDA_D3D12_WARP=1): 4/4 passed (0 D3D12 debug-layer errors).
      • cargo clippy --locked -p leonida-gpu --features diagnostics --lib --tests: 0 warnings in touched files.
    2. Launcher, Cross-Platform Guards, & Repo Hygiene on Windows 11:
      • python -I tests/test_leonida_launcher.py: 20 passed, 3 POSIX /bin/sh tests cleanly skipped (OK (skipped=3)).
      • python -I tests/test_play_linux.py: 47 Linux-host tests cleanly skipped (OK (skipped=47)).
      • python -I tests/test_ci_registration.py (18 OK), python -I tests/test_runner_calls_all_tests.py (3 OK), python -I tests/test_docs_encoding.py (1 OK), python -I tests/test_text_write_line_endings.py (3 OK), python -I scripts/check_no_game_data.py (0 issues), and git diff --check all passed cleanly.

No Windows regressions found.

AI-assisted.

@OreoFR

OreoFR commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Verified by OreoFR

  • Base: main 54d27d988 + PR head f1113352a (tested at f1113352a, head is now 7ff494f3c)
  • Test: not run (merge conflict with main)
  • Red on main: not run
  • Green with the PR: not run
  • Verdict: CONFLICT (conflicts with main in tools/leonida_launcher.py. On an older main it merged: red 2 failures + 5 errors, green 21 OK (3 skipped); test_play_linux is skipped on Windows (POSIX shell script), to test on Linux; compose.rs and trainer.rs change the composer/F4 menu root signatures, so a game run is needed after the rebase)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

@merzleckeier

Copy link
Copy Markdown
Contributor

One additional launcher edge case on 7ff494f3c (tested merged with a9e247cd6; the merge also resolves cleanly against e1d87a4a). vkd3d-proton documents VKD3D_SHADER_CACHE_PATH=0 as the switch to disable its internal shader cache. The new mkdir -p treats it as a path and creates a literal 0 in the caller's directory. From a read-only working directory it exits 1 before Wine is invoked.

A synthetic Wine fixture reproduced both cases. Preparing the Leonida cache/data directories unconditionally and calling mkdir -p "$VKD3D_SHADER_CACHE_PATH" only when its value differs from 0 fixed both. Wine still received the literal 0, and the default directory and an explicit path containing spaces still worked. With a regression case added, test_play_linux.py ran 48 tests with one skip in the isolated fixture environment. No game files used. AI-assisted with Codex.

vkd3d-proton reads VKD3D_SHADER_CACHE_PATH=0 as the switch that turns its
shader cache off. The launcher created the folder for every value, so with
0 it made a folder named 0 in the working directory, and from a read-only
working directory mkdir failed and the launcher stopped before Wine ran.
The Leonida cache and data folders are still created; the shader cache
folder only when the value is not 0. Wine still gets the 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@timbot103 timbot103 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static audit of 0299208f3 against 48bae6cad. Both shell scripts passed syntax checks. Real Wine, cross-build, and GPU verification are covered by the earlier reports on their stated revisions.

  • scripts/play-linux.sh:364 — Installing DXGI with cp can overwrite the target of a prefix DLL symlink or abort on a dangling link. Stage and atomically replace the prefix DLL entry for each of the three DLLs.
  • scripts/play-linux.sh:365 — Wine honors the last duplicate override. Appending inherited overrides lets an existing dxgi=b defeat the required DXVK selection. Put the required native rules last.
  • scripts/build-d3d12-linux.sh:35 — Pin the output directory passed to Cargo or resolve its configured path. A custom target directory currently leaves the build check looking at a missing or stale executable.
  • scripts/build-d3d12-linux.sh:60 — A failed late license download leaves a DLL that makes the next rebuild skip the fetch. Publish complete DXVK and VKD3D bundles and check completion before skipping.
  • tools/leonida_launcher.py:223 — Selecting the first named Proton can still use an inherited runner override. Give automatic selection its own entry and store the actual runner for named choices.
  • scripts/play-linux.sh:206 — Clear CDPATH before resolving relative paths. A nonempty search entry can put two lines into the Proton path.

AI-assisted.

… last

play-linux.sh stages each of d3d12.dll, d3d12core.dll and dxgi.dll beside
its prefix entry and renames it into place, so a symlinked entry is
replaced instead of its target being overwritten, and a dangling one no
longer stops the start. The required native overrides now follow any
inherited WINEDLLOVERRIDES, because Wine keeps the last rule for a DLL
and an inherited dxgi=b would otherwise win over DXVK. CDPATH is
cleared, so a relative LEONIDA_PROTON resolves to one folder.

build-d3d12-linux.sh passes --target-dir d3d12/target to Cargo, so a
custom CARGO_TARGET_DIR or build.target-dir no longer leaves the check
looking at a missing or stale leonida.exe. fetch_dxvk.py and
fetch_vkd3d_proton.py fetch every file before writing any and write
SOURCE.txt last; the build script fetches again unless the DLLs, the
license files and SOURCE.txt are all there.

The launcher's Proton or Wine list gets its own "Automatic" entry, and
each named Proton stores its folder, so choosing the newest one by name
no longer leaves an inherited LEONIDA_PROTON or LEONIDA_WINE in charge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 628f5bffd (0299208f3 + 628f5bffd).

All follow-up items are cleanly addressed:

  • scripts/play-linux.sh: leaves VKD3D_SHADER_CACHE_PATH=0 untouched without creating a literal 0 directory, clears CDPATH, stages and atomically replaces prefix DLLs (install_dll, safe against symlinks and dangling links), and appends d3d12,d3d12core,dxgi=n after inherited WINEDLLOVERRIDES.
  • scripts/build-d3d12-linux.sh: passes --target-dir "$d3d12/target" and checks complete bundle files including SOURCE.txt.
  • tools/leonida_launcher.py: adds an explicit Automatic entry and clears inherited LEONIDA_WINE when a named Proton folder is selected.

Local verification (Windows 11, Python 3):

  • python -I tests/test_leonida_launcher.py -v: 21 tests ran, OK (3 skipped: POSIX shell script tests).
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

@merzleckeier

Copy link
Copy Markdown
Contributor

I isolated the Series S compositor changes from 628f5bffd on main 7b907de52, using only the changes to compose.rs and its root-signature helper in host.rs. Both offline Series S starts used the same launcher, copies of the same warm caches, Wine 11.22, VKD3D-Proton 71cae091, and DXVK DXGI on an RTX 4070 SUPER (NVIDIA 620.73.04, CachyOS).

  • Main repeatedly returned E_FAIL while creating the two-plane compositor (2,649 fallback messages). Sampling the D3D12 readback before Present showed the same black or nearly uniform image as Gamescope.
  • With the two compositor hunks, two-plane composition was active on frame 1, with zero fallback messages. The Series S menu/controller prompts were visible in the compositor output. Both runs closed normally. Open-world play remains unverified.
  • The existing compiler fixture passed on both versions. The existing scaled premultiplied-plane render/readback test failed at Composer creation on stock main and passed with the hunks on both RTX 4070 SUPER and Radeon 610M (RADV 26.3.1). The GPU fixtures used synthetic textures and no game files.

AI-assisted with OpenAI Codex (GPT-6).

@kuzeyc

kuzeyc commented Nov 29, 2026

Copy link
Copy Markdown

Tested this branch at 628f5bf on NVIDIA under Proton: it gets into the world.

Machine: RTX 3070 8 GB, NVIDIA 610.57.04 (kernel 6.18.65-lts), Ryzen 5 7600X, Arch Linux. Proton Hotfix (hotfix-20261110), picked by play-linux.sh by itself; GE-Proton11-15 and Proton Experimental also installed. Fresh LEONIDA_WINEPREFIX. leonida.exe from build-d3d12-linux.sh (diag, diagnostics,mimalloc) with cargo-xwin.

  • tests/test_play_linux.py 51 OK (1 skipped), tests/test_build_d3d12_linux.py 6 OK, tests/test_leonida_launcher.py 24 OK.
  • build-d3d12-linux.sh built leonida.exe and fetched VKD3D-Proton 3.1 and DXVK 3.1.1.
  • play-linux.sh: "with DXVK's dxgi and the VKD3D-Proton of hotfix-20261110-x86_64 (vkd3d-1.1-5729-g00b6ef057)". No swap-chain crash.
  • The structurizer check matters on NVIDIA: on main with VKD3D-Proton 3.1, every run on this card died in vkCreateComputePipelines (0xc0000005, on 620.73.04 and 610.57.04 alike) at the same early moment, whatever shaders were skipped. With this branch it got past that and into the world on foot.
  • The first run is very slow: 0.1 fps with ~10 s a frame "waiting for pipelines" (black screen, sound plays) while about 1,200 pipelines built, then about 1.5 fps. A pipeline pre-build step like play-d3d12.ps1's would help here.
  • It ended after about 14 minutes on a breakpoint in the title, "unhandled exception 0x80000003 at <title image>+0x5149aec". It isn't the watchdog hook's address. Card memory was 5.4 of 5.9 GB budget at the end. Not investigated.

Not tested: the system-Wine path (LEONIDA_WINE), the distribution-DXVK lookup.

AI-assisted (Claude Code).

@merzleckeier

Copy link
Copy Markdown
Contributor

Independent launcher check at 628f5bffd merged locally onto c22a0a732. I ran the unchanged play-linux.sh against a synthetic Windows x64 client with System Wine 11.22 and cachyos-11.0-20261015-slr, each on AMD Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04). In all four runs with initialized prefixes, the client received the path containing spaces, the Series S profile, and VKD3D_SHADER_CACHE_PATH=0 from a read-only working directory. The three native prefix DLLs matched their sources, --log captured stderr, and a fenced D3D12 copy returned 1,024/1,024 expected words each time. Two extra RADV warm starts on tmpfs covered file, dangling, and directory symlinks and preserved their targets.

Concurrent-start failure reproduced. Two starts using the same initialized prefix stage d3d12.dll.leonida-new under a shared name. With a controlled overlap between the two copies, the second start failed with mv: cannot stat ...d3d12.dll.leonida-new before reaching Wine. Private staging directories let both starts finish in the regression test. The fork diff includes the fix and the test. The new test fails on this PR head, and all 82 tests pass with the fix.

These runs used offline synthetic inputs. Headless Gamescope on NVIDIA exited with status 139 during teardown, after the launcher had already returned 0. AI-assisted with OpenAI Codex (GPT-6).

install_dll copied every DLL to one fixed name beside it in system32
(d3d12.dll.leonida-new) before moving it into place. Two starts on the
same prefix shared that name: the second removed or overwrote the
first's copy, and the first stopped with "mv: cannot stat" before Wine
ran. Each copy now goes into a folder of its own made with mktemp in
the same system32, so the move stays a rename on one file system and
the folder is removed after it.

A test holds the first start inside its copy of d3d12.dll, runs a
second start on the same prefix to the end, then lets the first finish:
both succeed, the prefix has the current DLLs and no staging entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kuzeyc

kuzeyc commented Nov 29, 2026

Copy link
Copy Markdown

Small follow-up on c2ffcdc: the DLL staging change looks fine, and tests/test_play_linux.py passes (52, 1 skipped), but only after I moved my build output aside.

With d3d12/target/dxvk present in the checkout (left by build-d3d12-linux.sh / fetch_dxvk.py), one test fails:

FAIL: test_a_proton_without_dxvk_runs_with_the_dxgi_of_another
AssertionError: "with DXVK's dxgi of GE-Proton98-30" not found in "... with the bundled DXVK's dxgi (DXVK 3.1.1) ..."

The Proton tests run the real script (tests/test_play_linux.py:350, SCRIPT = ROOT / "scripts" / "play-linux.sh"), so its $root is the real checkout, and find_dxgi takes "$root/d3d12/target/dxvk" before it looks at other Protons. The tests that copy play-linux.sh into a temporary repo (line 95) don't have this problem. Running the Proton tests from such a copy too, or pointing LEONIDA_DXVK at a temporary folder there, would keep them from depending on what the checkout has built.

With d3d12/target/dxvk moved aside: all 52 pass. AI-assisted (Claude Code).

The Proton tests ran scripts/play-linux.sh from the checkout, so the
script looked for its bundled DXVK, VKD3D-Proton and leonida.exe in
the checkout's scripts/ and d3d12/target/. A d3d12/target/dxvk left by
build-d3d12-linux.sh or fetch_dxvk.py was taken before another Proton's
dxgi.dll and made test_a_proton_without_dxvk_runs_with_the_dxgi_of_another
fail. Each Proton test now copies the script into its temporary folder,
as the other play-linux.sh tests do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kuzeyc

kuzeyc commented Nov 30, 2026

Copy link
Copy Markdown

@eodclxvi thanks, your finding 1 is the same bug as #2654, which I opened last night (claim: #2570 (comment)). Same fix: a null blob for the empty library through the raw vtable call, plus a log line where make(&[]).ok()? used to drop the error. merzleckeier's A/B there (RTX 4070 SUPER and RADV) shows a_rejected_blob_gives_an_empty_library, depth_bounds_pipeline_loads_and_filters_draws and a_mesh_pipeline_loads_from_the_library failing on main and passing with it. If you'd rather your own version went in, say so there, so we don't end up with two.

The VKD3D_CONFIG=pipeline_library_app_cache point isn't in #2654: that's launcher territory, so it would fit play-linux.sh here, @shadowplay711, if you want it in this PR. On my RTX 3070 (NVIDIA 610.57.04, Proton Hotfix) the null-blob fix alone gave a library that saves and reloads (loaded=34 made=0 on the second start), but I haven't measured with and without that setting, so I can't say yet how much it adds.

AI-assisted (Claude Code).

VKD3D-Proton treats VKD3D_SHADER_CACHE_PATH=0 like
VKD3D_CONFIG=pipeline_library_app_cache: it keeps no shader cache of its
own, and the D3D12 pipeline library stores the SPIR-V and the driver's
pipeline cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shadowplay711

Copy link
Copy Markdown
Author

Thanks. I'll leave finding 1 to #2654.

I've kept pipeline_library_app_cache out of play-linux.sh. In VKD3D-Proton it sets the same flag as VKD3D_SHADER_CACHE_PATH=0 (PIPELINE_LIBRARY_APP_CACHE_ONLY in device_workarounds.c, and vkd3d_pipeline_library_init_disk_cache returns early on it). That turns off VKD3D-Proton's own cache, which the script keeps in <LEONIDA_CACHE_DIR>/vkd3d-proton. With that cache on, the pipeline library is the dummy one from the VKD3D-Proton README, and your loaded=34 made=0 shows it already saves and reloads with #2654. If you want the app-cache-only mode, set VKD3D_SHADER_CACHE_PATH=0. The script passes it through, and 78ce620 documents this in docs/linux.md.

AI-assisted (Claude Code).

@kuzeyc

kuzeyc commented Nov 30, 2026

Copy link
Copy Markdown

@shadowplay711 the structurizer check in play-linux.sh picks an older VKD3D-Proton over a newer one here.

vkd3d_new_structurizer (scripts/play-linux.sh:120) looks for the string legacy_structurizer in d3d12core.dll. On this machine:

  • Proton Hotfix (hotfix-20261110), vkd3d-1.1-5729-g00b6ef057: has the string, so it is taken.
  • GE-Proton11-15, VKD3D-Proton v3.1-97-g71cae091b (files/lib/wine/vkd3d-proton/version): no longer has it, so it is passed over, also when LEONIDA_PROTON names GE-Proton11-15. The start line then reads "under GE-Proton11-15 … with … the VKD3D-Proton of hotfix-20261110".

With the Hotfix build, every start had 7 "stack overflow" lines in the first 10 s of pipeline building (all at the same address, in watch::install::on_write per leonida.pdb, the vectored handler that runs once the stack is already gone) and the overlay stuck at "7 LEFT", like your "6 LEFT" run. RUST_MIN_STACK=16777216 didn't help: the threads had 16 MB and still used all of it. With LEONIDA_VKD3D pointing at GE-Proton11-15's x86_64-windows folder: 0 stack overflows, nothing stuck, 57-60 fps in the world. That matches eodclxvi's note that 71cae091b's dxil-spirv fixes these overflows.

So the marker seems to have gone with the old structurizer, and the newest builds now look "old" to the check. Reading the build from the version file, or a marker only newer builds carry, might hold up better.

Separately, for the pipeline_library_app_cache question: I tried VKD3D_CONFIG=pipeline_library_app_cache with Proton Hotfix's VKD3D-Proton, and the first start crashed in vkCreateComputePipelines (0xc0000005) on a compute shader that built fine twice in the default mode. So leaving it out of the script was right here.

RTX 3070 8 GB, NVIDIA 610.57.04, Arch Linux (kernel 6.18 LTS), #2577 at 919c0a9 plus #2654's fix. AI-assisted (Claude Code).

… newest

play-linux.sh took a d3d12core.dll as having dxil-spirv's new structurizer
only when it names the legacy_structurizer option. VKD3D-Proton v3.1-97
removed the legacy structurizer and with it that name, so the newest
builds, such as the one in GE-Proton11-15, were passed over as too old and
an older build of another Proton was taken instead.

The check now also reads the build: as v<major>.<minor>-<n>-g<commit> from
the DLL or the version file beside it, else as vkd3d-1.1-<n>-g<commit>, the
form Proton writes in that file (v3.1 is vkd3d-1.1-5686), else from the
release number the DLL carries. A build from v3.1-22 on, where the option
first appears, or a release from 3.2 on counts as having it.

When the bundled VKD3D-Proton lacks the new structurizer, the newest such
build among the Proton in use and the other Protons found is taken, the
Proton in use first among equal builds; a build known only by the option
name ranks as v3.1-22.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shadowplay711

Copy link
Copy Markdown
Author

@kuzeyc thanks, that was right: VKD3D-Proton v3.1-97 (71cae091b, "Remove the legacy structurizer entirely") took the legacy_structurizer name out with the legacy structurizer, so the check took the newest builds for old ones.

The check now reads the build too:

  • v<major>.<minor>-<n>-g<commit> from d3d12core.dll or the version file beside it (GE-Proton writes v3.1-83-gcae8353ed-GE-Proton into the DLL),
  • else vkd3d-1.1-<n>-g<commit>, the form Proton writes into files/lib/wine/vkd3d-proton/version; on VKD3D-Proton's master v3.1 is vkd3d-1.1-5686, so Proton Hotfix's vkd3d-1.1-5729-g00b6ef057 is v3.1-43 and 71cae091b is vkd3d-1.1-5783,
  • else the release number the DLL carries (3.1.0 for the bundled release).

A build counts as having the new structurizer when it still names the option or is v3.1-22 or later (the option came in with 3f6a2c71, v3.1-22), or is a release from 3.2 on. VKD3D-Proton 3.1 still does not.

When the bundled one lacks it, the script now takes the newest qualifying build among the Proton in use and the other Protons found, not the first one by Proton name, with the Proton in use first among equal builds. With your three builds that is GE-Proton11-15's v3.1-97 whether LEONIDA_PROTON is unset, GE-Proton11-15 or Proton Hotfix. The tests cover each version form and that choice, and docs/linux.md says how it works.

On pipeline_library_app_cache: thanks for trying it, it stays out of the script.

z3r0rc added a commit to z3r0rc/leonida that referenced this pull request Nov 30, 2026
Wine's builtin d3dcompiler (the vendored vkd3d-shader) refuses our runtime
HLSL helpers: RWByteAddressBuffer member methods fail E5005 and the
[RootSignature] attribute is dropped, so every world-fill pass dies silently
and the composite samples never-written planes - black world, UI fine.
Compile through DXC (*_6_0) on refusal or a missing RTS0 chunk, and build the
composer/trainer root signatures programmatically through
D3D12SerializeVersionedRootSignature v1.1 instead of the HLSL chunk. Same
direction as open upstream PRs ProjectLeonida#2642 and ProjectLeonida#2577; carried here so play windows
work while they sit unmerged.
z3r0rc added a commit to z3r0rc/leonida that referenced this pull request Dec 1, 2026
Wine's builtin d3dcompiler (the vendored vkd3d-shader) refuses our runtime
HLSL helpers: RWByteAddressBuffer member methods fail E5005 and the
[RootSignature] attribute is dropped, so every world-fill pass dies silently
and the composite samples never-written planes - black world, UI fine.
Compile through DXC (*_6_0) on refusal or a missing RTS0 chunk, and build the
composer/trainer root signatures programmatically through
D3D12SerializeVersionedRootSignature v1.1 instead of the HLSL chunk. Same
direction as open upstream PRs ProjectLeonida#2642 and ProjectLeonida#2577; carried here so play windows
work while they sit unmerged.
@z3r0rc

z3r0rc commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Measured Linux play baseline from one month of factory work (CachyOS host, RTX 4090, NVIDIA 620.73.04, host Wine 11.23, cross-build via cargo-xwin --target x86_64-pc-windows-msvc): the D3D12 runtime now plays the title at a stable 15-20 fps driving through towns and the highway with no fps drops. What it took, so others can skip the month:

Binaries that are load-bearing

Env set that differs from upstream defaults (everything else we keep at upstream defaults, including the ps1's LEONIDA_PAIRED_FOR / LEONIDA_SKIP_PIPELINES sets from 804280d80/0bc6e21a1 verbatim)

  • LEONIDA_PIPELINE_WAIT_MS=100 with LEONIDA_PIPELINE_WAIT_ONCE=0 — after the library loop works, the 500 ms default wait IS every remaining drop (spikes 300-590 ms = one first-encounter make each); 10000 froze frames into the title watchdog, 500 is stuttery. WAIT_ONCE=0 re-arms the wait every frame, which is what lets the world light as soon as the backlog drains (ONCE mode was a black-world cause).
  • LEONIDA_NULL_SAMPLER_LINEAR=1 — character faces (see my d3d12: give host sampler heaps every slot the shaders can reach (D3D12-GPU-SAMPLER-HEAP-2048) #2766 comment).
  • LEONIDA_STATIC_SAMPLERS_LINEAR=PS_Composite — older face-channel fix.
  • LEONIDA_ASYNC_SUBMIT=1 and LEONIDA_COPY_SCOPED=1 set once for the whole run (measured -15.4 % mean frame time, 6/6 mirror pairs negative); never flip either mid-window — only the mid-run ON->OFF flip poisons a run.
  • LEONIDA_CARD_RESERVE_BUDGETS=1 (Render-target reserve expires once the targets settle (LEONIDA_CARD_ROOM_FOR_TARGETS_SETTLE_MS, off by default) #2589 family, weak positive), LEONIDA_MAP_THREADS=1, LEONIDA_DYNAMIC_SLOTS=524288, LEONIDA_D3D12_DRED=faults, LEONIDA_CARD_SPANS=1 measurement-only.

Discipline that matters more than any switch

  • End windows with the window close, never a kill: a forced stop writes NEITHER the pipeline library NOR the NVIDIA driver cache (findings.md notes it), and a cold driver cache is 4.7x worse (273 vs 59 ms/frame median, true A/BBA).
  • Never prune the NVIDIA shader cache; the first run after cache loss is warm-up, not a verdict.
  • Expect a ~2 min entry backlog at world entry (translation queueing, not vkCreate); starting through the opening cinematic is free compile time. The library compounds per clean window: 448,760 -> 605,624 -> 641,336 bytes, and drops thin with it.
  • DLSS under plain Wine: nvngx_dlss.dll init refuses (0xbad00001, no NVAPI surface); interim arm is staging dxvk-nvapi nvapi64.dll.

Why the remaining 15-20 fps is winnable on CPU: with LEONIDA_CARD_SPANS=1, even 3 fps frames show 32-44 ms of card work and 136-166 ms of card idle between ~18 submissions — the GPU waits on us, not the reverse.

AI-assisted factory work; happy to upstream the launcher env defaults as a docs page if wanted.

@merzleckeier

Copy link
Copy Markdown
Contributor

Ran play-linux.sh through system Wine with a real offscreen D3D12 probe at 202b9652b + ed867d7b2. The actual shell entry point updated a disposable prefix, installed the selected DLLs, then launched a small Win64 probe with a synthetic path containing a space. The probe opened that placeholder path and created a real D3D12 device on AMD RADV (default Series S) and RTX 4070 SUPER (explicit Series X). It also verified that explicit LEONIDA_COPY_SCOPED=0 survived while LEONIDA_PORT_DESCRIPTORS defaulted to 1. All four installed DLLs matched the input files byte for byte. Across the three Python launcher/build suites there were 72 passes and 19 skips. The executed binary was a probe supplied via LEONIDA_RUNTIME, so the full runtime build and gameplay are outside this run.

AI-assisted with OpenAI Codex.

This was referenced Dec 1, 2026
@shadowplay711 shadowplay711 closed this by deleting the head repository Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.