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] - use better set inheritance in render systems #7524

Conversation

jakobhellermann
Copy link
Contributor

Objective

Some render systems that have system set used as a label so that they can be referenced from somewhere else.
The 1:1 translation from add_system_to_stage(Prepare, prepare_lights.label(PrepareLights)) is add_system(prepare_lights.in_set(Prepare).in_set(PrepareLights), but configuring the PrepareLights set to be in Prepare would match the intention better (there are no systems in PrepareLights outside of Prepare) and it is easier for visualization tools to deal with.

Solution

  • replace
prepare_lights in PrepareLights
prepare_lights in Prepare

with

prepare_lights in PrepareLights
PrepareLights in Prepare

Before
before

After
after

Comment on lines +83 to +88
.configure_sets(
(
PrepareAssetLabel::PreAssetPrepare,
PrepareAssetLabel::AssetPrepare,
PrepareAssetLabel::PostAssetPrepare,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only needs to be configured once. But because this is in RenderAssetPlugin<A>, it will be configured for every render asset A. I don't think there is a better place to put it, because the RenderAssetPlugin should work without e.g. the PbrPlugin.

Is configure_sets idempotent? Or should there be a if !initialized { configure(); initialized = true } is some way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configure_sets should be idempotent. If it's not, that's a bug.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change labels Feb 6, 2023
@alice-i-cecile alice-i-cecile added this to the 0.10 milestone Feb 6, 2023
@hymm hymm self-requested a review February 6, 2023 17:12
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this set of changes. This is a better pattern in general: I just didn't want to make the migration PR even muddier than it needed to be.

Copy link
Contributor

@hymm hymm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed that there's an apply_system_buffers and prepare_materials that are free floating. I'd be ok with fixing that in this pr or doing that in a separate pr.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 6, 2023
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Feb 6, 2023
# Objective
Some render systems that have system set used as a label so that they can be referenced from somewhere else.
The 1:1 translation from `add_system_to_stage(Prepare, prepare_lights.label(PrepareLights))` is `add_system(prepare_lights.in_set(Prepare).in_set(PrepareLights)`, but configuring the `PrepareLights` set to be in `Prepare` would match the intention better (there are no systems in `PrepareLights` outside of `Prepare`) and it is easier for visualization tools to deal with.

# Solution

- replace
```rust
prepare_lights in PrepareLights
prepare_lights in Prepare
```
with
```rs
prepare_lights in PrepareLights
PrepareLights in Prepare
```

**Before**
![before](https://user-images.githubusercontent.com/22177966/216961792-a0f5eba7-f161-4994-b5a4-33e98763a3b0.svg)

**After**
![after](https://user-images.githubusercontent.com/22177966/216961790-857d0062-7943-49ef-8927-e602dfbab714.svg)
@bors bors bot changed the title use better set inheritance in render systems [Merged by Bors] - use better set inheritance in render systems Feb 6, 2023
@bors bors bot closed this Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants