# TrackedRenderPass in maplibre::render::resource::tracked_render_pass - Rust
A [`RenderPass`], which tracks the current pipeline state to ensure all draw calls are valid. It is used to set the current [`RenderPipeline`], `BindGroups` and buffers. After all requirements are specified, draw calls can be issued.
Keywords: rust, rustlang, rust-lang, TrackedRenderPass

# Struct maplibre::render::resource::tracked_render_pass::TrackedRenderPass

source · [−]

    pub struct TrackedRenderPass<'a> {
        pass: RenderPass<'a>,
    }

Expand description

A [`RenderPass`], which tracks the current pipeline state to ensure all draw calls are valid. It is used to set the current [`RenderPipeline`], `BindGroups` and buffers. After all requirements are specified, draw calls can be issued.

## Fields

`pass: RenderPass<'a>`

## Implementations

source

### impl<'a> TrackedRenderPass<'a>

source

#### pub fn new(pass: RenderPass<'a>) -> Self

Tracks the supplied render pass.

source

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

Sets the active [`RenderPipeline`].

Subsequent draw calls will exhibit the behavior defined by the `pipeline`.

source

#### pub fn set_bind_group(
&mut self,
index: usize,
bind_group: &'a BindGroup,
dynamic_uniform_indices: &[ u32 ]
)

Sets the active [`BindGroup`] for a given bind group index. The bind group layout in the active pipeline when any `draw()` function is called must match the layout of this `bind group`.

source

#### pub fn set_vertex_buffer(
&mut self,
slot_index: usize,
buffer_slice: BufferSlice<'a>
)

Assign a vertex buffer to a slot.

Subsequent calls to `TrackedRenderPass::draw` and `TrackedRenderPass::draw_indexed` will use the buffer referenced by `buffer_slice` as one of the source vertex buffer(s).

The `slot_index` refers to the index of the matching descriptor in `VertexState::buffers`.

source

#### pub fn set_index_buffer(
&mut self,
buffer_slice: BufferSlice<'a>,
index_format: IndexFormat
)

Sets the active index buffer.

Subsequent calls to `TrackedRenderPass::draw_indexed` will use the buffer referenced by `buffer_slice` as the source index buffer.

source

#### pub fn draw(&mut self, vertices: Range<u32>, instances: Range<u32>)

Draws primitives from the active vertex buffer(s).

The active vertex buffer(s) can be set with `TrackedRenderPass::set_vertex_buffer`.

source

#### pub fn draw_indexed(
&mut self,
indices: Range<u32>,
base_vertex: i32,
instances: Range<u32>
)

Draws indexed primitives using the active index buffer and the active vertex buffer(s).

The active index buffer can be set with `TrackedRenderPass::set_index_buffer`, while the active vertex buffer(s) can be set with `TrackedRenderPass::set_vertex_buffer`.

source

#### pub fn draw_indirect(
&mut self,
indirect_buffer: &'a Buffer,
indirect_offset: u64
)

Draws primitives from the active vertex buffer(s) based on the contents of the `indirect_buffer`.

The active vertex buffers can be set with `TrackedRenderPass::set_vertex_buffer`.

The structure expected in `indirect_buffer` is the following:

    #[repr(C)]
    struct DrawIndirect {
        vertex_count: u32, // The number of vertices to draw.
        instance_count: u32, // The number of instances to draw.
        first_vertex: u32, // The Index of the first vertex to draw.
        first_instance: u32, // The instance ID of the first instance to draw.
        // has to be 0, unless [`Features::INDIRECT_FIRST_INSTANCE`] is enabled.
    }

source

#### pub fn draw_indexed_indirect(
&mut self,
indirect_buffer: &'a Buffer,
indirect_offset: u64
)

Draws indexed primitives using the active index buffer and the active vertex buffers, based on the contents of the `indirect_buffer`.

The active index buffer can be set with `TrackedRenderPass::set_index_buffer`, while the active vertex buffers can be set with `TrackedRenderPass::set_vertex_buffer`.

The structure expected in `indirect_buffer` is the following:

    #[repr(C)]
    struct DrawIndexedIndirect {
        vertex_count: u32, // The number of vertices to draw.
        instance_count: u32, // The number of instances to draw.
        first_index: u32, // The base index within the index buffer.
        vertex_offset: i32, // The value added to the vertex index before indexing into the vertex buffer.
        first_instance: u32, // The instance ID of the first instance to draw.
        // has to be 0, unless [`Features::INDIRECT_FIRST_INSTANCE`] is enabled.
    }

source

#### pub fn set_stencil_reference(&mut self, reference: u32)

Sets the stencil reference.

Subsequent stencil tests will test against this value.

source

#### pub fn set_scissor_rect(&mut self, x: u32, y: u32, width: u32, height: u32)

Sets the scissor region.

Subsequent draw calls will discard any fragments that fall outside this region.

source

#### pub fn set_push_constants(
&mut self,
stages: ShaderStages,
offset: u32,
data: &[ u8 ]
)

Set push constant data.

`Features::PUSH_CONSTANTS` must be enabled on the device in order to call these functions.

source

#### pub fn set_viewport(
&mut self,
x: f32,
y: f32,
width: f32,
height: f32,
min_depth: f32,
max_depth: f32
)

Set the rendering viewport.

Subsequent draw calls will be projected into that viewport.

source

#### pub fn insert_debug_marker(&mut self, label: &str)

Insert a single debug marker.

This is a GPU debugging feature. This has no effect on the rendering itself.

source

#### pub fn push_debug_group(&mut self, label: &str)

Start a new debug group.

Push a new debug group over the internal stack. Subsequent render commands and debug markers are grouped into this new group, until `pop_debug_group` is called.

    pass.push_debug_group("Render the car");
    // [setup pipeline etc...]
    pass.draw(0..64, 0..1);
    pass.pop_debug_group();

Note that `push_debug_group` and `pop_debug_group` must always be called in pairs.

This is a GPU debugging feature. This has no effect on the rendering itself.

source

#### pub fn pop_debug_group(&mut self)

End the current debug group.

Subsequent render commands and debug markers are not grouped anymore in this group, but in the previous one (if any) or the default top-level one if the debug group was the last one on the stack.

Note that `push_debug_group` and `pop_debug_group` must always be called in pairs.

This is a GPU debugging feature. This has no effect on the rendering itself.

source

#### pub fn set_blend_constant(&mut self, color: Color)

## Auto Trait Implementations

### impl<'a> !RefUnwindSafe for TrackedRenderPass<'a>

### impl<'a> Send for TrackedRenderPass<'a>

### impl<'a> Sync for TrackedRenderPass<'a>

### impl<'a> Unpin for TrackedRenderPass<'a>

### impl<'a> !UnwindSafe for TrackedRenderPass<'a>

## Blanket Implementations

source

### impl<T> Any for T where
T: 'static + ?Sized,

source

#### pub fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more

source

### impl<T> Borrow<T> for T where
T: ?Sized,

const: unstable · source

#### pub fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

### impl<T> BorrowMut<T> for T where
T: ?Sized,

const: unstable · source

#### pub fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

### impl<T> Downcast for T where
T: Any,

#### pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert `Box<dyn Trait>` (where `Trait: Downcast`) to `Box<dyn Any>`. `Box<dyn Any>` can then be further `downcast` into `Box<ConcreteType>` where `ConcreteType` implements `Trait`. Read more

#### pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert `Rc<Trait>` (where `Trait: Downcast`) to `Rc<Any>`. `Rc<Any>` can then be further `downcast` into `Rc<ConcreteType>` where `ConcreteType` implements `Trait`. Read more

#### pub fn as_any(&self) -> &(dyn Any + 'static)

Convert `&Trait` (where `Trait: Downcast`) to `&Any`. This is needed since Rust cannot generate `&Any`’s vtable from `&Trait`’s. Read more

#### pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert `&mut Trait` (where `Trait: Downcast`) to `&Any`. This is needed since Rust cannot generate `&mut Any`’s vtable from `&mut Trait`’s. Read more

### impl<T> Downcast<T> for T

#### pub fn downcast(&self) -> &T

### impl<T> DowncastSync for T where
T: Any + Send + Sync,

#### pub fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert `Arc<Trait>` (where `Trait: Downcast`) to `Arc<Any>`. `Arc<Any>` can then be further `downcast` into `Arc<ConcreteType>` where `ConcreteType` implements `Trait`. Read more

source

### impl<T> From<T> for T

const: unstable · source

#### pub fn from(t: T) -> T

Returns the argument unchanged.

source

### impl<T> Instrument for T

source

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more

source

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more

source

### impl<T, U> Into<U> for T where
U: From<T>,

const: unstable · source

#### pub 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> Same<T> for T

#### type Output = T

Should always be `Self`

source

### impl<T, U> TryFrom<U> for T where
U: Into<T>,

#### type Error = Infallible

The type returned in the event of a conversion error.

const: unstable · source

#### pub 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>,

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

const: unstable · source

#### pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

### impl<T> Upcast<T> for T

#### pub fn upcast(&self) -> Option<&T>

source

### impl<T> WithSubscriber for T

source

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more

source

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more