1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! Ergonomic Vulkan wrapper built on generated FFI bindings.
//!
//! `vulkan-rust` provides safe-ish wrappers around the raw Vulkan API exposed by
//! [`vulkan-rust-sys`](vk). The raw types live in the re-exported [`vk`] module; this
//! crate adds ergonomic methods on [`Entry`], [`Instance`], and [`Device`] that
//! handle output parameters, two-call enumeration, and error checking.
//!
//! # Quick start
//!
//! ```no_run
//! use vulkan_rust::{Entry, LibloadingLoader};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let loader = unsafe { LibloadingLoader::new() }?;
//! let entry = unsafe { Entry::new(loader) }?;
//! // entry is now ready to create instances, enumerate layers, etc.
//! # Ok(())
//! # }
//! ```
//!
//! # Panics
//!
//! Wrapper methods on [`Instance`] and [`Device`] panic if the underlying
//! Vulkan function pointer was not loaded. This happens when calling a
//! command from an extension or Vulkan version that was not enabled at
//! instance or device creation time. The panic message names the missing
//! command (e.g., `"vkCmdDrawMeshTasksEXT not loaded"`).
//!
//! Core Vulkan 1.0 commands are always loaded and will not panic.
//!
//! # Crate structure
//!
//! | Module | Purpose |
//! |--------|---------|
//! | [`vk`] | Re-export of `vulkan-rust-sys`,raw `#[repr(C)]` types, handles, enums |
//! | [`Entry`] | Vulkan entry point,loads the library, enumerates layers/extensions |
//! | [`Instance`] | Vulkan instance,physical device queries, instance-level commands |
//! | [`Device`] | Vulkan logical device,all device-level commands |
//! | [`bytecode`] | SPIR-V byte alignment helpers |
//! | [`Version`] | Decoded Vulkan version (major.minor.patch) from a packed `u32` |
//!
//! # Guide
//!
//! The companion [vulkan_rust Guide](https://hiddentale.github.io/vulkan_rust/)
//! covers Vulkan concepts in depth:
//!
//! | Topic | Guide chapter |
//! |-------|---------------|
//! | First steps | [Hello Triangle tutorial](https://hiddentale.github.io/vulkan_rust/getting-started/hello-triangle-1.html) |
//! | Handles, lifetimes, parent-child | [The Vulkan Object Model](https://hiddentale.github.io/vulkan_rust/concepts/object-model.html) |
//! | Heaps, allocation, mapping | [Memory Management](https://hiddentale.github.io/vulkan_rust/concepts/memory.html) |
//! | Fences, semaphores, barriers | [Synchronization](https://hiddentale.github.io/vulkan_rust/concepts/synchronization.html) |
//! | Attachments, subpasses | [Render Passes & Framebuffers](https://hiddentale.github.io/vulkan_rust/concepts/render-passes.html) |
//! | Graphics & compute pipelines | [Pipelines](https://hiddentale.github.io/vulkan_rust/concepts/pipelines.html) |
//! | Layouts, pools, sets | [Descriptor Sets & Resource Binding](https://hiddentale.github.io/vulkan_rust/concepts/descriptors.html) |
//! | Recording & submission | [Command Buffers](https://hiddentale.github.io/vulkan_rust/concepts/command-buffers.html) |
//! | Extension struct chains | [The pNext Extension Chain](https://hiddentale.github.io/vulkan_rust/concepts/pnext.html) |
//! | Debug messenger, layers | [Validation Layers & Debugging](https://hiddentale.github.io/vulkan_rust/concepts/validation.html) |
//! | Safety model, two-crate design | [Design Decisions](https://hiddentale.github.io/vulkan_rust/architecture/design.html) |
//! | Error types, Result pattern | [Error Handling Philosophy](https://hiddentale.github.io/vulkan_rust/architecture/errors.html) |
//! | Porting from ash | [Migration Guide](https://hiddentale.github.io/vulkan_rust/how-to/migrate-from-ash.html) |
//! | C API to Rust mapping | [C-to-Rust Reference](https://hiddentale.github.io/vulkan_rust/how-to/c-to-rust.html) |
//!
//! # Feature flags
//!
//! | Flag | Default | Description |
//! |------|---------|-------------|
//! | `surface` | yes | Enables [`required_extensions`] and [`SurfaceError`] for window surface creation via [`raw-window-handle`](https://docs.rs/raw-window-handle). Disable with `default-features = false` for headless use. |
pub use vulkan_rust_sys as vk;
pub use ;
pub use Device;
pub use Entry;
pub use ;
pub use Instance;
pub use ;
pub use ;
pub use Version;
// Static assertions: Entry, Instance, and Device must be Send + Sync.
// They are auto-derived (handle is usize, commands are Option<fn ptr>,
// loader is Option<Arc<dyn Loader>> where Loader: Send + Sync), but
// we pin this here so a future field change triggers a compile error.
const _: = ;
/// Shared mutex for Vulkan runtime tests.
///
/// NVIDIA implicit layers (`VK_LAYER_NV_optimus`, `VK_LAYER_NV_present`)
/// are not thread-safe during concurrent `vkCreateInstance` calls. All
/// `#[ignore]` tests that create Vulkan instances must acquire this lock.
pub static VK_TEST_MUTEX: Mutex = new;