[Merged by Bors] - Allow to reuse the same RenderPass for multiple RenderPhases#7043
[Merged by Bors] - Allow to reuse the same RenderPass for multiple RenderPhases#7043kurtkuehnert wants to merge 2 commits intobevyengine:mainfrom
Conversation
| .begin_render_pass(&pass_descriptor); | ||
| let mut render_pass = TrackedRenderPass::new(render_pass); | ||
|
|
||
| if let Some(viewport) = camera.viewport.as_ref() { |
There was a problem hiding this comment.
I consider losing the "auto camera viewport" stuff is a bit of a loss, as I suspect omitting this will be a common foot-gun / a source of "viewport mismatch" bugs. That being said, I also like that we've made this abstraction less opinionated, as there will be cases where we don't want this.
Not something we should do in this pr, but maybe we could have something like this / prefer its use where possible?
// This would create and set up a TrackedRenderPass, which would set the viewport, if it is
// configured on the camera. "pass" would need to be a wrapper over TrackedRenderPass.
let pass = camera.begin_render_pass(render_context, view_entity);
pass.render_phase(opaque_phase, world);There was a problem hiding this comment.
Having another pass wrapper type seems a bit bleh, so its worth trying to find a way to remove the need for that.
There was a problem hiding this comment.
That is an interesting idea. I like it!
If we want to automatically configure the pass based on the camera, then we will have to supply multiple components or a query, though.
Why couldn't we use the TrackedRenderPass directly or an extension trait?
I think I will play around with this idea tomorrow.
|
bors r+ |
# Objective - The recently merged PR #7013 does not allow multiple `RenderPhase`s to share the same `RenderPass`. - Due to the introduced overhead we want to minimize the number of `RenderPass`es recorded during each frame. ## Solution - Take a constructed `TrackedRenderPass` instead of a `RenderPassDiscriptor` as a parameter to the `RenderPhase::render` method. --- ## Changelog To enable multiple `RenderPhases` to share the same `TrackedRenderPass`, the `RenderPhase::render` signature has changed. ```rust pub fn render<'w>( &self, render_pass: &mut TrackedRenderPass<'w>, world: &'w World, view: Entity) ``` Co-authored-by: Kurt Kühnert <51823519+kurtkuehnert@users.noreply.github.com>
|
Pull request successfully merged into main. Build succeeded! And happy new year! 🎉
|
…ine#7043) # Objective - The recently merged PR bevyengine#7013 does not allow multiple `RenderPhase`s to share the same `RenderPass`. - Due to the introduced overhead we want to minimize the number of `RenderPass`es recorded during each frame. ## Solution - Take a constructed `TrackedRenderPass` instead of a `RenderPassDiscriptor` as a parameter to the `RenderPhase::render` method. --- ## Changelog To enable multiple `RenderPhases` to share the same `TrackedRenderPass`, the `RenderPhase::render` signature has changed. ```rust pub fn render<'w>( &self, render_pass: &mut TrackedRenderPass<'w>, world: &'w World, view: Entity) ``` Co-authored-by: Kurt Kühnert <51823519+kurtkuehnert@users.noreply.github.com>
…ine#7043) # Objective - The recently merged PR bevyengine#7013 does not allow multiple `RenderPhase`s to share the same `RenderPass`. - Due to the introduced overhead we want to minimize the number of `RenderPass`es recorded during each frame. ## Solution - Take a constructed `TrackedRenderPass` instead of a `RenderPassDiscriptor` as a parameter to the `RenderPhase::render` method. --- ## Changelog To enable multiple `RenderPhases` to share the same `TrackedRenderPass`, the `RenderPhase::render` signature has changed. ```rust pub fn render<'w>( &self, render_pass: &mut TrackedRenderPass<'w>, world: &'w World, view: Entity) ``` Co-authored-by: Kurt Kühnert <51823519+kurtkuehnert@users.noreply.github.com>
Objective
RenderPhases to share the sameRenderPass.RenderPasses recorded during each frame.Solution
TrackedRenderPassinstead of aRenderPassDiscriptoras a parameter to theRenderPhase::rendermethod.Changelog
To enable multiple
RenderPhasesto share the sameTrackedRenderPass,the
RenderPhase::rendersignature has changed.