Safe and rich Rust wrapper around the Vulkan API
See also vulkano.rs.
Vulkano is a Rust wrapper around the Vulkan graphics API. It follows the Rust philosophy, which is that as long as you don't use unsafe code you shouldn't be able to trigger any undefined behavior. In the case of Vulkan, this means that non-unsafe code should always conform to valid API usage.
What does vulkano do?
Comparison to other well-known Graphics APIs in Rust ecosystem.
| Name | Open-sourced Since | API Level | Notable Features | | ---- | ------------------ | --------- | ------------- | | Vulkano | March, 2016 | High-level Rust API wrapping Vulkan APIs. | Type-safe compile-time shaders. Transparent interoperability with glsl and spir-v shader code types in Rust code. Automatically generated types for shader's Layout. | | Wgpu-rs | May, 2019 | High-level Rust API with multiple backends. | Supports multiple backends: Vulkan, Metal, DirectX, WebGPU, and other. Follows WebGPU specification. With async/await API. | | Miniquad | March, 2020 | High-level minimalistic Rust API with multiple backends. | Relatively minimalistic API well suited for small to medium graphics projects. Supports multiple backends, including browser target. | | Sierra | March, 2021 | High-level Rust API for Vulkan/Metal APIs. | Layouts, Descriptors and shader Types construction in Rust code through the macro system. Built on top of Erupt. Supports Ray Tracing Pipeline. | | Glium | October, 2014 | High-level Rust API wrapping OpenGL | OpenGL only. | | Ash | August, 2016 | Low-level API for Vulkan. | Unsafe Vulkan API bindings. | | Erupt | April, 2020 | Low-level API for Vulkan. | Unsafe Vulkan API bindings. |
Please note that by the current date non of the known projects in the ecosystem(including Vulkano) reached stable release versions and the final design goals, their APIs are changing from time to time in breakable way too, and there could be bugs and unfinished features too.
However, most of the projects mentioned above are already established definitive structure, all feature breaking changes will likely be straight-forward to fix in user code, and most of them are maintained. As such we can recommend to start using any of them in the 3rd party code. The choice depends on the end project's goals and requirements, and we recommend examining actual set of their features and API capabilities beforehand.
We started collecting this list just recently, and will be appreciated if you help us by contributing(opening a PR) into README.md.
We would love to help you keep your project in sync with the most recent changes in Vulkano if you give us feedback by adding your project into this list.
Thanks in advance!
To get started you are encouraged to use the following resources:
Contributions are very welcome! Feel free to submit pull requests, to open questions and topics in the Issues section.
The project was initially developed by Pierre Krieger(Tomaka), who established Vulkano's base design goals, and the code structure. In the meantime development is driven by Vulkano community members.
New Pull Requests are usually scheduled for review by the end of each week. The older PRs that already in review have priority over the new ones. We are trying to push development forward as quick as possible, but the review process sometimes may take time, please be patient as the maintainers need time to check everything properly.
If something needs to get promoted urgently, please ping current Vulkano maintainer(@Eliah-Lakhin) in the PR's or Issue's comments.
If your change adds, removes or modifies a trait or a function, please add an entry to the changelog file(s) as part of your pull request.
Every PR must pass tests in order to be merged to
Minor releases are usually happening between 1 to 3 months averagely depending on grow of unreleased and breaking changes in
This repository contains four libraries:
vulkanois the main one.
shader!macro for compiling glsl shaders.
vulkano-winprovides a safe link between vulkano and the
winitlibrary which can create a window to render to.
vk-syscontains raw bindings for Vulkan. You can use it even if you don't care about vulkano.
In order to run tests, run
cargo test --allat the root of the repository. Make sure your Vulkan driver is up to date before doing so.
We would love to mention some members, who put significant contributions to this project: - Pierre Krieger. The initial developer. Patreon page. - Lucas Kent. Maintainer. Patreon page. - Austin Johnson. Maintainer. Patreon page. - Rua. An active developer, who put a lot of efforts to improve Vulkano and constantly keeping it up to date. - You! Thanks to your help, contributions, improvements, bug reports and use experience to make this project one of the major Rust graphics API library in Rust!
Vulkano uses shaderc-rs for shader compilation. Refer to shaderc-rs documentation to provide a pre-built libshaderc for faster build times.
Note that in general vulkano does not require you to install the official Vulkan SDK. This is not something specific to vulkano (you don't need the SDK to write programs that use Vulkan, even without vulkano), but many people are unaware of that and install the SDK thinking that it is required. However, macOS and iOS platforms do require a little more Vulkan setup since it is not natively supported. See below for more details.
Unless you provide libshaderc, in order to build libshaderc with the shaderc-sys crate, the following tools must be installed and available on
PATH: - CMake - Ninja Is optional except when building with MSVC. It may speed up build time for libshaderc. - Python (works with both Python 2.x and 3.x, on windows the executable must be named
These requirements can be either installed with your favourite package manager or with installers from the projects' websites. Below are some example ways to get setup.
rustup default stable-x86_64-pc-windows-msvc
pacman --noconfirm -Syu mingw-w64-x86_64-cmake mingw-w64-x86_64-python2 mingw-w64-x86_64-ninja
windows-gnu toolchain is not supported but you can instead cross-compile to windows-gnu from windows-msvc
Steps 1 and 2 are to workaround https://github.com/rust-lang/rust/issues/49078 by using the same mingw that rust uses.
rustup default stable-x86_64-pc-windows-msvc
rustup target install x86_64-pc-windows-gnu
pacman --noconfirm -Syu mingw64/mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-python2 mingw-w64-x86_64-ninja
--target x86_64-pc-windows-gnue.g. to run:
cargo run --target x86_64-pc-windows-gnu
Use your package manager to install the required dev-tools and vulkan drivers
For example on ubuntu:
sudo apt-get install build-essential git python cmake libvulkan-dev vulkan-utilsOn arch based system
sudo pacman -Sy base-devel git python cmake vulkan-devel --noconfirm
Vulkan is not natively supported by macOS and iOS. However, there exists MoltenVK an open-source Vulkan implementation on top of Apple's Metal API. This allows vulkano to build and run on macOS and iOS platforms.
On iOS, vulkano links directly to the MoltenVK framework. There is nothing else to do besides installing it. Note that the Vulkan SDK for macOS also comes with the iOS framework.
Licensed under either of * Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.