Allow Material2dPipeline<M>
softly allow error instead of early return
#5374
Labels
A-Rendering
Drawing game state to the screen
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
I'm doing 2D vector graph rendering and don't need uv/normals (basically what
bevy_lyon_prototype
is doing now), but need a material for masking. Before the recent material rework with #5053 and #5312 , a custom pipeline would suffice. After the new material system is landed, I think I could use a custom material, and take advantage of theSpecializeMeshPipelines<Material2dPipeline<CustomMaterial>>
instead of manually copy all the code of them just to remove uv/normal vertex data. Because the new Material2dPipeline is quite different and contains a lot of new code, copy-pasting them seems so dumb.But the problem is,
Material2dPipeline<M>
wraps aMesh2dPipeline
, which currently asks for vertex position, uv, normals to create the default layout. If any of the 3 is missing, an error is returned, which makesMaterial2dPipeline::<M>::specialize
to return before callingM::specialize
, which makes my approach fail. Code hereWhat solution would you like?
I think maybe Material2dPipeline could just log the error and continue, at least call
M::specialize()
? Currently the error is propagated toSpecializedMeshPipelines
and is also logged. So I think this is tolerable?What alternative(s) have you considered?
Mesh2dPipeline
accept optional uv / normal.Additional context
N/A
The text was updated successfully, but these errors were encountered: