TrackedRenderPass driven RenderPhases #7080
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
The current code for creating render passes and executing render phases is quite boilerplate-heavy and repetitive.
I have experimented with further improving the API, based on the proposal by @cart (posted in #7043 (comment)):
Solution
This PR comprises two changes:
1. The
RenderPhase
s are now executed directly using theTrackedRenderPass
, with the API described above.TrackedRenderPass
is associated with aview_entity
.view_entity
s in the render method ofDraw
functions. Instead, they can be accessed directly from theTrackedRenderPass
if they are needed.2. I have added a
TrackedRenderPass::create_for_camera
method, that sets up the render pass based on the camera view and depth target.I think that 1. is a good idea because from what I have gathered a
TrackedRenderPass
is always associated with aview_entity
anyway.IMO, 2. is less ideal and I am interested if you have got a better idea. There are just too many different components at play that might or might not be required. I still believe that setting up the render attachments in a way that is simpler and more clear is a worthwhile goal though.
Changelog
Todo
Migration Guide
Todo