Skip to content

Hiddentale/vulkan_rust

vulkan-rust

CI docs.rs crates.io License: MIT License: Apache 2.0

Ergonomic, minimal Vulkan bindings for Rust, generated from vk.xml.

All commands are inherent methods on Entry, Instance, and Device, no trait imports needed. Supports from_raw_parts for OpenXR and middleware interop, complete command loading for every enabled extension, and 100% documentation coverage enforced in CI.

Getting Started

See the examples directory for progressively complex Vulkan programs, from minimal setup to textured rendering. Run them with cargo run --example hello_triangle_4.

If you're new to Vulkan, start with the Hello Triangle tutorial in the companion guide.

For a comprehensive project using vulkan-rust, check out Manifold.

Why vulkan-rust?

vulkan-rust ash vulkanalia
Command style Inherent methods Trait-based Trait-based
from_raw_parts Yes, dedicated API Yes No
Documentation 100% coverage, spec links, examples Spec links only Spec links + tutorial
Command loading All enabled extensions All enabled extensions All enabled extensions
no_std (sys crate) Yes Yes Yes

Key differences from ash:

  • No trait imports. device.create_buffer(...) works directly, no use DeviceV1_0.
  • from_raw_parts everywhere. Construct Instance/Device from raw handles + vkGetInstanceProcAddr. Critical for OpenXR (XR_KHR_vulkan_enable2), middleware, and testing.
  • Full documentation coverage. Every public item documented with spec links, usage notes, and examples. A companion guide covers Vulkan concepts in depth.

Crate Structure

vulkan-rust          Ergonomic wrapper (Entry, Instance, Device)
vulkan-rust-sys      Generated #[repr(C)] types from vk.xml (no_std)
vulkan-rust-codegen  Code generator (not published)

Users depend on vulkan-rust and access raw types via vulkan_rust::vk::*.

Supported Platforms

Platform Library Surface CI Tested
Windows vulkan-1.dll Win32 Yes
Linux libvulkan.so.1 X11, Wayland, XCB Yes (+ lavapipe)
macOS libvulkan.1.dylib Metal Yes
Android libvulkan.so Android Build only

Feature Flags

Flag Default Description
surface Yes Window surface creation via raw-window-handle. Disable with default-features = false for headless use.

Examples

Progressive examples from minimal setup to textured rendering:

Example Lines Concepts
hello_triangle_1 81 Entry, Instance
hello_triangle_2 248 Surface, Swapchain
hello_triangle_3 413 Pipeline, Command buffers
hello_triangle_4 588 Complete triangle
push_constants 619 Dynamic pipeline parameters
double_buffering 620 Triple-buffered rendering
resize 702 Window resize handling
textures 930 Image loading, sampling

Run with cargo run --example hello_triangle_4.

Guide

The companion vulkan_rust Guide covers:

Getting Started - Installation | Hello Triangle 1-4

Concepts - Object Model | Memory | Synchronization | Render Passes | Pipelines | Descriptors | Command Buffers | pNext Chains | Validation

Architecture - Design Decisions | Error Handling

How-To - Migrate from ash | C-to-Rust Reference | Push Constants | Double Buffering | Resize | Textures

Testing

Information about testing, including where tests of various kinds live and how to run them.

MSRV Policy

The minimum supported Rust version is 1.85 (edition 2024).

MSRV bumps are treated as breaking changes and only happen in minor version increments (pre-1.0) or major version increments (post-1.0). Enforced in CI.

Contributing

See CONTRIBUTING.md for documentation standards and the deprecation policy.

Disclaimer

Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc. This project is not affiliated with, endorsed by, or officially connected to Khronos in any way.

License

Licensed under either of

at your option.

About

Ergonomic Vulkan bindings for Rust, generated from vk.xml.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages