vulkanalia_bootstrap/lib.rs
1//! Vulkanalia-bootstrap is a rust implementation of vulkan-bootstrap for Rust for use with the vulkanalia library.
2//! It is a fork of the ash-bootstrap library with adjusted imports and function calls.
3//!
4//! # Quick start
5//!
6//! The bootstrap library's goal is to make the tedious setup of Vulkan a little bit more bearable.
7//! This is done by providing a bunch of builder that provide help by implementing the boilerplate for you.
8//! From instance to swapchain creation, hunderds of lines of code are implemented for you already.
9//! It tries to not be in the way as much as possible in the rest of your Vulkan application.
10//!
11//! ``` no_run
12//! fn main() -> anyhow::Result<()> {
13//! let instance = InstanceBuilder::new(None)
14//! .app_name("Example Vulkan Application")
15//! .engine_name("Example Vulkan Engine")
16//! .request_validation_layers(true)
17//! .use_default_tracing_messenger()
18//! .build()?;
19//!
20//! let physical_device = PhysicalDeviceSelector::new(instance.clone())
21//! .preferred_device_type(PreferredDeviceType::Discrete)
22//! .select()?;
23//!
24//! let device = Arc::new(DeviceBuilder::new(physical_device, instance.clone()).build()?);
25//!
26//! // You can get the inner handle that is used by vulkan
27//! // Or you can just pass it where the device handle is expected, because it implements AsRef.
28//! let _device_handle = device.handle();
29//!
30//! let (_graphics_queue_index, _graphics_queue) = device.get_queue(QueueType::Graphics)?;
31//! let swapchain_builder = SwapchainBuilder::new(instance.clone(), device.clone());
32//!
33//! let swapchain = swapchain_builder.build()?;
34//!
35//! // And right now we got rid of 400-500 lines of vulkan boilerplate just like that.
36//! // Now let's cleanup.
37//!
38//! swapchain.destroy();
39//! device.destroy();
40//! instance.destroy();
41//!}
42//! ```
43
44mod device;
45mod error;
46mod instance;
47mod swapchain;
48mod system_info;
49#[cfg(feature = "enable_tracing")]
50mod tracing;
51
52pub use device::{
53 Device, DeviceBuilder, PhysicalDevice, PhysicalDeviceSelector, PreferredDeviceType, QueueType,
54};
55pub use error::*;
56pub use instance::{Instance, InstanceBuilder};
57pub use swapchain::{Swapchain, SwapchainBuilder};