Skip to content
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 RenderWorld to Extract step #2555

Closed
wants to merge 1 commit into from

Conversation

cart
Copy link
Member

@cart cart commented Jul 27, 2021

Makes the "Render App World" directly available to Extract step systems as a RenderWorld resource. Prior to this, there was no way to directly read / write render world state during the Extract step. The only way to make changes was through Commands (which were applied at the end of the stage).

// `thing` is an "app world resource".
fn extract_thing(thing: Res<Thing>, mut render_world: ResMut<RenderWorld>) {
  render_world.insert_resource(ExtractedThing::from(thing));
}

RenderWorld makes a number of scenarios possible:

  • When an extract system does big allocations, it is now possible to reuse them across frames by retrieving old values from RenderWorld (at the cost of reduced parallelism from unique RenderWorld borrows).
  • Enables inserting into the same resource across multiple extract systems
  • Enables using past RenderWorld state to inform future extract state (this should generally be avoided)

Ultimately this is just a subset of the functionality we want. In the future, it would be great to have "multi-world schedules" to enable fine grained parallelism on the render world during the extract step. But that is a research project that almost certainly won't make it into 0.6. This is a good interim solution that should easily port over to multi-world schedules if/when they land.

@cart cart added the A-Rendering Drawing game state to the screen label Jul 27, 2021
@cart cart added this to the Bevy 0.6 milestone Jul 27, 2021
@cart
Copy link
Member Author

cart commented Jul 28, 2021

bors r+

bors bot pushed a commit that referenced this pull request Jul 28, 2021
Makes the "Render App World" directly available to Extract step systems as a `RenderWorld` resource. Prior to this, there was no way to directly read / write render world state during the Extract step. The only way to make changes was through Commands (which were applied at the end of the stage).

```rust
// `thing` is an "app world resource".
fn extract_thing(thing: Res<Thing>, mut render_world: ResMut<RenderWorld>) {
  render_world.insert_resource(ExtractedThing::from(thing));
}
```

RenderWorld makes a number of scenarios possible:

* When an extract system does big allocations, it is now possible to reuse them across frames by retrieving old values from RenderWorld (at the cost of reduced parallelism from unique RenderWorld borrows).
* Enables inserting into the same resource across multiple extract systems
* Enables using past RenderWorld state to inform future extract state (this should generally be avoided)

Ultimately this is just a subset of the functionality we want. In the future, it would be great to have "multi-world schedules" to enable fine grained parallelism on the render world during the extract step. But that is a research project that almost certainly won't make it into 0.6. This is a good interim solution that should easily port over to multi-world schedules if/when they land.
@bors
Copy link
Contributor

bors bot commented Jul 28, 2021

@bors bors bot changed the title Add RenderWorld to Extract step [Merged by Bors] - Add RenderWorld to Extract step Jul 28, 2021
@bors bors bot closed this Jul 28, 2021
bors bot pushed a commit that referenced this pull request Aug 4, 2021
# Objective
Restore the functionality of sprite atlases in the new renderer.

### **Note:** This PR relies on #2555 

## Solution
Mostly just a copy paste of the existing sprite atlas implementation, however I unified the rendering between sprites and atlases.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant