Add new render function for raw wgpu. #974
Merged
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.
Adds a new render function type to the app builder that allows access to raw
wgpu
resources and restores theFrame
concept for this function.We originally had to remove
Frame
as it no longer made sense in Bevy's pipelined render model. In Bevy,wgpu
resources are held in the render world, which means that we couldn't provide access to them in our defaultupdate
,view
, etc., functions. Additionally, because we now render into Bevy'sMesh
component, there was no need to access these lower levelwgpu
concepts inview
.However, some users may still want to manually wire everything up themselves, and for this, we now provide
render
.One major change here is the addition of a
RenderApp
type that mirrorsApp
. Not all methods fromApp
have been migrated here and due to the complexities of accessing the same data in the render world, we'll want to check to see what makes sense.One caveat that I'm still a little nervous about is that Bevy provides a lot of utilities for stuff like creating bind groups, etc., that our users could really benefit from. Adding this
render
fn is a good bridge to minimize breaking changes for our existing users, but part of me still feels like new users could benefit from the reduced boilerplate offered by Bevy. More to consider later.Notable changes:
render
your model must have aM: Clone
bound in order for it to be cloned into the render world. For the most part, this means puttingArc
around anywgpu
resources.wgpu
operations in the context of Bevy's broader pipeline, users who wish to use msaa need to target the resolve attachment rather than the intermediate texture view.How to review this:
Mostly you should look at the changes in
nannou/src
that show how we are wiring this into Bevy. The other changes are mostly just adding back thenannou_wgpu
crate and minor changes to the examples to get them to compile. Those examples can be manually diffed againstmaster
in a local checkout to see what changed.