1 // Copyright (c) 2016 The vulkano developers 2 // Licensed under the Apache License, Version 2.0 3 // <LICENSE-APACHE or 4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT 5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, 6 // at your option. All files in the project carrying such 7 // notice may not be copied, modified, or distributed except 8 // according to those terms. 9 10 //! API entry point. 11 //! 12 //! The first thing to do before you start using Vulkan is to create an `Instance` object. 13 //! 14 //! For example: 15 //! 16 //! ```no_run 17 //! use vulkano::instance::Instance; 18 //! use vulkano::instance::InstanceExtensions; 19 //! use vulkano::Version; 20 //! 21 //! let instance = match Instance::new(None, Version::V1_1, &InstanceExtensions::none(), None) { 22 //! Ok(i) => i, 23 //! Err(err) => panic!("Couldn't build instance: {:?}", err) 24 //! }; 25 //! ``` 26 //! 27 //! Creating an instance initializes everything and allows you to enumerate physical devices, 28 //! ie. all the Vulkan implementations that are available on the system. 29 //! 30 //! ```no_run 31 //! # use vulkano::instance::Instance; 32 //! # use vulkano::instance::InstanceExtensions; 33 //! # use vulkano::Version; 34 //! use vulkano::device::physical::PhysicalDevice; 35 //! 36 //! # let instance = Instance::new(None, Version::V1_1, &InstanceExtensions::none(), None).unwrap(); 37 //! for physical_device in PhysicalDevice::enumerate(&instance) { 38 //! println!("Available device: {}", physical_device.properties().device_name); 39 //! } 40 //! ``` 41 //! 42 //! # Enumerating physical devices and creating a device 43 //! 44 //! After you have created an instance, the next step is usually to enumerate the physical devices 45 //! that are available on the system with `PhysicalDevice::enumerate()` (see above). 46 //! 47 //! When choosing which physical device to use, keep in mind that physical devices may or may not 48 //! be able to draw to a certain surface (ie. to a window or a monitor), or may even not be able 49 //! to draw at all. See the `swapchain` module for more information about surfaces. 50 //! 51 //! Once you have chosen a physical device, you can create a `Device` object from it. See the 52 //! `device` module for more info. 53 54 pub use self::extensions::InstanceExtensions; 55 pub use self::instance::ApplicationInfo; 56 pub use self::instance::Instance; 57 pub use self::instance::InstanceCreationError; 58 pub use self::layers::layers_list; 59 pub use self::layers::LayerProperties; 60 pub use self::layers::LayersIterator; 61 pub use self::layers::LayersListError; 62 pub use self::loader::LoadingError; 63 pub use crate::extensions::{ 64 ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError, 65 }; 66 pub use crate::version::Version; 67 68 pub mod debug; 69 pub(crate) mod extensions; 70 mod instance; 71 mod layers; 72 pub mod loader; 73