Skip to content
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

Allow Material2dPipeline<M> softly allow error instead of early return #5374

Open
zimond opened this issue Jul 19, 2022 · 0 comments
Open

Allow Material2dPipeline<M> softly allow error instead of early return #5374

zimond opened this issue Jul 19, 2022 · 0 comments
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@zimond
Copy link

zimond commented Jul 19, 2022

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 the SpecializeMeshPipelines<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 a Mesh2dPipeline, 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 makes Material2dPipeline::<M>::specialize to return before calling M::specialize, which makes my approach fail. Code here

What 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 to SpecializedMeshPipelines and is also logged. So I think this is tolerable?

What alternative(s) have you considered?

  1. Rethink the whole thing about specialization and make it even easier to customize everything.
  2. Make Mesh2dPipeline accept optional uv / normal.

Additional context

N/A

@zimond zimond added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jul 19, 2022
@Weibye Weibye added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled C-Feature A new feature, making something new possible labels Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

No branches or pull requests

2 participants