Queue

Struct Queue 

Source
pub struct Queue {
    raw: Box<dyn DynQueue>,
    pub(crate) pending_writes: Mutex<PendingWrites>,
    life_tracker: Mutex<LifetimeTracker>,
    pub(crate) device: Arc<Device>,
}

Fields§

§raw: Box<dyn DynQueue>§pending_writes: Mutex<PendingWrites>§life_tracker: Mutex<LifetimeTracker>§device: Arc<Device>

Implementations§

Source§

impl Queue

Source

pub(crate) fn new( device: Arc<Device>, raw: Box<dyn DynQueue>, instance_flags: InstanceFlags, ) -> Result<Self, DeviceError>

Source

pub(crate) fn raw(&self) -> &dyn DynQueue

Source

pub(crate) fn lock_life<'a>(&'a self) -> MutexGuard<'a, LifetimeTracker>

Source

pub(crate) fn prepare_surface_texture_for_present( &self, texture: &Arc<Texture>, ) -> Result<(), DeviceError>

Ensure the surface texture is in the PRESENT state, clearing it if it was never rendered to. Submits any necessary work to the GPU before the HAL present call.

See https://github.com/gfx-rs/wgpu/issues/6748

Source

pub(crate) fn maintain( &self, submission_index: u64, snatch_guard: &SnatchGuard<'_>, ) -> (SmallVec<[SubmittedWorkDoneClosure; 1]>, Vec<BufferMapPendingClosure>, Vec<BlasCompactReadyPendingClosure>, bool)

Source§

impl Queue

Source

pub fn write_buffer( &self, buffer: Arc<Buffer>, buffer_offset: BufferAddress, data: &[u8], ) -> Result<(), QueueWriteError>

Source

pub fn create_staging_buffer( &self, buffer_size: BufferSize, ) -> Result<(StagingBuffer, NonNull<u8>), QueueWriteError>

Source

pub fn write_staging_buffer( &self, buffer: Fallible<Buffer>, buffer_offset: BufferAddress, staging_buffer: StagingBuffer, ) -> Result<(), QueueWriteError>

Source

pub fn validate_write_buffer( &self, buffer: Fallible<Buffer>, buffer_offset: u64, buffer_size: BufferSize, ) -> Result<(), QueueWriteError>

Source

fn validate_write_buffer_impl( &self, buffer: &Buffer, buffer_offset: u64, buffer_size: u64, ) -> Result<(), TransferError>

Source

fn write_staging_buffer_impl( &self, snatch_guard: &SnatchGuard<'_>, pending_writes: &mut PendingWrites, staging_buffer: &FlushedStagingBuffer, buffer: Arc<Buffer>, buffer_offset: u64, ) -> Result<(), QueueWriteError>

Source

pub fn write_texture( &self, destination: TexelCopyTextureInfo<Arc<Texture>>, data: &[u8], data_layout: &TexelCopyBufferLayout, size: &Extent3d, ) -> Result<(), QueueWriteError>

Source

pub fn flush_writes_for_buffer( &self, buffer: &Arc<Buffer>, snatch_guard: SnatchGuard<'_>, ) -> Result<(), BufferAccessError>

Flush PendingWrites if it contains a write to buffer.

Source

fn flush_pending_writes(&self) -> Result<Option<SubmissionIndex>, DeviceError>

Source

fn trace_submission( &self, submit_index: SubmissionIndex, commands: Vec<Command<PointerReferences>>, )

Available on crate feature trace only.
Source

fn trace_failed_submission( &self, submit_index: SubmissionIndex, commands: Option<Vec<Command<PointerReferences>>>, error: String, )

Available on crate feature trace only.
Source

pub fn submit( &self, command_buffers: &[Arc<CommandBuffer>], ) -> Result<SubmissionIndex, (SubmissionIndex, QueueSubmitError)>

Source

fn allocate_submission<'a>( &'a self, snatch_guard: SnatchGuard<'a>, ) -> Result<PendingSubmission<'a>, (SubmissionIndex, DeviceError)>

Allocate a submission index and prepare for a submission.

This is an internal API used in Queue::submit and other places within wgpu-core that need to submit work.

Returns the index and a PendingSubmission.

The caller passes in the already-acquired SnatchGuard. This function acquires the fence lock and the command index lock.

The caller should update PendingSubmission::executions with details of the submission.

To finalize and submit the submission, call PendingSubmission::submit (which is a convenience wrapper around Queue::submit_pending_submission).

After calling this function and before submitting, the caller must acquire the pending writes lock, and pass it to submit.

It is also acceptable to drop the PendingSubmission without submitting. This may be necessary when locks are required to access the state that determines whether a submission is needed.

Source

fn submit_pending_submission<'a>( &self, pending_writes: MutexGuard<'_, PendingWrites>, prepared: PendingSubmission<'a>, ) -> Result<SubmissionResult<'a>, DeviceError>

Finalize and submit a PendingSubmission that was returned by Queue::allocate_submission.

This is an internal API used in Queue::submit and other places within wgpu-core that need to submit work. See Queue::allocate_submission for more details.

This function:

  • Performs a HAL submission of the pending writes command encoder and any other command encoders that were added to the PendingSubmission.
  • Advances last_successful_submission_index and registers the submission with the lifetime tracker.
  • Returns a SubmissionResult, which contains the snatch guard and a downgraded FenceReadGuard.
Source

pub fn get_timestamp_period(&self) -> f32

Source

pub fn on_submitted_work_done( &self, closure: SubmittedWorkDoneClosure, ) -> Option<SubmissionIndex>

closure is guaranteed to be called.

Source

pub fn compact_blas( &self, blas: &Arc<Blas>, ) -> Result<Arc<Blas>, CompactBlasError>

Source§

impl Queue

Source

pub fn present(&self, surface: &Surface) -> Result<Status, SurfaceError>

Trait Implementations§

Source§

impl Drop for Queue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Labeled for Queue

Source§

fn label(&self) -> &str

Returns a string identifying this resource for logging and errors. Read more
Source§

fn error_ident(&self) -> ResourceErrorIdent

Source§

impl ParentDevice for Queue

Source§

fn device(&self) -> &Arc<Device>

Source§

fn is_equal(self: &Arc<Self>, other: &Arc<Self>) -> bool

Source§

fn same_device_as<O: ParentDevice>(&self, other: &O) -> Result<(), DeviceError>

Source§

fn same_device(&self, device: &Device) -> Result<(), DeviceError>

Source§

impl ResourceType for Queue

Source§

const TYPE: &'static str = "Queue"

Auto Trait Implementations§

§

impl !Freeze for Queue

§

impl !RefUnwindSafe for Queue

§

impl Send for Queue

§

impl Sync for Queue

§

impl Unpin for Queue

§

impl !UnwindSafe for Queue

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,