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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! # Vulkane — Raw Vulkan API Bindings for Rust
//!
//! Vulkane generates complete, raw Vulkan API bindings directly from the official
//! Vulkan XML specification (`vk.xml`). Every type, constant, struct, enum,
//! function pointer, and dispatch table is derived from the spec — nothing is
//! hardcoded.
//!
//! ## Features
//!
//! - **100% Generated from vk.xml** — swap the XML file and rebuild to target
//! any Vulkan version from 1.2.175 onward
//! - **Complete API Coverage** — all core types, extensions, and function pointers
//! - **Extension Enum Values** — extension-added enum values are merged into
//! base enums automatically
//! - **Dispatch Tables** — generated `VkEntryDispatchTable`, `VkInstanceDispatchTable`,
//! and `VkDeviceDispatchTable` for runtime function loading
//! - **Version Macros** — `vk_make_api_version`, `vk_api_version_major`, etc.
//! are transpiled from the C macro definitions in vk.xml
//! - **Auto-Download** — with the `fetch-spec` feature, vk.xml is downloaded
//! from the Khronos GitHub repository automatically
//!
//! ## Supported Vulkan Versions
//!
//! Vulkane supports Vulkan specification versions **1.2.175** through the latest
//! release. Version 1.2.175 is the minimum because it introduced the
//! `VK_MAKE_API_VERSION` / `VK_API_VERSION_*` macros that replaced the
//! deprecated `VK_MAKE_VERSION` / `VK_VERSION_*` macros.
//!
//! ## Providing vk.xml
//!
//! The build script resolves vk.xml in this order:
//!
//! 1. **`VK_XML_PATH` env var** — point to any local vk.xml file
//! 2. **Local copy** — `spec/registry/Vulkan-Docs/xml/vk.xml` relative to the workspace
//! 3. **Auto-download** — requires the `fetch-spec` feature:
//! ```bash
//! cargo build -p vulkane --features fetch-spec
//! ```
//! Set `VK_VERSION` to pin a specific version:
//! ```bash
//! VK_VERSION=1.3.250 cargo build -p vulkane --features fetch-spec
//! ```
//!
//! ## Two API surfaces
//!
//! Vulkane exposes Vulkan through two complementary modules:
//!
//! - [`raw`] — direct FFI bindings. Every Vulkan type, struct, enum, and
//! function pointer, exactly as the spec defines them. Use this for
//! maximum control or to interoperate with code that needs raw handles.
//!
//! - [`safe`] — RAII wrappers with `Drop` impls and `Result`-based error
//! handling. Currently covers the core compute path: instances, devices,
//! queues, buffers, memory, command pools, command buffers, and fences.
//! Use this for ergonomic Rust code without manual `vkDestroy*` calls.
//!
//! ## Raw API example
//!
//! ```rust,ignore
//! use vulkane::raw::bindings::*;
//!
//! let app_info = VkApplicationInfo {
//! sType: VkStructureType::STRUCTURE_TYPE_APPLICATION_INFO,
//! pNext: std::ptr::null(),
//! pApplicationName: b"My App\0".as_ptr() as *const i8,
//! applicationVersion: vk_make_api_version(0, 1, 0, 0),
//! pEngineName: b"My Engine\0".as_ptr() as *const i8,
//! engineVersion: vk_make_api_version(0, 1, 0, 0),
//! apiVersion: VK_API_VERSION_1_0,
//! };
//! ```
//!
//! ## Safe API example
//!
//! ```rust,no_run
//! use vulkane::safe::{Instance, InstanceCreateInfo, ApiVersion};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let instance = Instance::new(InstanceCreateInfo {
//! application_name: Some("my-app"),
//! api_version: ApiVersion::V1_0,
//! ..Default::default()
//! })?;
//!
//! for pd in instance.enumerate_physical_devices()? {
//! println!("Found GPU: {}", pd.properties().device_name());
//! }
//! # Ok(())
//! # }
//! ```
//!
//! The instance, devices, buffers, and command pools are all dropped
//! automatically — no manual `vkDestroy*` calls.
//!
//! ## Safety
//!
//! Functions in [`raw`] are `unsafe` as they directly expose the C API.
//! Users are responsible for parameter validation, memory management,
//! thread safety, and Vulkan object lifecycle management.
//!
//! The [`safe`] module wraps these to provide RAII cleanup and bounds-
//! checked operations, but Vulkan still has many cross-call requirements
//! (e.g., synchronization between submissions) that are the user's
//! responsibility.
// Re-export all raw bindings
// Safe RAII wrapper module
// Re-export commonly used items at crate root for convenience
pub use *;
// Re-export the derive macro when the `derive` feature is enabled,
// so users can write `use vulkane::Vertex;` or `#[derive(vulkane::Vertex)]`.
pub use Vertex;
/// Version information for these bindings