CommandEncoder

Struct CommandEncoder 

Source
pub struct CommandEncoder {
    pub(crate) device: Arc<Device>,
    pub(crate) label: String,
    pub(crate) data: Mutex<CommandEncoderStatus>,
}

Fields§

§device: Arc<Device>§label: String§data: Mutex<CommandEncoderStatus>

The mutable state of this command encoder.

Implementations§

Source§

impl CommandEncoder

Source

pub unsafe fn as_hal_mut<A: Api, F: FnOnce(Option<&mut A::CommandEncoder>) -> R, R>( self: &Arc<Self>, hal_command_encoder_callback: F, ) -> R

Encode commands using the raw HAL command encoder.

§Panics

If the command encoder has already been used with the wgpu encoding API.

§Safety
  • The raw command encoder handle must not be manually destroyed
Source§

impl CommandEncoder

Source

pub fn clear_buffer( self: &Arc<Self>, dst: Arc<Buffer>, offset: BufferAddress, size: Option<BufferAddress>, ) -> Result<(), EncoderStateError>

Source

pub fn clear_texture( self: &Arc<Self>, dst: Arc<Texture>, subresource_range: &ImageSubresourceRange, ) -> Result<(), EncoderStateError>

Source§

impl CommandEncoder

Source§

impl CommandEncoder

Source

pub fn write_timestamp( self: &Arc<Self>, query_set: Arc<QuerySet>, query_index: u32, ) -> Result<(), EncoderStateError>

Source

pub fn resolve_query_set( self: &Arc<Self>, query_set: Arc<QuerySet>, start_query: u32, query_count: u32, destination: Arc<Buffer>, destination_offset: BufferAddress, ) -> Result<(), EncoderStateError>

Source§

impl CommandEncoder

Source

pub fn mark_acceleration_structures_built( self: &Arc<Self>, blases: &[Arc<Blas>], tlases: &[Arc<Tlas>], ) -> Result<(), EncoderStateError>

Source

pub fn build_acceleration_structures<'a>( self: &Arc<Self>, blas_iter: impl Iterator<Item = BlasBuildEntry<'a, Arc<Blas>, Arc<Buffer>>>, tlas_iter: impl Iterator<Item = TlasPackage<'a, Arc<Tlas>, Arc<Blas>>>, ) -> Result<(), EncoderStateError>

Source§

impl CommandEncoder

Source§

impl CommandEncoder

Source

pub fn copy_buffer_to_buffer( self: &Arc<Self>, source: Arc<Buffer>, source_offset: BufferAddress, destination: Arc<Buffer>, destination_offset: BufferAddress, size: Option<BufferAddress>, ) -> Result<(), EncoderStateError>

Source

pub fn copy_buffer_to_texture( self: &Arc<Self>, source: &TexelCopyBufferInfo<Arc<Buffer>>, destination: &TexelCopyTextureInfo<Arc<Texture>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Source

pub fn copy_texture_to_buffer( self: &Arc<Self>, source: &TexelCopyTextureInfo<Arc<Texture>>, destination: &TexelCopyBufferInfo<Arc<Buffer>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Source

pub fn copy_texture_to_texture( self: &Arc<Self>, source: &TexelCopyTextureInfo<Arc<Texture>>, destination: &TexelCopyTextureInfo<Arc<Texture>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Source§

impl CommandEncoder

Source

pub fn transition_resources( self: &Arc<Self>, buffer_transitions: impl Iterator<Item = BufferTransition<Arc<Buffer>>>, texture_transitions: impl Iterator<Item = TextureTransition<Arc<Texture>>>, ) -> Result<(), EncoderStateError>

Source§

impl CommandEncoder

Source

pub(crate) fn new( encoder: Box<dyn DynCommandEncoder>, device: &Arc<Device>, label: &Label<'_>, ) -> Self

Source

pub(crate) fn new_invalid( device: &Arc<Device>, label: &Label<'_>, err: CommandEncoderError, ) -> Arc<Self>

Source

pub(crate) fn validate_pass_timestamp_writes<E>( device: &Device, timestamp_writes: &PassTimestampWrites<Arc<QuerySet>>, ) -> Result<PassTimestampWrites<Arc<QuerySet>>, E>

Source

pub(crate) fn insert_barriers_from_tracker( raw: &mut dyn DynCommandEncoder, base: &mut Tracker, head: &Tracker, snatch_guard: &SnatchGuard<'_>, )

Source

pub(crate) fn insert_barriers_from_scope( raw: &mut dyn DynCommandEncoder, base: &mut Tracker, head: &UsageScope<'_>, snatch_guard: &SnatchGuard<'_>, )

Source

pub(crate) fn drain_barriers( raw: &mut dyn DynCommandEncoder, base: &mut Tracker, snatch_guard: &SnatchGuard<'_>, )

Source

pub(crate) fn insert_barriers_from_device_tracker( raw: &mut dyn DynCommandEncoder, base: &mut DeviceTracker, head: &Tracker, snatch_guard: &SnatchGuard<'_>, )

Source

fn encode_commands( device: &Arc<Device>, cmd_buf_data: &mut CommandBufferMutable, ) -> Result<(), CommandEncoderError>

Source

pub fn finish( self: &Arc<Self>, desc: &CommandBufferDescriptor<Label<'_>>, ) -> (Arc<CommandBuffer>, Option<(String, CommandEncoderError)>)

Finishes a command encoder, creating a command buffer and returning errors that were deferred until now.

The returned String is the label of the command encoder, supplied so that wgpu can include the label when printing deferred errors without having its own copy of the label. This is a kludge and should be replaced if we think of a better solution to propagating labels.

Source§

impl CommandEncoder

Source

pub fn push_debug_group( self: &Arc<Self>, label: &str, ) -> Result<(), EncoderStateError>

Source

pub fn insert_debug_marker( self: &Arc<Self>, label: &str, ) -> Result<(), EncoderStateError>

Source

pub fn pop_debug_group(self: &Arc<Self>) -> Result<(), EncoderStateError>

Trait Implementations§

Source§

impl Drop for CommandEncoder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Labeled for CommandEncoder

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 CommandEncoder

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 CommandEncoder

Source§

const TYPE: &'static str = "CommandEncoder"

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
§

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>

§

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

§

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

§

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

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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