-
-
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] - Add ClearColor Resource to Pipelined Renderer #2631
[Merged by Bors] - Add ClearColor Resource to Pipelined Renderer #2631
Conversation
a4945ff
to
08eb731
Compare
pipelined/bevy_render2/src/lib.rs
Outdated
@@ -178,6 +180,12 @@ impl Plugin for RenderPlugin { | |||
} | |||
|
|||
fn extract(app_world: &mut World, render_app: &mut App) { | |||
// Update the render world clear color resource if it was added or changed in the app world | |||
if app_world.is_resource_added::<ClearColor>() || app_world.is_resource_changed::<ClearColor>() |
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 don't think this should be updated here / hard coded in the "extract step execution logic". I think ClearColor should probably live in bevy_core_pipeline
as it is behavior specific to "bevy's core render pipeline", not core renderer logic. It should just be another "extract stage system". That should also resolve the change tracking issue.
You should only need to query for Changed. "added" things also flip the "changed" flag.
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, cool, that makes sense. I'll update as soon as I get back to this. 👍
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.
Fixed it. I like that much better!
I'm really liking the extract →prepare →queue rendering model. Very nice.
bd7e8be
to
b36ab35
Compare
bors r+ |
# Objective - Allow the user to set the clear color when using the pipelined renderer ## Solution - Add a `ClearColor` resource that can be added to the world to configure the clear color ## Remaining Issues Currently the `ClearColor` resource is cloned from the app world to the render world every frame. There are two ways I can think of around this: 1. Figure out why `app_world.is_resource_changed::<ClearColor>()` always returns `true` in the `extract` step and fix it so that we are only updating the resource when it changes 2. Require the users to add the `ClearColor` resource to the render sub-app instead of the parent app. This is currently sub-optimal until we have labled sub-apps, and probably a helper funciton on `App` such as `app.with_sub_app(RenderApp, |app| { ... })`. Even if we had that, I think it would be more than we want the user to have to think about. They shouldn't have to know about the render sub-app I don't think. I think the first option is the best, but I could really use some help figuring out the nuance of why `is_resource_changed` is always returning true in that context.
Pull request successfully merged into pipelined-rendering. Build succeeded: |
Objective
Solution
ClearColor
resource that can be added to the world to configure the clear colorRemaining Issues
Currently the
ClearColor
resource is cloned from the app world to the render world every frame. There are two ways I can think of around this:app_world.is_resource_changed::<ClearColor>()
always returnstrue
in theextract
step and fix it so that we are only updating the resource when it changesClearColor
resource to the render sub-app instead of the parent app. This is currently sub-optimal until we have labled sub-apps, and probably a helper funciton onApp
such asapp.with_sub_app(RenderApp, |app| { ... })
. Even if we had that, I think it would be more than we want the user to have to think about. They shouldn't have to know about the render sub-app I don't think.I think the first option is the best, but I could really use some help figuring out the nuance of why
is_resource_changed
is always returning true in that context.