Skip to main content

CommandEncoder

Struct CommandEncoder 

Source
pub struct CommandEncoder<'a> { /* private fields */ }
Expand description

records commands; finish() makes a CommandBuffer for Queue::submit

Implementations§

Source§

impl<'a> CommandEncoder<'a>

Source

pub fn copy_buffer( &mut self, src: &'a Buffer, src_off: u64, dst: &'a Buffer, dst_off: u64, size: u64, )

Source

pub fn fill_buffer( &mut self, buf: &'a Buffer, offset: u64, size: u64, value: u32, )

fill size bytes at offset with a 32-bit value (both multiples of 4)

Source

pub fn copy_buffer_to_texture( &mut self, src: &'a Buffer, layout: DataLayout, dst: TextureRegion<'a>, )

buffer data -> a texture region (the region in Layout::CopyDst)

Source

pub fn copy_texture_to_buffer( &mut self, src: TextureRegion<'a>, dst: &'a Buffer, layout: DataLayout, )

a texture region -> buffer data (the region in Layout::CopySrc)

Source

pub fn barrier(&mut self, before: Access, after: Access)

the accesses before finish (and their writes become visible) before the after ones

Source

pub fn texture_barrier( &mut self, tex: &'a Texture, before: Layout, after: Layout, )

every mip and layer of tex from before to after

Source

pub fn texture_barrier_range( &mut self, tex: &'a Texture, base_mip: u32, mips: u32, base_layer: u32, layers: u32, before: Layout, after: Layout, )

mips base_mip .. +mips and layers base_layer .. +layers of tex from before to after

Source

pub fn set_compute_pipeline(&mut self, p: &'a ComputePipeline)

Source

pub fn set_bind_group(&mut self, index: u32, group: &'a BindGroup)

bind group g (= @group(g)) of the current pipeline’s layout

Source

pub fn push_constants<T: Pod>(&mut self, offset: u32, data: &[T])

push constants at offset (bytes) for the current pipeline

Source

pub fn dispatch(&mut self, x: u32, y: u32, z: u32)

Source

pub fn dispatch_indirect(&mut self, buf: &'a Buffer, offset: u64)

workgroup counts (3 x u32) from buf at offset

Source

pub fn begin_render(&mut self, desc: &RenderPassDesc<'_, 'a>)

Source

pub fn end_render(&mut self)

Source

pub fn set_render_pipeline(&mut self, p: &'a RenderPipeline)

Source

pub fn set_viewport( &mut self, x: f32, y: f32, w: f32, h: f32, min_depth: f32, max_depth: f32, )

the viewport in pixels from the top left (depth range min ..= max)

Source

pub fn set_scissor(&mut self, x: u32, y: u32, w: u32, h: u32)

Source

pub fn set_vertex_buffer(&mut self, slot: u32, buf: &'a Buffer, offset: u64)

Source

pub fn set_index_buffer( &mut self, buf: &'a Buffer, offset: u64, format: IndexFormat, )

Source

pub fn draw( &mut self, vertices: u32, instances: u32, first_vertex: u32, first_instance: u32, )

Source

pub fn draw_indexed( &mut self, indices: u32, instances: u32, first_index: u32, base_vertex: i32, first_instance: u32, )

Source

pub fn draw_indirect(&mut self, buf: &'a Buffer, offset: u64)

one draw: vertex count, instance count, first vertex, first instance (4 x u32)

Source

pub fn draw_indexed_indirect(&mut self, buf: &'a Buffer, offset: u64)

one indexed draw: index count, instance count, first index, base vertex (i32), first instance (5 x 32 bits)

Source

pub fn draw_indexed_indirect_multi( &mut self, buf: &'a Buffer, offset: u64, count: u32, stride: u32, )

count indexed draws, stride bytes apart (Features::multi_draw_indirect)

Source

pub fn draw_indexed_indirect_count( &mut self, buf: &'a Buffer, offset: u64, count_buf: &'a Buffer, count_offset: u64, max_count: u32, stride: u32, )

up to max_count indexed draws, their number (u32) read from count_buf at count_offset (level Voll: Features::draw_indirect_count)

Source

pub fn reset_timestamps(&mut self, ts: &'a Timestamps, first: u32, n: u32)

timestamps first .. first + n may be written again (outside render passes)

Source

pub fn timestamp(&mut self, ts: &'a Timestamps, i: u32)

write timestamp i once every earlier command has finished (reset it first)

Source

pub fn finish(self) -> Result<CommandBuffer<'a>>

the recorded commands, or the first misuse

Trait Implementations§

Source§

impl Drop for CommandEncoder<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for CommandEncoder<'a>

§

impl<'a> !UnwindSafe for CommandEncoder<'a>

§

impl<'a> Forget for CommandEncoder<'a>

§

impl<'a> Freeze for CommandEncoder<'a>

§

impl<'a> Send for CommandEncoder<'a>

§

impl<'a> Sync for CommandEncoder<'a>

§

impl<'a> Unpin for CommandEncoder<'a>

§

impl<'a> UnsafeUnpin for CommandEncoder<'a>

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.