Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Platform Support

Nightshade targets the platforms wgpu targets. Native Windows, Linux, and macOS, plus the web through WebGPU.

Supported Platforms

PlatformStatusBackendNotes
Windows 10/11Full SupportVulkan, DX12Primary development platform
LinuxFull SupportVulkanX11 and Wayland
macOSFull SupportMetalRequires macOS 10.13+
Web (WASM)Full SupportWebGPUModern browsers only

Windows

Requirements

  • Windows 10 version 1903 or later for DX12
  • Windows 10 version 1607 or later for Vulkan
  • A GPU with Vulkan 1.1 or DirectX 12 support

Graphics Backends

Windows picks a backend in this order:

  1. Vulkan for the broadest feature coverage
  2. DirectX 12 as the native Windows path
  3. DirectX 11 as the fallback for older hardware

Building

cargo build --release

Distribution

The executable is self-contained. Ship the assets folder next to it:

game/
├── game.exe
└── assets/
    ├── models/
    ├── textures/
    └── audio/

Linux

Requirements

  • X11 or Wayland
  • A GPU and driver supporting Vulkan 1.1
  • Ubuntu 20.04+, Fedora 33+, or Arch Linux are common starting points

Dependencies

Install the Vulkan development packages.

Ubuntu/Debian:

sudo apt install libvulkan1 vulkan-tools libvulkan-dev
sudo apt install libasound2-dev  # For audio feature

Fedora:

sudo dnf install vulkan-loader vulkan-tools vulkan-headers
sudo dnf install alsa-lib-devel  # For audio feature

Arch Linux:

sudo pacman -S vulkan-icd-loader vulkan-tools vulkan-headers
sudo pacman -S alsa-lib  # For audio feature

Building

cargo build --release

Wayland Support

winit picks between X11 and Wayland based on the environment. You can force one:

# Force X11
WINIT_UNIX_BACKEND=x11 ./game

# Force Wayland
WINIT_UNIX_BACKEND=wayland ./game

Distribution

Bundle as an AppImage or wrap the binary in a launcher script:

#!/bin/bash
cd "$(dirname "$0")"
./game

macOS

Requirements

  • macOS 10.13 (High Sierra) or later
  • A Metal-capable GPU. Most Macs from 2012 onwards qualify.

Building

cargo build --release

Code Signing

Sign the binary before distribution:

codesign --deep --force --sign "Developer ID Application: Your Name" target/release/game

App Bundle

The expected layout for a macOS app:

Game.app/
└── Contents/
    ├── Info.plist
    ├── MacOS/
    │   └── game
    └── Resources/
        └── assets/

Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleExecutable</key>
    <string>game</string>
    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.game</string>
    <key>CFBundleName</key>
    <string>Game</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.13</string>
</dict>
</plist>

Web (WebAssembly)

Requirements

  • A browser with WebGPU
  • Chrome 113+, Edge 113+, or Firefox 141+

Building

Install wasm-pack:

cargo install wasm-pack

Build the web bundle:

wasm-pack build --target web

HTML Template

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Game</title>
    <style>
        body { margin: 0; overflow: hidden; }
        canvas { width: 100vw; height: 100vh; display: block; }
    </style>
</head>
<body>
    <canvas id="canvas"></canvas>
    <script type="module">
        import init from './pkg/game.js';
        init();
    </script>
</body>
</html>

Limitations

The web build is constrained by what browsers expose.

FeatureStatus
RenderingSupported
InputSupported
AudioSupported (Web Audio)
GamepadSupported (Gamepad API)
PhysicsSupported
File SystemLimited, no direct disk access
ThreadsLimited, requires SharedArrayBuffer

Asset Loading

Assets have to be served over HTTP and fetched at runtime:

#![allow(unused)]
fn main() {
#[cfg(target_arch = "wasm32")]
async fn load_assets() {
    // Assets loaded via HTTP fetch
}
}

Cross-Compilation

Windows from Linux

Install the MinGW toolchain and target:

sudo apt install mingw-w64
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu

Linux from Windows

Use WSL2 or a Docker image:

# In WSL2
cargo build --release --target x86_64-unknown-linux-gnu

macOS Cross-Compilation

Cross-compiling to macOS needs the Apple SDK, which is awkward to source legally outside a Mac. The practical path is GitHub Actions macOS runners.

GPU Requirements

Minimum Requirements

FeatureRequirement
APIVulkan 1.1 / DX12 / Metal
VRAM2 GB
Shader Model5.0
FeatureRequirement
APIVulkan 1.2+
VRAM4+ GB
Shader Model6.0

Feature Support by GPU Generation

GPUBasic RenderingTessellationCompute Culling
Intel HD 4000+YesYesYes
NVIDIA GTX 600+YesYesYes
AMD GCN 1.0+YesYesYes
Apple M1+YesYesYes

Performance by Platform

Rough relative performance, higher is better.

PlatformPerformanceNotes
Windows (Vulkan)100%Best overall
Windows (DX12)95%A little more driver overhead
Linux (Vulkan)98%Matches Windows with good drivers
macOS (Metal)90%Different cost profile than Vulkan
Web (WebGPU)70%Browser and JS bridge overhead

Troubleshooting

Windows: "No suitable adapter found"

  • Update GPU drivers
  • Install the Vulkan Runtime
  • Force the DX12 backend with WGPU_BACKEND=dx12 ./game.exe

Linux: "Failed to create Vulkan instance"

  • Install Vulkan drivers for your GPU
  • Check that vulkaninfo runs
  • Verify the ICD loader sees them: ls /usr/share/vulkan/icd.d/

macOS: "Metal not available"

  • Update macOS to 10.13 or later
  • Check Apple Menu > About This Mac > System Report > Graphics for Metal support

Web: "WebGPU not supported"

  • Use Chrome 113+ or Edge 113+
  • Enable the WebGPU flag in browser settings if needed
  • Verify navigator.gpu exists in the browser console