Files
larp/docs/linux.md
Oğuz Sivrikaya 908a1ca601 fix(linux): upgrade outdated D3D shader compiler
- Upgrade the known 2013 compiler from Microsoft SDK after verifying its hash.
- Warn about the outdated DLL and document shader model 5.1 failures.
2026-12-06 01:57:39 +03:00

127 lines
7.8 KiB
Markdown

# Running larp on Linux (Proton / Wine)
`larp.exe` compiles on Linux as a Windows `x86_64-pc-windows-msvc` binary via `cargo-xwin`, then runs through `umu-launcher` and Steam Proton (`vkd3d-proton`).
## Proprietary and Copyrighted Files
This repository contains **zero** game files, Windows system DLLs, MSVC/Windows SDK redistributables, or GPU vendor binaries. You must supply your own:
- **Game files**: your own Xbox Series title directory (for example, `game_scarlett_master.exe` and its archives).
- **Proton**: installed locally through Steam (`Proton - Experimental` recommended).
- **Windows cross-compilation SDK**: downloaded locally at build time by `cargo-xwin` into your user cache (never committed to the repo).
- **Native `d3dcompiler_47.dll`**: fetched locally into your Proton prefix at setup time via `winetricks` (`linux/setup.sh`). If winetricks installs the known 2013 version, setup upgrades its 64-bit DLL from Microsoft's Windows SDK because it cannot compile shader model 5.1.
- **Optional NVIDIA DLSS / AMD FSR DLLs**: `nvngx_dlssg.dll` / `nvngx_dlssd.dll` come from your installed NVIDIA driver's Wine directory, while `nvngx_dlss.dll` (or AMD FidelityFX DLLs) must be supplied from your own game or SDK copy.
Runtime caches, saves, logs, and the Proton prefix are always kept outside the repository because of `.larp-root` (`~/.local/share/larp` and `~/.cache/larp` by default, or `LARP_HOME` if configured).
---
## Requirements
### Nix / NixOS (`devenv`, `direnv`, or `nix develop`)
The included [devenv.nix](../devenv.nix), [devenv.yaml](../devenv.yaml), [.envrc](../.envrc), and [flake.nix](../flake.nix) provide every non-Rust build and runtime dependency (`cargo-xwin`, unwrapped `clang-cl`, `lld-link`, `dxc`, `umu-run`, `winetricks`, `cabextract`, `shellcheck`). You only need `rustup` with the toolchain from [rust-toolchain.toml](../rust-toolchain.toml) and `x86_64-pc-windows-msvc`:
```bash
rustup toolchain install 1.98.1 --profile minimal --target x86_64-pc-windows-msvc
```
Choose whichever workflow you prefer:
- **`devenv`**: run `devenv shell` in the repository root, or invoke the bundled commands (`larp-build`, `larp-setup`, `larp-run`, `larp-check`).
- **`direnv`**: run `direnv allow` once so entering the repository directory loads `devenv` automatically (falling back to `use flake` when `devenv` is not installed).
- **`nix develop` / scripts directly**: the scripts under `linux/` automatically enter `nix develop` when `nix` is installed and any tool is missing (set `LARP_NO_NIX_AUTO=1` to disable).
### Arch / Fedora / Debian & Ubuntu
Install the cross-compile and Proton runtime dependencies with your package manager:
- **Arch Linux**: `pacman -S clang lld llvm cargo-xwin directx-shader-compiler umu-launcher winetricks cabextract`
- **Fedora**: `dnf install clang lld llvm cargo-xwin directx-shader-compiler umu-launcher winetricks cabextract`
- **Debian / Ubuntu**: install `clang`, `lld`, `llvm`, `winetricks`, `cabextract`, `umu-launcher` (or Steam runtime), `cargo install cargo-xwin`, and `dxc` from the DirectXShaderCompiler releases.
- **All distros**: install the pinned Rust target via `rustup toolchain install 1.98.1 --profile minimal --target x86_64-pc-windows-msvc`.
Install **Proton - Experimental** through Steam (or set `PROTONPATH=/path/to/proton`). On X11/Wayland multi-GPU systems (e.g., Intel/AMD iGPU + discrete NVIDIA), ensure Vulkan ICDs are installed for your discrete GPU.
---
## Quickstart
1. **Cross-compile `larp.exe` and replacement DXIL shaders:**
```bash
./linux/build.sh --install-toolchain
```
Pass `--diag` for diagnostics builds or `--tracy` for Tracy builds.
2. **Prepare runtime directories, Proton prefix, native `d3dcompiler_47.dll`, and NVIDIA DLSS links:**
```bash
./linux/setup.sh
```
If using NVIDIA DLSS upscaling, pass `--dlss-dir /path/to/folder/with/nvngx_dlss.dll` (or copy `nvngx_dlss.dll` into `~/.local/share/larp/dlss/`). Run `./linux/setup.sh --check` at any time for a read-only status summary.
3. **Launch the title:**
```bash
./linux/run.sh /path/to/game/game_scarlett_master.exe
```
Full output is written to `play.log` inside your data directory and streamed to the terminal (`--no-tail` disables streaming; `--dry-run` skips `--execute`).
---
## Persistent Configuration (`~/.config/larp/linux.env`)
Copy [linux/config.example.env](../linux/config.example.env) to `~/.config/larp/linux.env` to store your local game path, custom data directory (`LARP_HOME`), Proton path, or preferred `LARP_*` defaults without modifying tracked files:
```bash
mkdir -p ~/.config/larp
cp linux/config.example.env ~/.config/larp/linux.env
```
Once configured, you can start the game simply with:
```bash
./linux/run.sh
```
`linux/run.sh` automatically exposes non-standard directories (and any resolved symlink targets, such as external DLSS DLLs) to Proton's `steamrt4` container via `PRESSURE_VESSEL_FILESYSTEMS_RW`.
---
## GPU & Driver Notes
### NVIDIA
- Enables `PROTON_FORCE_NVAPI=1`, `VKD3D_FILTER_DEVICE_NAME=NVIDIA`, `DXVK_FILTER_DEVICE_NAME=NVIDIA`, and persistent NVIDIA GL/Vulkan shader caches outside the repo.
- Enables `LARP_UPSCALER=dlss`, `LARP_UPSCALER_SCALE=balanced`, and `LARP_REFLEX=boost` when `nvngx_dlss.dll` is present, plus `LARP_FRAME_GENERATION=2x` (`LARP_FRAME_GENERATOR=dlss`) when `nvngx_dlssg.dll` is linked.
- `VKD3D_CONFIG=pipeline_library_app_cache` keeps compiled pipelines in `larp`'s own disk cache instead of duplicating them in `vkd3d-proton.cache`.
### AMD
- Defaults `AMD_VULKAN_ICD=RADV`.
- If you supply `amd_fidelityfx_loader_dx12.dll` and point `LARP_FSR_PATH` at its folder (as a `Z:\...` Windows path), `linux/run.sh` enables FSR upscaling automatically.
---
## First-Run Shader Pre-Warming & Controls
- **Two-stage pipeline pre-warming**: on a cold first launch, `larp` pre-warms roughly `~60,000` startup pipelines while holding title input on the landing screen (`Compiling pipelines` bar at the top). Press **Cross (`X`) / `A` / `Enter`** after input unlocks to start loading, which triggers a second render-phase batch (`~23,500` pipelines). Both batches cache to disk for fast subsequent launches.
- **Overlays & windowing**:
- `F9`: Toggle performance overlay.
- `F10`: Toggle live `larp` settings menu (writes to `settings.ini`).
- `Alt+Enter`: Toggle borderless fullscreen (`LARP_DISPLAY_MODE=borderless` can also be used safely at startup).
- **Controllers & KB+M**: DualSense/DualShock 4 controllers work natively over Bluetooth/USB HID; once a controller button is pressed, keyboard-to-pad fallback steps aside automatically.
---
## Troubleshooting
- **Host ray tracing disabled / shader compile errors**: run `./linux/setup.sh` to install the native Microsoft `d3dcompiler_47.dll`. Wine's builtin may fail on `RWByteAddressBuffer::Load4`; the old 2013 Microsoft DLL can instead fail with `X3506: unrecognized compiler target 'cs_5_1'` or `vs_5_1`. Setup recognizes that exact old version and upgrades it to Windows SDK 10.0.28000.2705, saving the original as `d3dcompiler_47.dll.old-2013`. Other native DLL versions are left untouched. Check `play.log` for `host ray tracing: on` after starting the game; DLL presence alone does not confirm shader compilation.
- **`int3` / `0x80000003` crash at startup with custom resolution**: leave `LARP_RESOLUTION` unset on Series X builds. The title allocates a fixed 64 MiB 4K backbuffer arena and asserts if lower resolutions leave too much of that arena unused; `larp` scales the window automatically.
- **Blank/frozen window under X11 compositors (`picom`, etc.) or tiling WMs**: toggle fullscreen with your window manager or `Alt+Enter` so the compositor unredirects the swap chain window.
- **Debugging stalls or black frames**: launch with `LARP_STALL_S=5` (dumps all thread stacks on stalls) or `LARP_CAPTURE=/tmp/larp-capture` (saves presented PNGs), e.g. `LARP_STALL_S=5 ./linux/run.sh`.