bevy/crates/bevy_pbr/src
Patrick Walton 8c2c07b1c8
Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385)
This commit moves the front end of the rendering pipeline to a retained
model when GPU preprocessing is in use (i.e. by default, except in
constrained environments). `RenderMeshInstance` and `MeshUniformData`
are stored from frame to frame and are updated only for the entities
that changed state. This was rather tricky and requires some careful
surgery to keep the data valid in the case of removals.

This patch is built on top of Bevy's change detection. Generally, this
worked, except that `ViewVisibility` isn't currently properly tracked.
Therefore, this commit adds proper change tracking for `ViewVisibility`.
Doing this required adding a new system that runs after all
`check_visibility` invocations, as no single `check_visibility`
invocation has enough global information to detect changes.

On the Bistro exterior scene, with all textures forced to opaque, this
patch improves steady-state `extract_meshes_for_gpu_building` from
93.8us to 34.5us and steady-state `collect_meshes_for_gpu_building` from
195.7us to 4.28us. Altogether this constitutes an improvement from 290us
to 38us, which is a 7.46x speedup.

![Screenshot 2024-11-13
143841](https://github.com/user-attachments/assets/40b1aacc-373d-4016-b7fd-b0284bc33de4)

![Screenshot 2024-11-13
143850](https://github.com/user-attachments/assets/53b401c3-7461-43b3-918b-cff89ea780d6)

This patch is only lightly tested and shouldn't land before 0.15 is
released anyway, so I'm releasing it as a draft.
2024-12-05 21:16:04 +00:00
..
cluster Cluster light probes using conservative spherical bounds. (#13746) 2024-12-05 13:07:10 +00:00
deferred Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
light Make PCSS experimental (#16382) 2024-11-14 07:39:26 +00:00
light_probe Cluster light probes using conservative spherical bounds. (#13746) 2024-12-05 13:07:10 +00:00
lightmap Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
meshlet Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
prepass Make visibility range (HLOD) dithering work when prepasses are enabled. (#16286) 2024-12-04 17:34:36 +00:00
render Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385) 2024-12-05 21:16:04 +00:00
ssao Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
ssr Cluster light probes using conservative spherical bounds. (#13746) 2024-12-05 13:07:10 +00:00
volumetric_fog Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bundle.rs Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
extended_material.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
fog.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
lib.rs Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385) 2024-12-05 21:16:04 +00:00
material.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
material_bind_groups.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
mesh_material.rs Revert default mesh materials (#15930) 2024-10-15 19:47:40 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
wireframe.rs Revert "Have EntityCommands methods consume self for easier chaining" (#15523) 2024-10-02 12:47:26 +00:00