Skip to content

Commit

Permalink
Remove no longer needed code
Browse files Browse the repository at this point in the history
  • Loading branch information
JMS55 committed Dec 31, 2023
1 parent d3051b8 commit e9cb784
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,15 @@ pub fn queue_material_meshes<M: Material>(
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;
}
Expand Down Expand Up @@ -595,7 +598,6 @@ pub fn queue_material_meshes<M: Material>(
}

let rangefinder = view.rangefinder3d();

for visible_entity in &visible_entities.entities {
let Some(material_asset_id) = render_material_instances.get(visible_entity) else {
continue;
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_render/src/render_resource/pipeline_specializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ pub trait SpecializedMeshPipeline {
pub struct SpecializedMeshPipelines<S: SpecializedMeshPipeline> {
mesh_layout_cache:
PreHashMap<InnerMeshVertexBufferLayout, HashMap<S::Key, CachedRenderPipelineId>>,
vertex_layout_cache:
HashMap<Option<VertexBufferLayout>, HashMap<S::Key, CachedRenderPipelineId>>,
vertex_layout_cache: HashMap<VertexBufferLayout, HashMap<S::Key, CachedRenderPipelineId>>,
}

impl<S: SpecializedMeshPipeline> Default for SpecializedMeshPipelines<S> {
Expand Down Expand Up @@ -125,19 +124,20 @@ impl<S: SpecializedMeshPipeline> SpecializedMeshPipelines<S> {
}
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) {
Expand Down

0 comments on commit e9cb784

Please sign in to comment.