Create new NonSendMarker#18301
Conversation
058b5fc to
39cfc41
Compare
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
66119b0 to
d0f60b6
Compare
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
1 similar comment
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
876b73f to
592adc0
Compare
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
592adc0 to
62a3201
Compare
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
# Objective Remaining work for and closes #17682. First half of work for that issue was completed in [PR 17730](#17730). However, the rest of the work ended up getting blocked because we needed a way of forcing systems to run on the main thread without the use of `!Send` resources. That was unblocked by [PR 18301](#18301). This work should finish unblocking the resources-as-components effort. # Testing Ran several examples using my Linux machine, just to make sure things are working as expected and no surprises pop up. --------- Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com> Co-authored-by: François Mockers <francois.mockers@vleue.com>
# Objective In #18301, `NonSendMarker` was defined in such a way that it actually implements `Send`. This isn't strictly a soundness issue, as its goal is to be used as a `SystemParam`, and it _does_ appropriately mark system access as `!Send`. It just seems odd that `NonSendMarker: Send`. ## Solution - Made `NonSendMarker` wrap `PhantomData<*mut ()>`, which forces it to be `!Send`. ## Testing - CI --- ## Notes This does mean constructing a `NonSendMarker` _value_ will require using the `SystemParam` trait, but I think that's acceptable as the marker as a value should be rarely required if at all.
# Objective Remaining work for and closes bevyengine#17682. First half of work for that issue was completed in [PR 17730](bevyengine#17730). However, the rest of the work ended up getting blocked because we needed a way of forcing systems to run on the main thread without the use of `!Send` resources. That was unblocked by [PR 18301](bevyengine#18301). This work should finish unblocking the resources-as-components effort. # Testing Ran several examples using my Linux machine, just to make sure things are working as expected and no surprises pop up. --------- Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com> Co-authored-by: François Mockers <francois.mockers@vleue.com>
# Objective In bevyengine#18301, `NonSendMarker` was defined in such a way that it actually implements `Send`. This isn't strictly a soundness issue, as its goal is to be used as a `SystemParam`, and it _does_ appropriately mark system access as `!Send`. It just seems odd that `NonSendMarker: Send`. ## Solution - Made `NonSendMarker` wrap `PhantomData<*mut ()>`, which forces it to be `!Send`. ## Testing - CI --- ## Notes This does mean constructing a `NonSendMarker` _value_ will require using the `SystemParam` trait, but I think that's acceptable as the marker as a value should be rarely required if at all.
Objective
Create new
NonSendMarkerthat does not depend onNonSend.Required, in order to accomplish #17682. In that issue, we are trying to replace
!Sendresources withthread_local!in order to unblock the resources-as-components effort. However, when we remove all the!Sendresources from a system, that allows the system to run on a thread other than the main thread, which is against the design of the system. So this marker gives us the control to require a system to run on the main thread without depending on!Sendresources.Solution
Create a new
NonSendMarkerto replace the existing one that does not depend onNonSend.Testing
Other than running tests, I ran a few examples:
window_resizingwireframevolumetric_fog(looks so cool)rotationbuttonThere is a Mac/iOS-specific change and I do not have a Mac or iOS device to test it. I am doubtful that it would cause any problems for 2 reasons:
But it wouldn't hurt if someone wanted to spin up an example that utilizes the
bevy_rendercrate, which is where the Mac/iSO change was.Migration Guide
If
NonSendMarkeris being used frombevy_app::prelude::*, replace it withbevy_ecs::system::NonSendMarkeror use it frombevy_ecs::prelude::*. In addition to that,NonSendMarkerdoes not need to be wrapped like so:Instead, it can be used without any wrappers: