pub struct Device { /* 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.
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 Device
impl Device
pub fn is_valid(&self) -> bool
pub fn check_is_valid(&self) -> Result<(), DeviceError>
pub fn handle_hal_error(&self, error: DeviceError) -> DeviceError
pub fn get_queue(&self) -> Option<Arc<Queue>>
pub fn set_queue(&self, queue: &Arc<Queue>)
Sourcepub unsafe fn create_pipeline_cache(
self: &Arc<Self>,
desc: &PipelineCacheDescriptor<'_>,
) -> Result<Arc<PipelineCache>, CreatePipelineCacheError>
pub unsafe fn create_pipeline_cache( self: &Arc<Self>, desc: &PipelineCacheDescriptor<'_>, ) -> Result<Arc<PipelineCache>, CreatePipelineCacheError>
§Safety
The data
field on desc
must have previously been returned from crate::global::Global::pipeline_cache_get_data