API referencestd/gpu

std/gpu/vulkan

Public declarations, types, methods, and source contracts for std/gpu/vulkan.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/gpu/vulkan"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
dylib std/dylib loader.dodo
mem core/mem loader.dodo
ptr core/ptr commands.dodo, loader.dodo

Generated declarations in commands.dodo

commands.dodo holds 275 public declarations generated by scripts/gen. They follow the naming rules in the library guide; read the source file for exact signatures.

LoadError

Enum · Source

Why the Vulkan loader could not be used.

pub enum LoadError {
    // No Vulkan loader or driver library was found.
    NotFound,
    // A library was found but does not export vkGetInstanceProcAddr.
    MissingEntryPoint,
}

load_error_name

Function · Source

pub fn load_error_name(error: LoadError) -> &str from(static)

Library

Struct · Source

The opened Vulkan loader. It stays loaded for the rest of the process, so the command tables resolved through it never dangle.

pub struct Library {
    // vkGetInstanceProcAddr, from which every other command is resolved.
    pub get_instance_proc_addr: PfnGetInstanceProcAddr
    // Private implementation fields omitted.
}

Library.entry

Function · Source

The global commands: vkCreateInstance and the instance-level queries.

pub fn entry(&self) -> EntryFns

Library.instance

Function · Source

The commands of instance. Unsafe: the instance must have been created through this library and must outlive every use of the table.

pub unsafe fn instance(&self, instance: Instance) -> InstanceFns

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

device_fns

Function · Source

The commands of device, resolved through its instance’s table. Unsafe: the device must belong to that instance and outlive every use of the table.

pub unsafe fn device_fns(instance: &InstanceFns, device: Device) -> DeviceFns

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

open

Function · Source

Open the system’s Vulkan loader: libvulkan.so.1 on Linux, vulkan-1.dll on Windows, and on macOS the Vulkan SDK or Homebrew loader (libvulkan.1.dylib), falling back to MoltenVK itself.

pub fn open() -> Library!LoadError

open_path

Function · Source

Open a specific Vulkan loader or driver library, such as a bundled copy of MoltenVK. name is NUL-terminated and searched for like dylib.open.

pub fn open_path(name: &[u8]) -> Library!LoadError

Error

Struct · Source

A failed Vulkan command: its negative (or unexpected) Result code.

pub struct Error {
    pub code: Result
}

Error.name

Function · Source

pub fn name(&self) -> &str from(static)

check

Function · Source

Turn a command’s Result into a Dodo Result: SUCCESS and the other non-negative status codes (such as INCOMPLETE or SUBOPTIMAL_KHR) succeed and are returned, negative error codes fail.

pub fn check(code: Result) -> Result!Error

make_api_version

Function · Source

A packed API version, as VK_MAKE_API_VERSION.

pub fn make_api_version(variant: u32, major: u32, minor: u32, patch: u32) -> u32

api_version_variant

Function · Source

pub fn api_version_variant(version: u32) -> u32

api_version_major

Function · Source

pub fn api_version_major(version: u32) -> u32

api_version_minor

Function · Source

pub fn api_version_minor(version: u32) -> u32

api_version_patch

Function · Source

pub fn api_version_patch(version: u32) -> u32

c_name

Function · Source

The text of a fixed-size, NUL-padded name field such as ExtensionProperties.extension_name, without the padding.

pub fn c_name(field: &[u8]) -> &[u8] from(field)

name_eq

Function · Source

Whether a NUL-padded name field holds name, which may itself end in a NUL like the *_EXTENSION_NAME constants.

pub fn name_eq(field: &[u8], name: &[u8]) -> bool

null_handle

Function · Source

A null dispatchable handle, such as null_handle::<InstanceT>() for an Instance that a create command will fill in. Non-dispatchable handles are u64 and null is NULL_HANDLE.

pub fn null_handle<T>() -> *mut T

NULL_HANDLE

Constant · Source

pub const NULL_HANDLE: u64 = 0

no_allocator

Function · Source

The null pAllocator argument of create and destroy commands, which selects the driver’s own allocator.

pub fn no_allocator() -> *const AllocationCallbacks

clear_color_float

Function · Source

A floating-point clear color, the float32 member of the C union.

pub fn clear_color_float(red: f32, green: f32, blue: f32, alpha: f32) -> ClearColorValue

clear_color_int

Function · Source

An integer clear color, the int32 member of the C union.

pub fn clear_color_int(red: i32, green: i32, blue: i32, alpha: i32) -> ClearColorValue

clear_color_uint

Function · Source

An unsigned clear color, the uint32 member of the C union.

pub fn clear_color_uint(red: u32, green: u32, blue: u32, alpha: u32) -> ClearColorValue

clear_value_color

Function · Source

A ClearValue for a color attachment.

pub fn clear_value_color(color: ClearColorValue) -> ClearValue

clear_value_depth_stencil

Function · Source

A ClearValue for a depth/stencil attachment.

pub fn clear_value_depth_stencil(depth: f32, stencil: u32) -> ClearValue

zeroed

Function · Source

A value with every byte zero, such as an array of structs for a command to fill in: unsafe { vk.zeroed::<[16]vk.QueueFamilyProperties>() }. Unsafe: all-zero bytes must be a valid T. They are for every Vulkan struct, handle and command table (integers, floats and null pointers), and arrays of them, but not for Dodo references, slices or enums.

pub unsafe fn zeroed<T>() -> T

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

Generated declarations in types.dodo

types.dodo holds 2307 public declarations generated by scripts/gen. They follow the naming rules in the library guide; read the source file for exact signatures.

Search every guide, reference page, and API declaration.