pub struct Device<A: HalApi> { /* private fields */ }
Expand description
Structure describing a logical device. Some members are internally mutable, stored behind mutexes.
TODO: establish clear order of locking for these:
life_tracker
, trackers
, render_passes
, pending_writes
, trace
.
Currently, the rules are:
life_tracker
is locked afterhub.devices
, enforced by the type systemself.trackers
is locked last (unenforced)self.trace
is locked last (unenforced)
Right now avoid locking twice same resource or registry in a call execution and minimize the locking to the minimum scope possible Unless otherwise specified, no lock may be acquired while holding another lock. This means that you must inspect function calls made while a lock is held to see what locks the callee may try to acquire.
As far as this point: device_maintain_ids locks Device::lifetime_tracker, and calls… triage_suspected locks Device::trackers, and calls… Registry::unregister locks Registry::storage
Important: When locking pending_writes please check that trackers is not locked trackers should be locked only when needed for the shortest time possible
Implementations§
source§impl<A: HalApi> Device<A>
impl<A: HalApi> Device<A>
pub fn is_valid(&self) -> bool
pub fn get_queue(&self) -> Option<Arc<Queue<A>>>
pub fn set_queue(&self, queue: Arc<Queue<A>>)
pub fn create_buffer_from_hal( self: &Arc<Self>, hal_buffer: A::Buffer, desc: &BufferDescriptor<'_> ) -> Buffer<A>
sourcepub fn create_validator(self: &Arc<Self>, flags: ValidationFlags) -> Validator
pub fn create_validator(self: &Arc<Self>, flags: ValidationFlags) -> Validator
Create a validator with the given validation flags.