bevy/crates/bevy_render/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
..
batching Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385) 2024-12-05 21:16:04 +00:00
camera Add Immutable Component Support (#16372) 2024-12-05 14:27:48 +00:00
diagnostic Ensure Bevy's rendering byte usage is little-endian (#15750) 2024-10-08 22:43:35 +00:00
mesh Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
primitives Add .contains_aabb for Frustum (#16022) 2024-12-01 21:30:01 +00:00
render_graph Move all_tuples to a new crate (#16161) 2024-12-03 17:41:09 +00:00
render_phase Move all_tuples to a new crate (#16161) 2024-12-03 17:41:09 +00:00
render_resource Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385) 2024-12-05 21:16:04 +00:00
renderer Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
texture Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
view Retain RenderMeshInstance and MeshInputUniform data from frame to frame. (#16385) 2024-12-05 21:16:04 +00:00
alpha.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
color_operations.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
extract_component.rs Remove ExtractComponent::Out (#15926) 2024-10-15 23:42:35 +00:00
extract_instances.rs Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
extract_param.rs Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
extract_resource.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
globals.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
gpu_component_array_buffer.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
gpu_readback.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
lib.rs cleanup bevy_render/lib.rs (#16481) 2024-11-22 22:32:04 +00:00
maths.wgsl add tonemapping LUT bindings for sprite and mesh2d pipelines (#13262) 2024-05-28 12:09:26 +00:00
pipelined_rendering.rs Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
render_asset.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
settings.rs cleanup bevy_render/lib.rs (#16481) 2024-11-22 22:32:04 +00:00
spatial_bundle.rs Deprecate SpatialBundle (#15830) 2024-10-13 17:28:22 +00:00
storage.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
sync_component.rs Synchronize removed components with the render world (#15582) 2024-10-08 22:23:17 +00:00
sync_world.rs Use default storage for TemporaryRenderEntity (#16462) 2024-11-22 21:01:53 +00:00