-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Make StartupSet
a base set
#7574
[Merged by Bors] - Make StartupSet
a base set
#7574
Conversation
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.
This is almost the correct set of changes, assuming that you didn't end up missing any uses :)
Base sets are intended to be "broad organization tools for schedules" that try to warn users about free-floating systems. I think this makes sense for both of these sets: running startup systems or rendering systems that are not ordered relative to these sets is likely to result in very surprising ambiguities.
To finish this up, just define a default base set for the CoreSchedule::Startup
. I don't think the RenderSchedule
should have one: there's no clear default.
Done. I think there is also an opportunity to make this more readable with system chaining, but the diff is quite large already so I'll do that in a follow-up PR. |
Whoops, I didn't mean to remove the review requests, and I also can't add them back. Sorry about that |
crates/bevy_render/src/lib.rs
Outdated
let mut schedule = Schedule::new(); | ||
|
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.
Does the render schedule have a default base set?
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.
No, I went by Alice's comment:
I don't think the
RenderSchedule
should have one: there's no clear default.
But I can add one if needed :)
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.
Looking at how rendering systems were defined and ordered, it wasn't at all clear what the correct "default" would be.
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.
Are there any errors that pop up if you add a system to a schedule that has base sets but doesn't pick one as default?
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.
How would I best test that?
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.
It should be as simple as trying render_schedule.add_system(my_system)
. I'm pretty sure that should error with something like "my_system needs to be put into a base set", but worth checking.
edit: tested this and it doesn't error. Feels like it should or why bother changing them to be base sets.
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.
It might make sense to change this to only change the startup schedule to use base sets, but move changing the render schedule to a different pr. Feels like there's a missing configuration option to require that a base set be set, but not set a default set.
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.
Ok, I reverted the RenderSet
changes and updated the PR description.
This reverts commit a01a0f0.
Totally fine with splitting out the |
StartupSet
and RenderSet
base setsStartupSet
a base set
Done. |
I "tested" the changes by running some random examples, it doesn't seem to crash. Question: With it being a base set, can |
This should be removed now :) |
Done, |
bors r+ |
# Objective Closes #7573 - Make `StartupSet` a base set ## Solution - Add `#[system_set(base)]` to the enum declaration - Replace `.in_set(StartupSet::...)` with `.in_base_set(StartupSet::...)` **Note**: I don't really know what I'm doing and what exactly the difference between base and non-base sets are. I mostly opened this PR based on discussion in Discord. I also don't really know how to test that I didn't break everything. Your reviews are appreciated! --- ## Changelog - `StartupSet` is now a base set ## Migration Guide `StartupSet` is now a base set. This means that you have to use `.in_base_set` instead of `.in_set`: ### Before ```rs app.add_system(foo.in_set(StartupSet::PreStartup)) ``` ### After ```rs app.add_system(foo.in_base_set(StartupSet::PreStartup)) ```
Pull request successfully merged into main. Build succeeded:
|
StartupSet
a base setStartupSet
a base set
# Objective Closes bevyengine#7573 - Make `StartupSet` a base set ## Solution - Add `#[system_set(base)]` to the enum declaration - Replace `.in_set(StartupSet::...)` with `.in_base_set(StartupSet::...)` **Note**: I don't really know what I'm doing and what exactly the difference between base and non-base sets are. I mostly opened this PR based on discussion in Discord. I also don't really know how to test that I didn't break everything. Your reviews are appreciated! --- ## Changelog - `StartupSet` is now a base set ## Migration Guide `StartupSet` is now a base set. This means that you have to use `.in_base_set` instead of `.in_set`: ### Before ```rs app.add_system(foo.in_set(StartupSet::PreStartup)) ``` ### After ```rs app.add_system(foo.in_base_set(StartupSet::PreStartup)) ```
Objective
Closes #7573
StartupSet
a base setSolution
#[system_set(base)]
to the enum declaration.in_set(StartupSet::...)
with.in_base_set(StartupSet::...)
Note: I don't really know what I'm doing and what exactly the difference between base and non-base sets are. I mostly opened this PR based on discussion in Discord. I also don't really know how to test that I didn't break everything. Your reviews are appreciated!
Changelog
StartupSet
is now a base setMigration Guide
StartupSet
is now a base set. This means that you have to use.in_base_set
instead of.in_set
:Before
After