Fix a system ordering issue with motion blur for skinned meshes. (#15693)

Currently, it's possible for the `collect_meshes_for_gpu_building`
system to run after `set_mesh_motion_vector_flags`. This will cause
those motion vector flags to be overwritten, which will cause the shader
to ignore the motion vectors for skinned meshes, which will cause
graphical artifacts.

This patch corrects the issue by forcing `set_mesh_motion_vector_flags`
to run after `collect_meshes_for_gpu_building`.
This commit is contained in:
Patrick Walton 2024-10-07 09:33:15 -07:00 committed by GitHub
parent 8039f34b0d
commit 0a1d60f3b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -163,7 +163,7 @@ impl Plugin for MeshRenderPlugin {
.add_systems(
Render,
(
set_mesh_motion_vector_flags.before(RenderSet::Queue),
set_mesh_motion_vector_flags.in_set(RenderSet::PrepareAssets),
prepare_skins.in_set(RenderSet::PrepareResources),
prepare_morphs.in_set(RenderSet::PrepareResources),
prepare_mesh_bind_group.in_set(RenderSet::PrepareBindGroups),
@ -208,7 +208,11 @@ impl Plugin for MeshRenderPlugin {
.after(prepare_view_targets),
collect_meshes_for_gpu_building
.in_set(RenderSet::PrepareAssets)
.after(allocator::allocate_and_free_meshes),
.after(allocator::allocate_and_free_meshes)
// This must be before
// `set_mesh_motion_vector_flags` so it doesn't
// overwrite those flags.
.before(set_mesh_motion_vector_flags),
),
);
} else {