-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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 #7043
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
RenderPhase
s to share the sameRenderPass
.RenderPass
es recorded during each frame.Solution
TrackedRenderPass
instead of aRenderPassDiscriptor
as a parameter to theRenderPhase::render
method.Changelog
To enable multiple
RenderPhases
to share the sameTrackedRenderPass
,the
RenderPhase::render
signature has changed.