Expand description
API entry point.
The first thing to do after loading the Vulkan library is to create an Instance
object.
For example:
use vulkano::{
instance::{Instance, InstanceExtensions},
Version, VulkanLibrary,
};
let library = VulkanLibrary::new()
.unwrap_or_else(|err| panic!("Couldn't load Vulkan library: {:?}", err));
let instance = Instance::new(library, Default::default())
.unwrap_or_else(|err| panic!("Couldn't create instance: {:?}", err));
Creating an instance initializes everything and allows you to enumerate physical devices, ie. all the Vulkan implementations that are available on the system.
use vulkano::device::physical::PhysicalDevice;
for physical_device in instance.enumerate_physical_devices().unwrap() {
println!("Available device: {}", physical_device.properties().device_name);
}
Enumerating physical devices and creating a device
After you have created an instance, the next step is usually to enumerate the physical devices
that are available on the system with Instance::enumerate_physical_devices()
(see above).
When choosing which physical device to use, keep in mind that physical devices may or may not
be able to draw to a certain surface (ie. to a window or a monitor), or may even not be able
to draw at all. See the swapchain
module for more information about surfaces.
Once you have chosen a physical device, you can create a Device
object from it. See the
device
module for more info.
Modules
Structs
Instance
.