pub struct DynamicDispatcher(/* private fields */);Expand description
Dynamic dispatcher Dispatcher implementation loading commands in static memory. This is a cost-free abstraction assuming you follow the safety rule below. Cloning this object is free (the object has size 0 and the clone function is empty) and it never makes any heap allocation. Use this dispatcher if you can.
§Safety
Using a dynamic dispatcher means that at any point, only at most one vulkan instance and at most one vulkan device exists. This is the case for most Vulkan program but if you cannot guarantee it, use MultiDispatcher instead
Implementations§
Source§impl DynamicDispatcher
impl DynamicDispatcher
Sourcepub unsafe fn unload()
pub unsafe fn unload()
Unloads the loaded library
§Safety:
- Only call this function if the dispatcher was loaded with Dispatcher::new_loaded.
- Only call this function after all vulkan handles have been freed/destroyed
- You cannot call any vulkan command before creating a new dispatcher.
- There should be a call to Dispatcher::new_loaded between two consecutive calls to Self::unload
Trait Implementations§
Source§impl Clone for DynamicDispatcher
impl Clone for DynamicDispatcher
Source§fn clone(&self) -> DynamicDispatcher
fn clone(&self) -> DynamicDispatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Dispatcher for DynamicDispatcher
impl Dispatcher for DynamicDispatcher
Source§fn get_command_dispatcher(&self) -> &CommandsDispatcher
fn get_command_dispatcher(&self) -> &CommandsDispatcher
Return the associated vk::CommandsDispatcher with this Dispatcher
You can then use the command table to call any command that has been loaded or load new commands
Source§unsafe fn new(get_instance_proc_addr: GetInstanceProcAddrSignature) -> Self
unsafe fn new(get_instance_proc_addr: GetInstanceProcAddrSignature) -> Self
Create a new dispatcher given the get_instance_proc_addr entry point
this will load basic (non-instance and non-device dependent) commands Read more
fn clone_with_instance(&self, instance: &Instance) -> Self
fn clone_with_device(&self, device: &Device) -> Self
Source§unsafe fn new_loaded() -> Result<Self, LoadingError>
unsafe fn new_loaded() -> Result<Self, LoadingError>
Create a loads the Vulkan library, retrieve the entry point from it and initialize the dispatcher using it*
This will return an error if the vulkan library or its entry point cannot be found
Library unloading depends on the implementation, for MultiDispatcher it happends as soon as all dispatcher are dropped.
While for DynamicDispatcher one should call DynamicDispatcher::unload()
SAFETY: Read more
impl Copy for DynamicDispatcher
Auto Trait Implementations§
impl Freeze for DynamicDispatcher
impl RefUnwindSafe for DynamicDispatcher
impl Send for DynamicDispatcher
impl Sync for DynamicDispatcher
impl Unpin for DynamicDispatcher
impl UnwindSafe for DynamicDispatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more