-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Run RenderStartup
in/before extract instead of after it.
#19926
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
Run RenderStartup
in/before extract instead of after it.
#19926
Conversation
62980f9
to
db24864
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with blocking extraction on that part personally. We can't really render anything anyway until those resources are initialized.
I'd prefer if the ecs folks reviewed this change though because I have no idea if it's correct to use FnMut here or if this approach fits in the context of everything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good solution to me, you kinda have to block on the first frame and FnMut is hardly a restriction in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, but fundamentally this strategy is totally fine from an ECS perspective. Mutating state in the ExtractFn doesn't cause any problems.
That said, the migration guide is missing advice on what happened to MainRender
.
@alice-i-cecile We also didn't add a migration guide for #19841, but I will write one as well as a release note before 0.17 (in a separate PR). I wanted to make more progress on these ports before I write it up. |
Objective
RenderStartup
runs afterExtractSchedule
#19910.Solution
RenderStartup
schedule in the extract function with a flag to only do it once.MainRender
stuff.One sad part here is that now the
RenderStartup
blocks extraction. So for pipelined rendering, our simulation will be blocked on the first frame while we set up all the rendering resources. I don't see this as a big loss though since A) that is fundamentally what we want here - extraction has to run afterRenderStartup
, and the only way to do better is to somehow runRenderStartup
in parallel with the first simulation frame, and B) withoutRenderStartup
the entire app was blocked on initializing render resources during Plugin construction - so we're not really losing anything here.Testing
custom_post_processing
example (which was ported to useRenderStartup
in Use RenderStartup in custom_post_processing example #19886) and it still works.