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
impl Queue
pub(crate) fn new( device: Arc<Device>, raw: Box<dyn DynQueue>, instance_flags: InstanceFlags, ) -> Result<Self, DeviceError>
pub(crate) fn raw(&self) -> &dyn DynQueue
pub(crate) fn lock_life<'a>(&'a self) -> MutexGuard<'a, LifetimeTracker>
Sourcepub(crate) fn prepare_surface_texture_for_present(
&self,
texture: &Arc<Texture>,
) -> Result<(), DeviceError>
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.
pub(crate) fn maintain( &self, submission_index: u64, snatch_guard: &SnatchGuard<'_>, ) -> (SmallVec<[SubmittedWorkDoneClosure; 1]>, Vec<BufferMapPendingClosure>, Vec<BlasCompactReadyPendingClosure>, bool)
Source§impl Queue
impl Queue
pub fn write_buffer( &self, buffer: Arc<Buffer>, buffer_offset: BufferAddress, data: &[u8], ) -> Result<(), QueueWriteError>
pub fn create_staging_buffer( &self, buffer_size: BufferSize, ) -> Result<(StagingBuffer, NonNull<u8>), QueueWriteError>
pub fn write_staging_buffer( &self, buffer: Fallible<Buffer>, buffer_offset: BufferAddress, staging_buffer: StagingBuffer, ) -> Result<(), QueueWriteError>
pub fn validate_write_buffer( &self, buffer: Fallible<Buffer>, buffer_offset: u64, buffer_size: BufferSize, ) -> Result<(), QueueWriteError>
fn validate_write_buffer_impl( &self, buffer: &Buffer, buffer_offset: u64, buffer_size: u64, ) -> Result<(), TransferError>
fn write_staging_buffer_impl( &self, snatch_guard: &SnatchGuard<'_>, pending_writes: &mut PendingWrites, staging_buffer: &FlushedStagingBuffer, buffer: Arc<Buffer>, buffer_offset: u64, ) -> Result<(), QueueWriteError>
pub fn write_texture( &self, destination: TexelCopyTextureInfo<Arc<Texture>>, data: &[u8], data_layout: &TexelCopyBufferLayout, size: &Extent3d, ) -> Result<(), QueueWriteError>
Sourcepub fn flush_writes_for_buffer(
&self,
buffer: &Arc<Buffer>,
snatch_guard: SnatchGuard<'_>,
) -> Result<(), BufferAccessError>
pub fn flush_writes_for_buffer( &self, buffer: &Arc<Buffer>, snatch_guard: SnatchGuard<'_>, ) -> Result<(), BufferAccessError>
Flush PendingWrites if it contains a write to buffer.
fn flush_pending_writes(&self) -> Result<Option<SubmissionIndex>, DeviceError>
fn trace_submission( &self, submit_index: SubmissionIndex, commands: Vec<Command<PointerReferences>>, )
trace only.fn trace_failed_submission( &self, submit_index: SubmissionIndex, commands: Option<Vec<Command<PointerReferences>>>, error: String, )
trace only.pub fn submit( &self, command_buffers: &[Arc<CommandBuffer>], ) -> Result<SubmissionIndex, (SubmissionIndex, QueueSubmitError)>
Sourcefn allocate_submission<'a>(
&'a self,
snatch_guard: SnatchGuard<'a>,
) -> Result<PendingSubmission<'a>, (SubmissionIndex, DeviceError)>
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.
Sourcefn submit_pending_submission<'a>(
&self,
pending_writes: MutexGuard<'_, PendingWrites>,
prepared: PendingSubmission<'a>,
) -> Result<SubmissionResult<'a>, DeviceError>
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_indexand registers the submission with the lifetime tracker. - Returns a
SubmissionResult, which contains the snatch guard and a downgradedFenceReadGuard.
pub fn get_timestamp_period(&self) -> f32
Sourcepub fn on_submitted_work_done(
&self,
closure: SubmittedWorkDoneClosure,
) -> Option<SubmissionIndex>
pub fn on_submitted_work_done( &self, closure: SubmittedWorkDoneClosure, ) -> Option<SubmissionIndex>
closure is guaranteed to be called.
pub fn compact_blas( &self, blas: &Arc<Blas>, ) -> Result<Arc<Blas>, CompactBlasError>
Trait Implementations§
Source§impl Labeled for Queue
impl Labeled for Queue
Source§fn label(&self) -> &str
fn label(&self) -> &str
fn error_ident(&self) -> ResourceErrorIdent
Source§impl ParentDevice for Queue
impl ParentDevice for 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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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