-
Notifications
You must be signed in to change notification settings - Fork 403
initial pass at sorted-and-binned render phase items #1491
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
Changes from all commits
ddb512f
2cccd0c
c0f78e3
67c187c
d407db1
b5228ac
ef75e5d
2750750
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Usage of `PhaseItem` has been split into `BinnedPhaseItem` and `SortedPhaseItem`. If you have custom `PhaseItem`s you will need to choose one of the new types. Notably some phases _must_ be Sorted (such as Transparent and Transmissive), while others can be Binned. Effectively Sorted is "what Bevy did before" and Binned is new, and the point of this change is to avoid sorting when possible for improved performance. | ||
alice-i-cecile marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| If you're looking for a quick migration, consider picking [`SortedPhaseItem`](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/trait.SortedPhaseItem.html) which requires the fewest code changes. | ||
|
|
||
| If you're looking for higher performance (and your phase doesn’t require sorting) you may want to pick [`BinnedPhaseItem`](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/trait.BinnedPhaseItem.html). Notably bins are populated based on `BinKey` and everything in the same bin is potentially batchable. | ||
|
|
||
| If you are only consuming these types, then a `Query` for a type like `&mut RenderPhase<Transparent2d>` will become a `Resource` as such: | ||
|
|
||
| ```rust | ||
| mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>> | ||
| ``` | ||
|
|
||
| `ViewSortedRenderPhases` and `ViewBinnedRenderPhases` are used in accordance with which phase items you're trying to access (sorted or binned). | ||
|
|
||
| Examples of [`SortedPhaseItems`s](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/trait.SortedPhaseItem.html#implementors): | ||
|
|
||
| - Transmissive3d | ||
| - Transparent2d | ||
| - Transparent3d | ||
| - TransparentUi | ||
|
|
||
| Examples of [`BinnedPhaseItem`s](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/trait.BinnedPhaseItem.html#implementors) include: | ||
|
|
||
| - Opaque3d | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link them all maybe? (sorry for the extra work 😅)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could do. I linked Shadow specifically because to someone less familiar it looks out of place next to things that are clearly 2d/3d forward/deferred/prepass related. The full list is already available at the "Examples of" links. |
||
| - Opaque3dPrepass | ||
| - Opaque3dDeferred | ||
| - AlphaMask3d | ||
| - AlphaMask3dPrepass | ||
| - AlphaMask3dDeferred | ||
| - [Shadow](https://docs.rs/bevy/0.14.0/bevy/pbr/struct.Shadow.html) | ||
|
|
||
| If you do not have a mesh (such as for GPU-driven particles or procedural generation) and want to use the new binned behavior, the [`BinnedRenderPhase`](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/struct.BinnedRenderPhase.html) includes a `non_mesh_items` collection which correlates with the [`BinnedRenderPhaseType`](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/struct.BinnedRenderPhase.html). This type is used when [add](https://docs.rs/bevy/0.14.0/bevy/render/render_phase/struct.BinnedRenderPhase.html#method.add)ing items to the `BinnedRenderPhase`. | ||
|
|
||
| It may be additionally useful to checkout the new [custom_phase_item example](https://github.com/bevyengine/bevy/blob/5876352206d1bcea792825bf013eb212383b73d6/examples/shader/custom_phase_item.rs) which details some of the new APIs. | ||
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.