pub struct Instance {
pub info: InstanceInfo,
pub khr_surface: 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.
See VkInstance.
Fields§
§info: InstanceInfoInformation used to create this resource.
Note: This field is read-only.
khr_surface: boolTrue if VK_KHR_surface is enabled on this instance.
Note: This field is read-only.
Implementations§
Source§impl Instance
impl Instance
Sourcepub const DEFAULT_API_VERSION: ApiVersion = ApiVersion::Vulkan13
pub const DEFAULT_API_VERSION: ApiVersion = ApiVersion::Vulkan13
Default Vulkan API version requested when creating an instance.
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.
See vkCreateInstance.
Sourcepub fn entry(this: &Self) -> &Entry
pub fn entry(this: &Self) -> &Entry
The ash entry point used to load Vulkan instance functions.
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.
See VK_KHR_surface.
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.
See VkInstance.