bevy/crates/bevy_pbr/src
James Liu 2d727afaf7 Flatten render commands (#6885)
# Objective
Speed up the render phase of rendering. Simplify the trait structure for render commands.

## Solution

 - Merge `EntityPhaseItem` into `PhaseItem` (`EntityPhaseItem::entity` -> `PhaseItem::entity`)
 - Merge `EntityRenderCommand` into `RenderCommand`.
 - Add two associated types to `RenderCommand`: `RenderCommand::ViewWorldQuery` and `RenderCommand::WorldQuery`.
 - Use the new associated types to construct two `QueryStates`s for `RenderCommandState`.
 - Hoist any `SQuery<T>` fetches in `EntityRenderCommand`s into the aformentioned two queries. Batch fetch them all at once.

## Performance
`main_opaque_pass_3d` is slightly faster on `many_foxes` (427.52us -> 401.15us)

![image](https://user-images.githubusercontent.com/3137680/206359804-9928b20a-7d92-41f8-bf7d-6e8c5cc802f0.png)

The shadow pass node is also slightly faster (344.52 -> 338.24us)

![image](https://user-images.githubusercontent.com/3137680/206359977-1212198d-f933-49a0-80f1-62ff88eb5727.png)

## Future Work

 - Can we hoist the view level queries out of the core loop?

---

## Changelog
Added: `PhaseItem::entity`
Added: `RenderCommand::ViewWorldQuery` associated type.
Added: `RenderCommand::ItemorldQuery` associated type.
Added: `Draw<T>::prepare` optional trait function.
Removed: `EntityPhaseItem` trait

## Migration Guide
TODO
2023-01-04 01:13:30 +00:00
..
render Flatten render commands (#6885) 2023-01-04 01:13:30 +00:00
alpha.rs add ReflectAsset and ReflectHandle (#5923) 2022-10-28 20:42:33 +00:00
bundle.rs Visibilty Inheritance, universal ComputedVisibility and RenderLayers support (#5310) 2022-07-15 23:24:42 +00:00
lib.rs Add try_* to add_slot_edge, add_node_edge (#6720) 2022-11-21 21:58:39 +00:00
light.rs Reflect for Tonemapping and ClusterConfig (#6488) 2022-11-07 19:44:17 +00:00
material.rs Flatten render commands (#6885) 2023-01-04 01:13:30 +00:00
pbr_material.rs Shader defs can now have a value (#5900) 2022-11-21 22:38:29 +00:00
wireframe.rs Add DrawFunctionsInternals::id() (#6745) 2022-11-28 13:54:13 +00:00