diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 3052167d9e006..96f01e56edee2 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -536,12 +536,15 @@ pub fn queue_material_meshes( if normal_prepass { view_key |= MeshPipelineKey::NORMAL_PREPASS; } + if depth_prepass { view_key |= MeshPipelineKey::DEPTH_PREPASS; } + if motion_vector_prepass { view_key |= MeshPipelineKey::MOTION_VECTOR_PREPASS; } + if deferred_prepass { view_key |= MeshPipelineKey::DEFERRED_PREPASS; } @@ -595,7 +598,6 @@ pub fn queue_material_meshes( } let rangefinder = view.rangefinder3d(); - for visible_entity in &visible_entities.entities { let Some(material_asset_id) = render_material_instances.get(visible_entity) else { continue; diff --git a/crates/bevy_render/src/render_resource/pipeline_specializer.rs b/crates/bevy_render/src/render_resource/pipeline_specializer.rs index 1a855b7d89c44..7fc8533830ff5 100644 --- a/crates/bevy_render/src/render_resource/pipeline_specializer.rs +++ b/crates/bevy_render/src/render_resource/pipeline_specializer.rs @@ -87,8 +87,7 @@ pub trait SpecializedMeshPipeline { pub struct SpecializedMeshPipelines { mesh_layout_cache: PreHashMap>, - vertex_layout_cache: - HashMap, HashMap>, + vertex_layout_cache: HashMap>, } impl Default for SpecializedMeshPipelines { @@ -125,19 +124,20 @@ impl SpecializedMeshPipelines { } err })?; - // Different MeshVertexBufferLayouts can produce the same final VertexBufferLayout // We want compatible vertex buffer layouts to use the same pipelines, so we must "deduplicate" them - let vertex_key = descriptor.vertex.buffers.get(0).cloned(); let layout_map = match self .vertex_layout_cache .raw_entry_mut() - .from_key(&vertex_key) + .from_key(&descriptor.vertex.buffers[0]) { RawEntryMut::Occupied(entry) => entry.into_mut(), - RawEntryMut::Vacant(entry) => entry.insert(vertex_key, Default::default()).1, + RawEntryMut::Vacant(entry) => { + entry + .insert(descriptor.vertex.buffers[0].clone(), Default::default()) + .1 + } }; - Ok(*entry.insert(match layout_map.entry(key) { Entry::Occupied(entry) => { if cfg!(debug_assertions) {