Struct ash::EntryCustom [−][src]
pub struct EntryCustom<L> { /* fields omitted */ }
Expand description
Holds a custom type L
to load symbols from (usually a handle to a dlopen
ed library),
the vkGetInstanceProcAddr
loader function from
this library (in vk::StaticFn
), and Vulkan’s “entry point” functions (resolved with NULL
instance
) as listed in vkGetInstanceProcAddr
’s description.
Implementations
Vulkan core 1.0
pub fn new_custom<Load>(lib: L, load: Load) -> Result<Self, MissingEntryPoint> where
Load: FnMut(&mut L, &CStr) -> *const c_void,
let entry = unsafe { Entry::new() }?;
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 => {},
}
pub unsafe fn create_instance(
&self,
create_info: &InstanceCreateInfo,
allocation_callbacks: Option<&AllocationCallbacks>
) -> Result<Instance, InstanceError>
pub unsafe fn create_instance(
&self,
create_info: &InstanceCreateInfo,
allocation_callbacks: Option<&AllocationCallbacks>
) -> Result<Instance, InstanceError>
https://www.khronos.org/registry/vulkan/specs/1.2-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
.
pub unsafe fn get_instance_proc_addr(
&self,
instance: Instance,
p_name: *const c_char
) -> PFN_vkVoidFunction
pub unsafe fn get_instance_proc_addr(
&self,
instance: Instance,
p_name: *const c_char
) -> PFN_vkVoidFunction
Vulkan core 1.1
👎 Deprecated: This function is unavailable and therefore panics on Vulkan 1.0, please use try_enumerate_instance_version
instead
This function is unavailable and therefore panics on Vulkan 1.0, please use try_enumerate_instance_version
instead
Load default Vulkan library for the current platform
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::new() }?;
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)? };
Load Vulkan library at path
Safety
dlopen
ing native libraries is inherently unsafe. The safety guidelines
for Library::new
and Library::get
apply here.
Trait Implementations
Auto Trait Implementations
impl<L> RefUnwindSafe for EntryCustom<L> where
L: RefUnwindSafe,
impl<L> Send for EntryCustom<L> where
L: Send,
impl<L> Sync for EntryCustom<L> where
L: Sync,
impl<L> Unpin for EntryCustom<L> where
L: Unpin,
impl<L> UnwindSafe for EntryCustom<L> where
L: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more