Crates.io | maia |
lib.rs | maia |
version | 0.1.1 |
source | src |
created_at | 2022-06-24 20:09:25.405713 |
updated_at | 2022-07-11 07:53:24.248332 |
description | Safe low-level Vulkan bindings |
homepage | https://github.com/danielkeller/maia |
repository | https://github.com/danielkeller/maia |
max_upload_size | |
id | 612595 |
size | 465,047 |
Safe, low-level Vulkan bindings. The general properties of this library are
&mut
rather than with mutexes, to avoid performance surprises.Send
and Sync
.Maia dynamically links to the system's Vulkan loader, so one must be installed. Instructions for specific systems follow.
To begin using the API, create an instance object with vk::Instance::new
.
To enable validation layers for debugging, set the environment variable VK_INSTANCE_LAYERS="VK_LAYER_KHRONOS_validation"
or use the Configurator GUI.
To build, install your distro's Vulkan development libaries (eg for Debian, sudo apt install libvulkan-dev
). You will also probably want to install the validation layers, either from the distro (eg sudo apt install vulkan-validationlayers
) or by installing the Vulkan SDK.
To run, a Vulkan-compatible graphics driver should suffice.
To build, install the Vulkan SDK, and enable the "System Global Files" option during installation.
To run, you will probably want to include the Vulkan loader and MoltenVK into your .app bundle. Full instructions are available here, and an example can be found in the demo/
directory.
A Vulkan-compatible graphics driver is sufficient to build and run. You will probably want to install the Vulkan SDK for validation layers, though.
To compile shaders in the demos, either CMake or the Vulkan SDK must be installed. (CMake appears to be the easier approach on Linux, and the Vulkan SDK on other systems.)
This documentation assumes that you already know how Vulkan works. If you're just getting started, I can recommend the Vulkan Guide, the Vulkan Tutorial, or the older, but more detailed API without Secrets. The code that they walk you through will look very similar to the demo
and hello-triangle
examples in this repo, so you can look at those alongside the walkthroughs to see what the corresponding Rust functions are called.
Maia does not try to protect the contents of your buffers, images, and shader variables, since these values don't have invalid bit patterns and in particular don't contain pointers. Instead, it prevents incorrect API usage where the consequences could "escape" into the rest of your program, for example use-after-free of Vulkan objects, or out of bounds accesses in RAM buffers. In this way, Maia's memory safety experience is akin to talking to a C program on the other end of a network connection. The implication of this is that Maia does not enforce every "the application must not" statement in the Vulkan spec, since the spec does not distinguish between these different kinds of misuse. The safety it provides is instead in regards to the behavior of actual Vulkan implementations.