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>>,
copied_blas_s: HashMap<TrackerIndex, Arc<Blas>, BuildHasherDefault<FxHasher>>,
instance_flags: InstanceFlags,
}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: boolTrue 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>>§copied_blas_s: HashMap<TrackerIndex, Arc<Blas>, BuildHasherDefault<FxHasher>>§instance_flags: InstanceFlagsImplementations§
Source§impl PendingWrites
impl PendingWrites
pub fn new( command_encoder: Box<dyn DynCommandEncoder>, instance_flags: InstanceFlags, ) -> Self
pub fn insert_buffer(&mut self, buffer: &Arc<Buffer>)
pub fn insert_texture(&mut self, texture: &Arc<Texture>)
pub fn insert_blas(&mut self, blas: &Arc<Blas>)
pub fn contains_buffer(&self, buffer: &Arc<Buffer>) -> bool
pub fn contains_texture(&self, texture: &Arc<Texture>) -> bool
pub fn consume_temp(&mut self, resource: TempResource)
pub fn consume(&mut self, buffer: FlushedStagingBuffer)
fn pre_submit( &mut self, command_allocator: &CommandAllocator, device: &Arc<Device>, queue: &Queue, ) -> Result<Option<EncoderInFlight>, DeviceError>
pub fn activate(&mut self) -> &mut dyn DynCommandEncoder
Trait Implementations§
Source§impl Debug for PendingWrites
impl Debug for PendingWrites
Auto Trait Implementations§
impl Freeze for PendingWrites
impl !RefUnwindSafe for PendingWrites
impl Send for PendingWrites
impl Sync for PendingWrites
impl Unpin for PendingWrites
impl !UnwindSafe for PendingWrites
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