Retain RenderMeshInstance
and MeshInputUniform
data from frame to frame.
#16385
+364
−90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andMeshUniformData
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 forViewVisibility
. Doing this required adding a new system that runs after allcheck_visibility
invocations, as no singlecheck_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-statecollect_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.This patch is only lightly tested and shouldn't land before 0.15 is released anyway, so I'm releasing it as a draft.