From efb98d5b658d1a6c5f2aab1d349b4dea2f3d3d36 Mon Sep 17 00:00:00 2001 From: Greeble <166992735+greeble-dev@users.noreply.github.com> Date: Fri, 4 Apr 2025 07:22:29 +0100 Subject: [PATCH] Changed specialization to happen after `set_motion_motion_vector_flags`. This fixes specialization caching the wrong flag. --- crates/bevy_pbr/src/material.rs | 3 ++- crates/bevy_pbr/src/prepass/mod.rs | 13 +++++++------ crates/bevy_pbr/src/render/mesh.rs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 7465260a63070..19afa24b9d9e4 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -327,7 +327,8 @@ where .in_set(RenderSet::PrepareMeshes) .after(prepare_assets::>) .after(prepare_assets::) - .after(collect_meshes_for_gpu_building), + .after(collect_meshes_for_gpu_building) + .after(set_mesh_motion_vector_flags), queue_material_meshes:: .in_set(RenderSet::QueueMeshes) .after(prepare_assets::>), diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index a13a5487da969..d287c37285de8 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -3,11 +3,11 @@ mod prepass_bindings; use crate::{ alpha_mode_pipeline_key, binding_arrays_are_usable, buffer_layout, collect_meshes_for_gpu_building, material_bind_groups::MaterialBindGroupAllocator, - queue_material_meshes, setup_morph_and_skinning_defs, skin, DrawMesh, - EntitySpecializationTicks, Material, MaterialPipeline, MaterialPipelineKey, MeshLayouts, - MeshPipeline, MeshPipelineKey, OpaqueRendererMethod, PreparedMaterial, RenderLightmaps, - RenderMaterialInstances, RenderMeshInstanceFlags, RenderMeshInstances, RenderPhaseType, - SetMaterialBindGroup, SetMeshBindGroup, ShadowView, StandardMaterial, + queue_material_meshes, set_mesh_motion_vector_flags, setup_morph_and_skinning_defs, skin, + DrawMesh, EntitySpecializationTicks, Material, MaterialPipeline, MaterialPipelineKey, + MeshLayouts, MeshPipeline, MeshPipelineKey, OpaqueRendererMethod, PreparedMaterial, + RenderLightmaps, RenderMaterialInstances, RenderMeshInstanceFlags, RenderMeshInstances, + RenderPhaseType, SetMaterialBindGroup, SetMeshBindGroup, ShadowView, StandardMaterial, }; use bevy_app::{App, Plugin, PreUpdate}; use bevy_render::{ @@ -219,7 +219,8 @@ where .in_set(RenderSet::PrepareMeshes) .after(prepare_assets::>) .after(prepare_assets::) - .after(collect_meshes_for_gpu_building), + .after(collect_meshes_for_gpu_building) + .after(set_mesh_motion_vector_flags), queue_prepass_material_meshes:: .in_set(RenderSet::QueueMeshes) .after(prepare_assets::>) diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index b13ed5f956869..98501955a0c93 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -1648,7 +1648,7 @@ fn extract_mesh_for_gpu_building( /// [`crate::material::queue_material_meshes`] check the skin and morph target /// tables for each mesh, but that would be too slow in the hot mesh queuing /// loop. -fn set_mesh_motion_vector_flags( +pub(crate) fn set_mesh_motion_vector_flags( mut render_mesh_instances: ResMut, skin_uniforms: Res, morph_indices: Res,