Crate vulkano

source ·
Expand description

Safe and rich Rust wrapper around the Vulkan API.

Brief summary of Vulkan

  • The VulkanLibrary represents a Vulkan library on the system. It must be loaded before you can do anything with Vulkan.

  • The Instance object is the API entry point, and represents an initialised Vulkan library. This is the first Vulkan object that you create.

  • The PhysicalDevice object represents a Vulkan-capable device that is available on the system (eg. a graphics card, a software implementation, etc.). Physical devices can be enumerated from an instance with Instance::enumerate_physical_devices.

  • Once you have chosen a physical device to use, you can create a Device object from it. The Device is the most important object of Vulkan, as it represents an open channel of communication with a physical device. You always need to have one before you can do interesting things with Vulkan.

  • Buffers and images can be used to store data on memory accessible by the GPU (or more generally by the Vulkan implementation). Buffers are usually used to store information about vertices, lights, etc. or arbitrary data, while images are used to store textures or multi-dimensional data.

  • In order to show something on the screen, you need a Surface and a Swapchain. A Swapchain contains special Images that correspond to the content of the window or the monitor. When you present a swapchain, the content of one of these special images is shown on the screen.

  • For graphical operations, RenderPasses and Framebuffers describe which images the device must draw upon.

  • In order to be able to perform operations on the device, you need to have created a pipeline object that describes the operation you want. These objects are usually created during your program’s initialization. Shaders are programs that the GPU will execute as part of a pipeline. Descriptor sets can be used to access the content of buffers or images from within shaders.

  • To tell the GPU to do something, you must create a command buffer. A command buffer contains a list of commands that the GPU must perform. This can include copies between buffers and images, compute operations, or graphics operations. For the work to start, the command buffer must then be submitted to a Queue, which is obtained when you create the Device.

  • Once you have built a command buffer that contains a list of commands, submitting it to the GPU will return an object that implements the GpuFuture trait. GpuFutures allow you to chain multiple submissions together and are essential to performing multiple operations on multiple different GPU queues.

Re-exports

pub use half;
pub use library::LoadingError;
pub use library::VulkanLibrary;

Modules

Location in memory that contains data.
Commands that the GPU will execute (includes draw commands).
Bindings between shaders and the resources they access.
Communication channel with a physical device.
All the formats supported by Vulkan.
Image storage (1D, 2D, 3D, arrays, etc.) and image views.
API entry point.
Vulkan library loading system.
Device memory allocation and memory pools.
Describes a processing operation that will execute on the Vulkan device.
Gather information about rendering, held in query pools.
Description of the steps of the rendering process, and the images used as input or output.
How to retrieve data from a sampled image within a shader.
A program that is run on the device.
Link between Vulkan and a window and/or the screen.
Synchronization on the GPU.

Macros

Takes a BufferSlice that points to a struct, and returns a BufferSlice that points to a specific field of that struct.
Implements the Vertex trait on a struct.
Builds a RenderPass object whose template parameter is of indeterminate type.
Builds a RenderPass object whose template parameter is of indeterminate type.
Expression that returns a loader that assumes that Vulkan is linked to the executable you’re compiling.
Converts a format enum identifier to a type that is suitable for representing the format in a buffer or image.

Structs

Properties of an extension in the loader or a physical device.
A helper type for non-exhaustive structs.
Used in errors to indicate a set of alternatives that needs to be available/enabled to allow a given operation.
Represents an API version of Vulkan.

Enums

Error type returned by most Vulkan functions.
An enumeration of runtime errors that can be returned by Vulkan.

Traits

Alternative to the Deref trait. Contrary to Deref, must always return the same object.
Gives access to the internal identifier of an object.

Type Definitions

Represents memory size and offset values on a Vulkan device. Analogous to the Rust usize type on the host. https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkDeviceSize.html