Introducing vk-sync rust crate
in Graphics on Rust, Vulkan
Through many discussions about pitfalls and gotchas with Tobias Hector about Vulkan synchronization, it was pretty clear that there was an opportunity to simplify synchronization patterns into something more approachable and less error-prone. Tobias created a C++ implementation based on our discussions, and this library was used successfully on some of our internal projects at SEED (i.e. PICA PICA).
Available on crates.io.
In an effort to make Vulkan synchronization more accessible, this library provides an efficient simplification of core synchronization mechanisms such as pipeline barriers and events.
Rather than the complex maze of enums and bit flags in Vulkan - many combinations of which are invalid or nonsensical - this library collapses this to a much shorter list of ~40 distinct usage types, and a couple of options for handling image layouts.
Additionally, these usage types provide an easier mapping to other graphics APIs like DirectX 12.
There are a number of Vulkan ffi bindings available, and I do plan to support the most common bindings, but for now this library only implements support for
ash. Please add other bindings you need via a pull-request; I would happily accept it.
Here’s a list of known things you cannot express:
Execution only dependencies cannot be expressed. These are occasionally useful in conjunction with semaphores, or when trying to be clever with scheduling - but their usage is both limited and fairly tricky to get right anyway.
Depth/Stencil Input Attachments can be read in a shader using either
ImageLayout::DepthStencilReadOnlyOptimal- this library always uses
ImageLayout::DepthStencilReadOnlyOptimal. It is possible (though highly unlikely) when aliasing images that this results in unnecessary transitions.
To use this crate, add the following to your
[dependencies] vk-sync = "0.1.0"
Also, add this to your crate root:
extern crate vk_sync;