Struct wgpu_core::device::queue::PendingWrites

source ·
pub(crate) struct PendingWrites {
    pub command_encoder: Box<dyn DynCommandEncoder>,
    pub is_recording: bool,
    temp_resources: Vec<TempResource>,
    dst_buffers: HashMap<TrackerIndex, Arc<Buffer>, BuildHasherDefault<FxHasher>>,
    dst_textures: HashMap<TrackerIndex, Arc<Texture>, BuildHasherDefault<FxHasher>>,
    dst_blas_s: HashMap<TrackerIndex, Arc<Blas>, BuildHasherDefault<FxHasher>>,
    dst_tlas_s: HashMap<TrackerIndex, Arc<Tlas>, BuildHasherDefault<FxHasher>>,
}
Expand description

A private command encoder for writes made directly on the device or queue.

Operations like buffer_unmap, queue_write_buffer, and queue_write_texture need to copy data to the GPU. At the hal level, this must be done by encoding and submitting commands, but these operations are not associated with any specific wgpu command buffer.

Instead, Device::pending_writes owns one of these values, which has its own hal command encoder and resource lists. The commands accumulated here are automatically submitted to the queue the next time the user submits a wgpu command buffer, ahead of the user’s commands.

Important: When locking pending_writes be sure that tracker is not locked and try to lock trackers for the minimum timespan possible

All uses of StagingBuffers end up here.

Fields§

§command_encoder: Box<dyn DynCommandEncoder>§is_recording: bool

True if command_encoder is in the “recording” state, as described in the docs for the wgpu_hal::CommandEncoder trait.

§temp_resources: Vec<TempResource>§dst_buffers: HashMap<TrackerIndex, Arc<Buffer>, BuildHasherDefault<FxHasher>>§dst_textures: HashMap<TrackerIndex, Arc<Texture>, BuildHasherDefault<FxHasher>>§dst_blas_s: HashMap<TrackerIndex, Arc<Blas>, BuildHasherDefault<FxHasher>>§dst_tlas_s: HashMap<TrackerIndex, Arc<Tlas>, BuildHasherDefault<FxHasher>>

Implementations§

source§

impl PendingWrites

source

pub fn new(command_encoder: Box<dyn DynCommandEncoder>) -> Self

source

pub fn insert_buffer(&mut self, buffer: &Arc<Buffer>)

source

pub fn insert_texture(&mut self, texture: &Arc<Texture>)

source

pub fn contains_buffer(&self, buffer: &Arc<Buffer>) -> bool

source

pub fn contains_texture(&self, texture: &Arc<Texture>) -> bool

source

pub fn insert_blas(&mut self, blas: &Arc<Blas>)

source

pub fn insert_tlas(&mut self, tlas: &Arc<Tlas>)

source

pub fn contains_blas(&mut self, blas: &Arc<Blas>) -> bool

source

pub fn contains_tlas(&mut self, tlas: &Arc<Tlas>) -> bool

source

pub fn consume_temp(&mut self, resource: TempResource)

source

pub fn consume(&mut self, buffer: FlushedStagingBuffer)

source

fn pre_submit( &mut self, command_allocator: &CommandAllocator, device: &Arc<Device>, queue: &Queue, ) -> Result<Option<EncoderInFlight>, DeviceError>

source

pub fn activate(&mut self) -> &mut dyn DynCommandEncoder

Trait Implementations§

source§

impl Debug for PendingWrites

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for PendingWrites

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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

source§

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, 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.
source§

impl<T> Upcast<T> for T

source§

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,