pub struct Instance {
pub info: InstanceInfo,
pub surface_ext: bool,
/* private fields */
}Expand description
There is no global state in Vulkan and all per-application state is stored in a VkInstance object.
Creating an Instance initializes the Vulkan library and allows the application to pass information about itself to the implementation.
Fields§
§info: InstanceInfoInformation used to create this resource.
Note: This field is read-only.
surface_ext: boolTrue if VK_KHR_surface is enabled on this instance.
Note: This field is read-only.
Implementations§
Source§impl Instance
impl Instance
Sourcepub const LATEST_API_VERSION: ApiVersion = ApiVersion::Vulkan13
pub const LATEST_API_VERSION: ApiVersion = ApiVersion::Vulkan13
The most recent supported version of Vulkan.
Sourcepub fn create(info: impl Into<InstanceInfo>) -> Result<Self, DriverError>
pub fn create(info: impl Into<InstanceInfo>) -> Result<Self, DriverError>
Creates a new Vulkan instance.
This constructor is intended for headless or manually managed setups. It does not infer or
enable display platform surface extensions. Use Self::try_from_display when the
resulting instance must be capable of later surface creation.
Sourcepub fn physical_device(
this: &Self,
physical_device: PhysicalDevice,
) -> Result<PhysicalDevice, DriverError>
pub fn physical_device( this: &Self, physical_device: PhysicalDevice, ) -> Result<PhysicalDevice, DriverError>
Returns a wrapper structure for a physical device of this instance.
Sourcepub fn physical_devices(
this: &Self,
) -> Result<impl IntoIterator<Item = PhysicalDevice>, DriverError>
pub fn physical_devices( this: &Self, ) -> Result<impl IntoIterator<Item = PhysicalDevice>, DriverError>
Returns the available physical devices of this instance.
Sourcepub fn try_from_display(
display: impl HasDisplayHandle,
info: impl Into<InstanceInfo>,
) -> Result<Self, DriverError>
pub fn try_from_display( display: impl HasDisplayHandle, info: impl Into<InstanceInfo>, ) -> Result<Self, DriverError>
Creates a new Vulkan instance with the platform surface extensions required by the provided display handle.
Sourcepub fn try_from_entry(
entry: Entry,
instance: Instance,
) -> Result<Self, DriverError>
pub fn try_from_entry( entry: Entry, instance: Instance, ) -> Result<Self, DriverError>
Loads an existing Vulkan instance that may have been created by other means.
This is useful when you want to use a Vulkan instance created by some other library, such as OpenXR.