Skip to main content

DeviceState

Struct DeviceState 

Source
pub struct DeviceState<C, B, P, Q, E> { /* private fields */ }
Expand description

Complete typed object graph for one device instance.

Implementations§

Source§

impl<C, B, P, Q, E> DeviceState<C, B, P, Q, E>

Source

pub fn new( namespace: ObjectNamespace, limits: DeviceLimits, policy: ResourcePolicy, ) -> Result<Self, DeviceStateConfigError>

Source

pub const fn limits(&self) -> DeviceLimits

Source

pub const fn resource_policy(&self) -> ResourcePolicy

Source

pub const fn retained_bytes(&self) -> RetainedBytes

Bulk bytes still represented by live or releasing provider handles.

Source

pub const fn namespace(&self) -> ObjectNamespace

Source

pub const fn resource_counts(&self) -> ResourceCounts

Source

pub const fn is_empty(&self) -> bool

Source

pub const fn context_count(&self) -> u32

Source

pub const fn buffer_count(&self) -> u32

Source

pub const fn program_count(&self) -> u32

Source

pub const fn queue_count(&self) -> u32

Source

pub const fn event_count(&self) -> u32

Source

pub fn context_record( &self, id: ObjectId, ) -> Result<&ContextRecord<C>, DeviceStateError>

Source

pub fn buffer_record( &self, id: ObjectId, ) -> Result<&BufferRecord<B>, DeviceStateError>

Source

pub fn buffer_record_mut( &mut self, id: ObjectId, ) -> Result<&mut BufferRecord<B>, DeviceStateError>

Source

pub fn program_record( &self, id: ObjectId, ) -> Result<&ProgramRecord<P>, DeviceStateError>

Source

pub fn queue_record( &self, id: ObjectId, ) -> Result<&QueueRecord<Q>, DeviceStateError>

Source

pub fn event_record( &self, id: ObjectId, ) -> Result<&EventRecord<E>, DeviceStateError>

Source

pub fn create_context_with<ProviderError>( &mut self, create: impl FnOnce() -> Result<C, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>

Source

pub fn create_buffer_with<ProviderError>( &mut self, context_id: ObjectId, desc: BufferDesc, create: impl FnOnce(&C, BufferDesc) -> Result<(B, BufferInfo), ProviderError>, ) -> Result<BufferCreateOutcome, CreateError<ProviderError>>

Source

pub fn create_program_with<ProviderError>( &mut self, context_id: ObjectId, artifact_bytes: u64, resident_bytes: u64, create: impl FnOnce(&C) -> Result<P, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>

Source

pub fn create_queue_with<ProviderError>( &mut self, context_id: ObjectId, create: impl FnOnce(&C) -> Result<Q, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>

Source

pub fn create_event_with<ProviderError>( &mut self, queue_id: ObjectId, program_id: ObjectId, buffer_ids: Vec<ObjectId>, create: impl FnOnce(SubmissionResources<'_, B, P, Q>) -> Result<E, ProviderError>, ) -> Result<ObjectId, CreateError<ProviderError>>

Source

pub fn begin_context_release( &mut self, id: ObjectId, ) -> Result<C, DeviceStateError>

Source

pub fn restore_context_release( &mut self, id: ObjectId, resource: C, ) -> Result<(), RestoreError<C>>

Source

pub fn commit_context_release( &mut self, id: ObjectId, ) -> Result<(), DeviceStateError>

Source

pub fn begin_buffer_release( &mut self, id: ObjectId, ) -> Result<B, DeviceStateError>

Source

pub fn restore_buffer_release( &mut self, id: ObjectId, resource: B, ) -> Result<(), RestoreError<B>>

Source

pub fn commit_buffer_release( &mut self, id: ObjectId, ) -> Result<(), DeviceStateError>

Source

pub fn begin_program_release( &mut self, id: ObjectId, ) -> Result<P, DeviceStateError>

Source

pub fn restore_program_release( &mut self, id: ObjectId, resource: P, ) -> Result<(), RestoreError<P>>

Source

pub fn commit_program_release( &mut self, id: ObjectId, ) -> Result<(), DeviceStateError>

Source

pub fn begin_queue_release( &mut self, id: ObjectId, ) -> Result<Q, DeviceStateError>

Source

pub fn restore_queue_release( &mut self, id: ObjectId, resource: Q, ) -> Result<(), RestoreError<Q>>

Source

pub fn commit_queue_release( &mut self, id: ObjectId, ) -> Result<(), DeviceStateError>

Source

pub fn begin_event_release( &mut self, id: ObjectId, ) -> Result<E, DeviceStateError>

Source

pub fn restore_event_release( &mut self, id: ObjectId, resource: E, ) -> Result<(), RestoreError<E>>

Source

pub fn commit_event_release( &mut self, id: ObjectId, ) -> Result<(), DeviceStateError>

Auto Trait Implementations§

§

impl<C, B, P, Q, E> Freeze for DeviceState<C, B, P, Q, E>

§

impl<C, B, P, Q, E> RefUnwindSafe for DeviceState<C, B, P, Q, E>

§

impl<C, B, P, Q, E> Send for DeviceState<C, B, P, Q, E>
where C: Send, B: Send, P: Send, Q: Send, E: Send,

§

impl<C, B, P, Q, E> Sync for DeviceState<C, B, P, Q, E>
where C: Sync, B: Sync, P: Sync, Q: Sync, E: Sync,

§

impl<C, B, P, Q, E> Unpin for DeviceState<C, B, P, Q, E>
where C: Unpin, B: Unpin, P: Unpin, Q: Unpin, E: Unpin,

§

impl<C, B, P, Q, E> UnsafeUnpin for DeviceState<C, B, P, Q, E>

§

impl<C, B, P, Q, E> UnwindSafe for DeviceState<C, B, P, Q, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.