Crates.io | slang-hal |
lib.rs | slang-hal |
version | 0.1.1 |
created_at | 2025-09-20 08:52:43.696451+00 |
updated_at | 2025-09-20 09:29:42.024765+00 |
description | Abstractions for running Slang shaders with Rust. |
homepage | |
repository | https://github.com/dimforge/slang-hal |
max_upload_size | |
id | 1847547 |
size | 118,670 |
The slang-hal library provides abstractions for running slang shaders on any platform supported by the slang compiler.
Warning slang-hal is still very incomplete and under heavy development and is lacking a lot of features and backends.
In order to compile and run any slang project, be sure to define the SLANG_DIR
environment variable:
SLANG_DIR
environment variable: SLANG_DIR=/path/to/slang
.
Note that the variable must point to the root of the slang installation (i.e. the directory that contains bin
and lib
).
We recommend adding that as a system-wide environment variables so that it also becomes available to your IDE.slang-hal exposes a unified API for interacting with the GPU in a backend-agnostic way.
Backend | Shader compilation | Compute pipelines | Render pipelines | Buffer read/write | Non-Pod types | Indirect dispatch | GPU timestamps | Link-time specialization |
---|---|---|---|---|---|---|---|---|
WebGpu | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ |
Cuda | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
Vulkan | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Metal | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
DirectX | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
CPU | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
PyTorch | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
OptiX | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
OpenCL | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
slang-hal also provides utilities for:
cargo
. No need to deal with include paths).cargo build
, cargo check
, etc.)