2 unstable releases
0.1.0 | Jan 26, 2023 |
---|---|
0.0.1 | Nov 25, 2022 |
0.0.0 |
|
#804 in #graphics
22 downloads per month
1MB
9K
SLoC
Blade
Blade is a low-level GPU library in Rust with the focus on ergonomics. It's unsafe, it's incomprehensive, but it's small, fast, and actually fun to prototype with!
See motivation, FAQ, and performance for more info.
Platforms
The backend is selected automatically based on the host platform.
Vulkan:
- Desktop Linux/Windows
- Android
Metal:
- Desktop macOS
- iOS
OpenGL ES:
- Web
Instructions
Check:
cargo check
Run the minimal example:
cargo run --example mini
OpenGL ES
GLES is also supported at a basic level. It's enabled for wasm32-unknown-unknown
target, and can also be force-enabled on native:
RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo test
This path can be activated on all platforms via Angle library.
For example, on macOS it's sufficient to place libEGL.dylib
and libGLESv2.dylib
in the working directory.
WebGL2
Following command will start a web server offering the bunnymark
example:
cargo run-wasm --example bunnymark
Vulkan Portability
First, ensure to load the environment from the Vulkan SDK:
cd /opt/VulkanSDK && source setup-env.sh
Vulkan backend can be forced on using "vulkan" config flag. Example invocation that produces a vulkan (portability) build into another target folder:
RUSTFLAGS="--cfg vulkan" CARGO_TARGET_DIR=./target-vk cargo test
Dependencies
~5–9.5MB
~181K SLoC