-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 criteria multipiping #2446
Run criteria multipiping #2446
Conversation
wouldn't that be a join rather than a pipe ? |
Hm, I can see it like that. Although, as per previous discussion, I think it's pretty important to highlight the, well, piping of outputs into an input, rather than the order of operations alone. |
bors try |
tryMerge conflict. |
# Conflicts: # crates/bevy_ecs/src/schedule/stage.rs
.iter() | ||
.take(self.inner.parents_len()) | ||
.map(|label| { | ||
*labels.get(label).unwrap_or_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.
Nit: can't we just use expect
here?
Nope, apparently this way dodges string formatting costs: https://stackoverflow.com/a/63291643/3234149
Great code quality, as always. The multi-piping API is nice (and a very natural extension), the system yeet is 💯. |
Adding to 0.6 milestone for the optional .system aspects. If the rest of the PR is controversial, we can split this out. |
# Objective - Continue work of #2398 and friends. - Make `.system()` optional in chaining. ## Solution - Slight change to `IntoChainSystem` signature and implementation. - Remove some usages of `.system()` in the chaining example, to verify the implementation. --- I swear, I'm not splitting these up on purpose, I just legit forgot about most of the things where `System` appears in public API, and my trait usage explorer mingles that with the gajillion internal uses. In case you're wondering what happened to part 5, #2446 ate it.
# Objective - Continue work of bevyengine#2398 and friends. - Make `.system()` optional in chaining. ## Solution - Slight change to `IntoChainSystem` signature and implementation. - Remove some usages of `.system()` in the chaining example, to verify the implementation. --- I swear, I'm not splitting these up on purpose, I just legit forgot about most of the things where `System` appears in public API, and my trait usage explorer mingles that with the gajillion internal uses. In case you're wondering what happened to part 5, bevyengine#2446 ate it.
# Objective - Remove all the `.system()` possible. - Check for remaining missing cases. ## Solution - Remove all `.system()`, fix compile errors - 32 calls to `.system()` remains, mostly internals, the few others should be removed after #2446
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 excellent and enables some nice use cases, thanks a lot!
Removed from the 0.6 milestone in the interest of time. Pipes are pretty niche, so requiring |
Pulling in bevyengine/rfcs#45 participants: @alice-i-cecile @DJMcNab @inodentry @maniwani @hymm |
The current plans there are that run criteria automatically compose with AND. Run criteria can no longer loop, so this simple rule is sufficient (at least for a first attempt). |
Testing @bevyengine/ecs-team pings |
So in current Bevy, RC can be referenced by label (like any other system) and they're collectively evaluated at the beginning of each stage. Both of those properties go away in the RFC. Instead, each system gets its own instances of any RC it's been assigned. And the new definition is that all of a system's RC must return Current plan is to have the executor evaluate all of a system's RC inside the main executor task, after that system becomes ready (none of its dependencies remain). If both system + all its RC can run, the RC is ran first. If all return For toggling a group of systems, users can assign RC to labels (which conceptually map to sub-graphs in the overall system graph). When the executor encounters a ready system with "not-yet-seen" labels, it checks if system + all its RC + all not-yet-seen label RC can run. If so, the label RC is ran first. All systems with the labels whose RC returned Edit: tl;dr direct RC piping goes away. That said, users can have a system writing some resource that later RC instances just read. We're hoping that the read-only access and lack of task overhead counterbalances the inability to share RC (except indirectly through labels). |
I'm going to close this out: I think it's increasingly unlikely that we go with this particular design and #4391 solves the underlying problem in a much more elegant way. And with |
Objective
.system()
, part 5 (criteria piping)", shhh.Solution
RunCriteriaContainer
to store aRunCriteriaTrait
trait object instead of the single/piped enum.parallel_run_criteria
test to cover the new cases; expand documentation ofRunCriteria::pipe()
.Relevant issues
Quick example:
I'll see if I can do something about that double indirection (the(Forgot how Rust works for a moment there.)RunCriteriaInner
thing in the implementation).