Skip to content

Commit

Permalink
TrackedRenderPass internal tracking state reset
Browse files Browse the repository at this point in the history
  • Loading branch information
PPakalns committed Aug 28, 2024
1 parent 4648f7b commit a9039b4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions crates/bevy_render/src/render_phase/draw_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ impl DrawState {
) -> bool {
self.index_buffer == Some((buffer, offset, index_format))
}

/// Resets tracking state
pub fn reset_tracking(&mut self) {
self.pipeline = None;
self.bind_groups.iter_mut().for_each(|val| {
val.0 = None;
val.1.clear();
});
self.vertex_buffers.iter_mut().for_each(|val| {
*val = None;
});
self.index_buffer = None;
}
}

/// A [`RenderPass`], which tracks the current pipeline state to skip redundant operations.
Expand Down Expand Up @@ -127,7 +140,15 @@ impl<'a> TrackedRenderPass<'a> {
}
}

/// Reset internal tracking state
pub fn reset_tracking(&mut self) {
self.state.reset_tracking();
}

/// Returns the wgpu [`RenderPass`].
///
/// If render pass state is modified using returned reference,
/// method [`TrackedRenderPass::reset_tracking`] may need to be called.
pub fn wgpu_pass(&mut self) -> &mut RenderPass<'a> {
&mut self.pass
}
Expand Down

0 comments on commit a9039b4

Please sign in to comment.