pub trait RenderPass<'pass> {
// Required methods
fn set_pipeline(&mut self, pipeline: &'pass RenderPipelineId);
fn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId);
fn set_vertex_buffer(
&mut self,
slot: u32,
buffer: &'pass BufferId,
offset: u64,
);
fn set_index_buffer(
&mut self,
buffer: &'pass BufferId,
offset: u64,
index_format: IndexFormat,
);
fn draw(&mut self, vertices: Range<u32>, instances: Range<u32>);
fn draw_indexed(
&mut self,
indices: Range<u32>,
base_vertex: i32,
instances: Range<u32>,
);
}Expand description
A trait representing an active render pass, used for recording drawing commands.
A RenderPass object is obtained from a CommandEncoder and provides methods
to set pipeline state (e.g., pipeline, vertex/index buffers) and issue draw calls.
The 'pass lifetime ensures that the pass object cannot outlive the CommandEncoder
that created it, and that any resources bound to it (like buffers) also live long enough.
Required Methods§
Sourcefn set_pipeline(&mut self, pipeline: &'pass RenderPipelineId)
fn set_pipeline(&mut self, pipeline: &'pass RenderPipelineId)
Sets the active render pipeline for subsequent draw calls.
Sourcefn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId)
fn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId)
Binds a bind group to a specific binding slot.
§Arguments
index- The bind group index (must match shader @group(N) declarations)bind_group- The bind group to bind
Sourcefn set_vertex_buffer(&mut self, slot: u32, buffer: &'pass BufferId, offset: u64)
fn set_vertex_buffer(&mut self, slot: u32, buffer: &'pass BufferId, offset: u64)
Binds a vertex buffer to a specific slot.
Sourcefn set_index_buffer(
&mut self,
buffer: &'pass BufferId,
offset: u64,
index_format: IndexFormat,
)
fn set_index_buffer( &mut self, buffer: &'pass BufferId, offset: u64, index_format: IndexFormat, )
Binds an index buffer for indexed drawing.