erupt_bootstrap/
lib.rs

1#![doc(html_logo_url = "https://gitlab.com/Friz64/erupt-bootstrap/-/raw/main/logo.svg")]
2#![allow(clippy::missing_safety_doc)]
3#![warn(missing_docs)]
4/*!
5Vulkan Bootstrapping library for Rust, inspired by [`vk-bootstrap`].
6
7- ✅ Instance creation
8- ✅ Physical Device selection
9- ✅ Device creation
10- ✅ Getting queues
11- ✅ Swapchain handling ([courtesy of Ralith](https://github.com/MaikKlein/ash/pull/506) - thanks!)
12
13## **MAINTENANCE MODE NOTICE**
14
15It is not recommended to use this for new projects, as erupt is in maintenance
16mode. There is work underway to rewrite ash using ideas from the erupt project,
17for updates see <https://github.com/ash-rs/ash/issues/344>. The functionality of
18erupt-bootstrap will be made available in some form or another again once this
19work is completed. Simple patches to erupt-bootstrap will still be merged, but
20no large changes are to be expected.
21
22## Cargo Features
23
24- `surface` (enabled by default): Enables the use of [`raw-window-handle`].
25
26## Example
27
28```rust,ignore
29let entry = erupt::EntryLoader::new().unwrap();
30let instance_builder = InstanceBuilder::new()
31    .validation_layers(ValidationLayers::Request)
32    .request_debug_messenger(DebugMessenger::Default)
33    .require_surface_extensions(&window)
34    .unwrap();
35let (instance, debug_messenger, instance_metadata) =
36    unsafe { instance_builder.build(&entry) }.unwrap();
37
38let surface =
39    unsafe { erupt::utils::surface::create_surface(&instance, &window, None) }.unwrap();
40
41let graphics_present = QueueFamilyCriteria::graphics_present();
42let transfer = QueueFamilyCriteria::preferably_separate_transfer();
43
44let device_features = vk::PhysicalDeviceFeatures2Builder::new()
45    .features(vk::PhysicalDeviceFeaturesBuilder::new().build());
46
47let device_builder = DeviceBuilder::new()
48    .queue_family(graphics_present)
49    .queue_family(transfer)
50    .require_features(&device_features)
51    .for_surface(surface);
52let (device, device_metadata) =
53    unsafe { device_builder.build(&instance, &instance_metadata) }.unwrap();
54let graphics_present = device_metadata
55    .device_queue(&instance, &device, graphics_present, 0)
56    .unwrap()
57    .unwrap();
58let transfer = device_metadata
59    .device_queue(&instance, &device, transfer, 0)
60    .unwrap()
61    .unwrap();
62```
63
64For more examples, visit the [git repo](https://gitlab.com/Friz64/erupt-bootstrap/-/tree/main/examples).
65
66## Licensing
67
68The logo contains the Volcano Emoji of [Twemoji](https://twemoji.twitter.com/)
69([License](https://creativecommons.org/licenses/by/4.0/)). The name "erupt" was
70added on top of the volcano. The boot is the ["Hiking Boot" from Openclipart](
71https://openclipart.org/detail/182950/hiking-boot),
72released into the Public Domain.
73
74This project is licensed under the [zlib License].
75
76`vk-bootstrap`, the inspiration of this project, is licensed under the [MIT license].
77
78[zlib License]: https://gitlab.com/Friz64/erupt-bootstrap/-/blob/main/LICENSE
79[MIT license]: https://gitlab.com/Friz64/erupt-bootstrap/-/blob/main/LICENSE-vk-bootstrap
80[`vk-bootstrap`]: https://github.com/charles-lunarg/vk-bootstrap
81[`raw-window-handle`]: https://crates.io/crates/raw-window-handle
82*/
83
84pub mod device;
85pub mod instance;
86pub mod swapchain;
87
88pub use device::*;
89pub use instance::*;
90pub use swapchain::*;