Installation
Requirements
- Rust stable (recent version recommended)
- A supported GPU
Adding Goldy to Your Project
[dependencies]
goldy = "0.1"
Or with cargo:
cargo add goldy
Feature Flags
| Feature | Default | Description |
|---|---|---|
vulkan | yes | Vulkan 1.4+ backend (Linux, Windows) |
dx12 | yes | DirectX 12 backend (Windows) |
metal | yes | Metal Tier 2+ backend (macOS) |
instrumentation | yes | Structured tracing via tracing-subscriber (zero-cost when disabled) |
Platform-inappropriate features are no-ops — enabling metal on Linux or dx12 on macOS compiles cleanly but does nothing.
To build with only specific backends:
[dependencies]
goldy = { version = "0.1", default-features = false, features = ["vulkan"] }
Shader Toolchain
Goldy uses Slang as its shader language. The Slang compiler is bundled automatically via slang-rs — no separate SDK install is needed. Shaders are compiled at runtime to the appropriate target (SPIR-V, DXIL, or Metal IR).
Verifying Installation
use goldy::{Instance, DeviceType}; fn main() -> anyhow::Result<()> { let instance = Instance::new()?; println!("Available GPUs:"); for adapter in instance.enumerate_adapters() { println!(" {} ({:?})", adapter.name, adapter.device_type); } let device = instance.create_device(DeviceType::DiscreteGpu)?; println!("\nUsing: {}", device.adapter_info().name); Ok(()) }
cargo run
Expected output:
Available GPUs:
NVIDIA GeForce RTX 4060 Ti (DiscreteGpu)
Intel(R) UHD Graphics 770 (IntegratedGpu)
Using: NVIDIA GeForce RTX 4060 Ti
Backend Selection
Goldy selects the best backend for your platform automatically:
| Platform | Default Backend |
|---|---|
| Windows | DX12 |
| Linux | Vulkan |
| macOS | Metal |
Override at runtime with GOLDY_BACKEND:
GOLDY_BACKEND=vulkan cargo run
Platform-Specific Setup
Windows
DX12 is used by default and requires no additional setup. For the Vulkan backend, install the Vulkan SDK. Ensure your GPU drivers are up to date.
Linux
Install Vulkan development packages:
# Ubuntu/Debian
sudo apt install libvulkan-dev vulkan-tools
# Fedora
sudo dnf install vulkan-loader-devel vulkan-tools
# Arch
sudo pacman -S vulkan-icd-loader vulkan-tools
macOS
Goldy uses the native Metal backend — no MoltenVK or Vulkan SDK needed. Ensure macOS 12+ and Xcode command-line tools are installed:
xcode-select --install
Windowing (for examples)
The examples use winit for windowing:
[dev-dependencies]
winit = "0.30"
anyhow = "1.0"
Next Steps
- Your First Triangle — draw a colored triangle
- Your First Compute Shader — write pixels from compute