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
To simplify the effort required to create and add a custom mesh pipeline.
Replaces #21880
Closes #21127
Solution
Add
MeshPassPluginto handle the extract, specialize, and queue stages required to create a new mesh pipeline.Usage:
Details
For more details, please refer to custom_mesh_pass.rs.
In this version of MeshPass, we have removed the cumbersome
Option<Res<PhasesN<MP>>>. Instead, we utilizeall_tuples!to implement the required methods directly on theQueryItemof(&mut RenderPhase, ...)and call them within thequeue_material_meshessystem. This approach nearly eliminates all boilerplate code while still maintaining static dispatch.Yes, this approach is based on making
XXXRenderPhasea component. The main reason is: while we could do something similar with(ResMut<ViewXXXRenderPhases<T>>, ...), we would need to handle multiple layers of conversion from(ResMut<ViewXXXRenderPhases<T>>, ...)to(Option<&mut XXXRenderPhase<T>>, ...). To address this, we would have to write more traits and macros, which would be difficult to maintain. The flatXXXRenderPhasestructure avoids this issue, making the implementation more straightforward and simpler.Testing
I ran the examples for the modules affected by this migration and did not observe any breaks.
Showcase
Details