pub struct Entry { /* private fields */ }
Expand description
Holds the Vulkan functions independent of a particular instance
Implementations
sourceimpl Entry
impl Entry
Vulkan core 1.0
sourcepub unsafe fn load() -> Result<Entry, LoadingError>
pub unsafe fn load() -> Result<Entry, LoadingError>
Load default Vulkan library for the current platform
Prefer this over linked
when your application can gracefully handle
environments that lack Vulkan support, and when the build environment might not have Vulkan
development packages installed (e.g. the Vulkan SDK, or Ubuntu’s libvulkan-dev
).
Safety
dlopen
ing native libraries is inherently unsafe. The safety guidelines
for [Library::new()
] and [Library::get()
] apply here.
use ash::{vk, Entry};
let entry = unsafe { Entry::load()? };
let app_info = vk::ApplicationInfo {
api_version: vk::make_api_version(0, 1, 0, 0),
..Default::default()
};
let create_info = vk::InstanceCreateInfo {
p_application_info: &app_info,
..Default::default()
};
let instance = unsafe { entry.create_instance(&create_info, None)? };
sourcepub unsafe fn load_from(path: impl AsRef<OsStr>) -> Result<Entry, LoadingError>
pub unsafe fn load_from(path: impl AsRef<OsStr>) -> Result<Entry, LoadingError>
Load Vulkan library at path
Safety
dlopen
ing native libraries is inherently unsafe. The safety guidelines
for [Library::new()
] and [Library::get()
] apply here.
sourcepub unsafe fn from_static_fn(static_fn: StaticFn) -> Entry
pub unsafe fn from_static_fn(static_fn: StaticFn) -> Entry
Load entry points based on an already-loaded vk::StaticFn
Safety
static_fn
must contain valid function pointers that comply with the semantics specified by
Vulkan 1.0, which must remain valid for at least the lifetime of the returned Entry
.
pub fn fp_v1_0(&self) -> &EntryFnV1_0
pub fn static_fn(&self) -> &StaticFn
sourcepub fn try_enumerate_instance_version(&self) -> Result<Option<u32>, Result>
pub fn try_enumerate_instance_version(&self) -> Result<Option<u32>, Result>
let entry = Entry::linked();
match entry.try_enumerate_instance_version()? {
// Vulkan 1.1+
Some(version) => {
let major = vk::version_major(version);
let minor = vk::version_minor(version);
let patch = vk::version_patch(version);
},
// Vulkan 1.0
None => {},
}
sourcepub unsafe fn create_instance(
&self,
create_info: &InstanceCreateInfo,
allocation_callbacks: Option<&AllocationCallbacks>
) -> Result<Instance, Result>
pub unsafe fn create_instance(
&self,
create_info: &InstanceCreateInfo,
allocation_callbacks: Option<&AllocationCallbacks>
) -> Result<Instance, Result>
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateInstance.html
Safety
In order for the created Instance
to be valid for the duration of its
usage, the Entry
this was called on must be dropped later than the
resulting Instance
.
sourcepub fn enumerate_instance_layer_properties(
&self
) -> Result<Vec<LayerProperties, Global>, Result>
pub fn enumerate_instance_layer_properties(
&self
) -> Result<Vec<LayerProperties, Global>, Result>
sourcepub fn enumerate_instance_extension_properties(
&self,
layer_name: Option<&CStr>
) -> Result<Vec<ExtensionProperties, Global>, Result>
pub fn enumerate_instance_extension_properties(
&self,
layer_name: Option<&CStr>
) -> Result<Vec<ExtensionProperties, Global>, Result>
sourceimpl Entry
impl Entry
Vulkan core 1.1
pub fn fp_v1_1(&self) -> &EntryFnV1_1
sourcepub fn enumerate_instance_version(&self) -> Result<u32, Result>
👎Deprecated: This function is unavailable and therefore panics on Vulkan 1.0, please use try_enumerate_instance_version()
instead
pub fn enumerate_instance_version(&self) -> Result<u32, Result>
try_enumerate_instance_version()
instead