Trait wgpu_hal::CommandEncoder
source · pub trait CommandEncoder<A: Api>: Send + Sync + Debug {
Show 41 methods
// Required methods
unsafe fn begin_encoding(
&mut self,
label: Label<'_>
) -> Result<(), DeviceError>;
unsafe fn discard_encoding(&mut self);
unsafe fn end_encoding(&mut self) -> Result<A::CommandBuffer, DeviceError>;
unsafe fn reset_all<I>(&mut self, command_buffers: I)
where I: Iterator<Item = A::CommandBuffer>;
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
where T: Iterator<Item = BufferBarrier<'a, A>>;
unsafe fn transition_textures<'a, T>(&mut self, barriers: T)
where T: Iterator<Item = TextureBarrier<'a, A>>;
unsafe fn clear_buffer(&mut self, buffer: &A::Buffer, range: MemoryRange);
unsafe fn copy_buffer_to_buffer<T>(
&mut self,
src: &A::Buffer,
dst: &A::Buffer,
regions: T
)
where T: Iterator<Item = BufferCopy>;
unsafe fn copy_texture_to_texture<T>(
&mut self,
src: &A::Texture,
src_usage: TextureUses,
dst: &A::Texture,
regions: T
)
where T: Iterator<Item = TextureCopy>;
unsafe fn copy_buffer_to_texture<T>(
&mut self,
src: &A::Buffer,
dst: &A::Texture,
regions: T
)
where T: Iterator<Item = BufferTextureCopy>;
unsafe fn copy_texture_to_buffer<T>(
&mut self,
src: &A::Texture,
src_usage: TextureUses,
dst: &A::Buffer,
regions: T
)
where T: Iterator<Item = BufferTextureCopy>;
unsafe fn set_bind_group(
&mut self,
layout: &A::PipelineLayout,
index: u32,
group: &A::BindGroup,
dynamic_offsets: &[DynamicOffset]
);
unsafe fn set_push_constants(
&mut self,
layout: &A::PipelineLayout,
stages: ShaderStages,
offset: u32,
data: &[u32]
);
unsafe fn insert_debug_marker(&mut self, label: &str);
unsafe fn begin_debug_marker(&mut self, group_label: &str);
unsafe fn end_debug_marker(&mut self);
unsafe fn begin_query(&mut self, set: &A::QuerySet, index: u32);
unsafe fn end_query(&mut self, set: &A::QuerySet, index: u32);
unsafe fn write_timestamp(&mut self, set: &A::QuerySet, index: u32);
unsafe fn reset_queries(&mut self, set: &A::QuerySet, range: Range<u32>);
unsafe fn copy_query_results(
&mut self,
set: &A::QuerySet,
range: Range<u32>,
buffer: &A::Buffer,
offset: BufferAddress,
stride: BufferSize
);
unsafe fn begin_render_pass(&mut self, desc: &RenderPassDescriptor<'_, A>);
unsafe fn end_render_pass(&mut self);
unsafe fn set_render_pipeline(&mut self, pipeline: &A::RenderPipeline);
unsafe fn set_index_buffer<'a>(
&mut self,
binding: BufferBinding<'a, A>,
format: IndexFormat
);
unsafe fn set_vertex_buffer<'a>(
&mut self,
index: u32,
binding: BufferBinding<'a, A>
);
unsafe fn set_viewport(&mut self, rect: &Rect<f32>, depth_range: Range<f32>);
unsafe fn set_scissor_rect(&mut self, rect: &Rect<u32>);
unsafe fn set_stencil_reference(&mut self, value: u32);
unsafe fn set_blend_constants(&mut self, color: &[f32; 4]);
unsafe fn draw(
&mut self,
start_vertex: u32,
vertex_count: u32,
start_instance: u32,
instance_count: u32
);
unsafe fn draw_indexed(
&mut self,
start_index: u32,
index_count: u32,
base_vertex: i32,
start_instance: u32,
instance_count: u32
);
unsafe fn draw_indirect(
&mut self,
buffer: &A::Buffer,
offset: BufferAddress,
draw_count: u32
);
unsafe fn draw_indexed_indirect(
&mut self,
buffer: &A::Buffer,
offset: BufferAddress,
draw_count: u32
);
unsafe fn draw_indirect_count(
&mut self,
buffer: &A::Buffer,
offset: BufferAddress,
count_buffer: &A::Buffer,
count_offset: BufferAddress,
max_count: u32
);
unsafe fn draw_indexed_indirect_count(
&mut self,
buffer: &A::Buffer,
offset: BufferAddress,
count_buffer: &A::Buffer,
count_offset: BufferAddress,
max_count: u32
);
unsafe fn begin_compute_pass(&mut self, desc: &ComputePassDescriptor<'_>);
unsafe fn end_compute_pass(&mut self);
unsafe fn set_compute_pipeline(&mut self, pipeline: &A::ComputePipeline);
unsafe fn dispatch(&mut self, count: [u32; 3]);
unsafe fn dispatch_indirect(
&mut self,
buffer: &A::Buffer,
offset: BufferAddress
);
}
Expand description
Encoder for commands in command buffers.
Serves as a parent for all the encoded command buffers.
Works in bursts of action: one or more command buffers are recorded,
then submitted to a queue, and then it needs to be reset_all()
.
Required Methods§
sourceunsafe fn begin_encoding(&mut self, label: Label<'_>) -> Result<(), DeviceError>
unsafe fn begin_encoding(&mut self, label: Label<'_>) -> Result<(), DeviceError>
Begin encoding a new command buffer.
sourceunsafe fn discard_encoding(&mut self)
unsafe fn discard_encoding(&mut self)
Discard currently recorded list, if any.
unsafe fn end_encoding(&mut self) -> Result<A::CommandBuffer, DeviceError>
sourceunsafe fn reset_all<I>(&mut self, command_buffers: I)where
I: Iterator<Item = A::CommandBuffer>,
unsafe fn reset_all<I>(&mut self, command_buffers: I)where I: Iterator<Item = A::CommandBuffer>,
Reclaims all resources that are allocated for this encoder. Must get all of the produced command buffers back, and they must not be used by GPU at this moment.
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)where T: Iterator<Item = BufferBarrier<'a, A>>,
unsafe fn transition_textures<'a, T>(&mut self, barriers: T)where T: Iterator<Item = TextureBarrier<'a, A>>,
unsafe fn clear_buffer(&mut self, buffer: &A::Buffer, range: MemoryRange)
unsafe fn copy_buffer_to_buffer<T>( &mut self, src: &A::Buffer, dst: &A::Buffer, regions: T )where T: Iterator<Item = BufferCopy>,
sourceunsafe fn copy_texture_to_texture<T>(
&mut self,
src: &A::Texture,
src_usage: TextureUses,
dst: &A::Texture,
regions: T
)where
T: Iterator<Item = TextureCopy>,
unsafe fn copy_texture_to_texture<T>( &mut self, src: &A::Texture, src_usage: TextureUses, dst: &A::Texture, regions: T )where T: Iterator<Item = TextureCopy>,
Copy from one texture to another.
Works with a single array layer.
Note: dst
current usage has to be TextureUses::COPY_DST
.
Note: the copy extent is in physical size (rounded to the block size)
sourceunsafe fn copy_buffer_to_texture<T>(
&mut self,
src: &A::Buffer,
dst: &A::Texture,
regions: T
)where
T: Iterator<Item = BufferTextureCopy>,
unsafe fn copy_buffer_to_texture<T>( &mut self, src: &A::Buffer, dst: &A::Texture, regions: T )where T: Iterator<Item = BufferTextureCopy>,
Copy from buffer to texture.
Works with a single array layer.
Note: dst
current usage has to be TextureUses::COPY_DST
.
Note: the copy extent is in physical size (rounded to the block size)
sourceunsafe fn copy_texture_to_buffer<T>(
&mut self,
src: &A::Texture,
src_usage: TextureUses,
dst: &A::Buffer,
regions: T
)where
T: Iterator<Item = BufferTextureCopy>,
unsafe fn copy_texture_to_buffer<T>( &mut self, src: &A::Texture, src_usage: TextureUses, dst: &A::Buffer, regions: T )where T: Iterator<Item = BufferTextureCopy>,
Copy from texture to buffer. Works with a single array layer. Note: the copy extent is in physical size (rounded to the block size)
sourceunsafe fn set_bind_group(
&mut self,
layout: &A::PipelineLayout,
index: u32,
group: &A::BindGroup,
dynamic_offsets: &[DynamicOffset]
)
unsafe fn set_bind_group( &mut self, layout: &A::PipelineLayout, index: u32, group: &A::BindGroup, dynamic_offsets: &[DynamicOffset] )
Sets the bind group at index
to group
, assuming the layout
of all the preceeding groups to be taken from layout
.
unsafe fn set_push_constants( &mut self, layout: &A::PipelineLayout, stages: ShaderStages, offset: u32, data: &[u32] )
unsafe fn insert_debug_marker(&mut self, label: &str)
unsafe fn begin_debug_marker(&mut self, group_label: &str)
unsafe fn end_debug_marker(&mut self)
unsafe fn begin_query(&mut self, set: &A::QuerySet, index: u32)
unsafe fn end_query(&mut self, set: &A::QuerySet, index: u32)
unsafe fn write_timestamp(&mut self, set: &A::QuerySet, index: u32)
unsafe fn reset_queries(&mut self, set: &A::QuerySet, range: Range<u32>)
unsafe fn copy_query_results( &mut self, set: &A::QuerySet, range: Range<u32>, buffer: &A::Buffer, offset: BufferAddress, stride: BufferSize )
unsafe fn begin_render_pass(&mut self, desc: &RenderPassDescriptor<'_, A>)
unsafe fn end_render_pass(&mut self)
unsafe fn set_render_pipeline(&mut self, pipeline: &A::RenderPipeline)
unsafe fn set_index_buffer<'a>( &mut self, binding: BufferBinding<'a, A>, format: IndexFormat )
unsafe fn set_vertex_buffer<'a>( &mut self, index: u32, binding: BufferBinding<'a, A> )
unsafe fn set_viewport(&mut self, rect: &Rect<f32>, depth_range: Range<f32>)
unsafe fn set_scissor_rect(&mut self, rect: &Rect<u32>)
unsafe fn set_stencil_reference(&mut self, value: u32)
unsafe fn set_blend_constants(&mut self, color: &[f32; 4])
unsafe fn draw( &mut self, start_vertex: u32, vertex_count: u32, start_instance: u32, instance_count: u32 )
unsafe fn draw_indexed( &mut self, start_index: u32, index_count: u32, base_vertex: i32, start_instance: u32, instance_count: u32 )
unsafe fn draw_indirect( &mut self, buffer: &A::Buffer, offset: BufferAddress, draw_count: u32 )
unsafe fn draw_indexed_indirect( &mut self, buffer: &A::Buffer, offset: BufferAddress, draw_count: u32 )
unsafe fn draw_indirect_count( &mut self, buffer: &A::Buffer, offset: BufferAddress, count_buffer: &A::Buffer, count_offset: BufferAddress, max_count: u32 )
unsafe fn draw_indexed_indirect_count( &mut self, buffer: &A::Buffer, offset: BufferAddress, count_buffer: &A::Buffer, count_offset: BufferAddress, max_count: u32 )
unsafe fn begin_compute_pass(&mut self, desc: &ComputePassDescriptor<'_>)
unsafe fn end_compute_pass(&mut self)
unsafe fn set_compute_pipeline(&mut self, pipeline: &A::ComputePipeline)
unsafe fn dispatch(&mut self, count: [u32; 3])
unsafe fn dispatch_indirect( &mut self, buffer: &A::Buffer, offset: BufferAddress )
Implementors§
impl CommandEncoder<Api> for Encoder
impl CommandEncoder<Api> for wgpu_hal::gles::CommandEncoder
gles
only.impl CommandEncoder<Api> for wgpu_hal::vulkan::CommandEncoder
vulkan
only.