diff --git a/crates/bevy_render/src/render_resource/specializer.rs b/crates/bevy_render/src/render_resource/specializer.rs index 762458145a..da63dc3323 100644 --- a/crates/bevy_render/src/render_resource/specializer.rs +++ b/crates/bevy_render/src/render_resource/specializer.rs @@ -256,34 +256,22 @@ macro_rules! impl_specialization_key_tuple { // TODO: How to we fake_variadics this? all_tuples!(impl_specialization_key_tuple, 0, 12, T); -pub type SpecializerFn = - fn(>::Key, &mut ::Descriptor) -> Result<(), BevyError>; - /// A cache for specializable resources. For a given key type the resulting /// resource will only be created if it is missing, retrieving it from the /// cache otherwise. pub struct SpecializedCache> { specializer: S, - user_specializer: Option>, base_descriptor: T::Descriptor, primary_cache: HashMap, secondary_cache: HashMap, T::CachedId>, } impl> SpecializedCache { - /// Creates a new [`SpecializedCache`] from a [`Specializer`], - /// an optional "user specializer", and a base descriptor. The - /// user specializer is applied after the [`Specializer`], with - /// the same key. + /// Creates a new [`SpecializedCache`] from a [`Specializer`] and a base descriptor. #[inline] - pub fn new( - specializer: S, - user_specializer: Option>, - base_descriptor: T::Descriptor, - ) -> Self { + pub fn new(specializer: S, base_descriptor: T::Descriptor) -> Self { Self { specializer, - user_specializer, base_descriptor, primary_cache: Default::default(), secondary_cache: Default::default(), @@ -302,7 +290,6 @@ impl> SpecializedCache { Entry::Occupied(entry) => Ok(entry.get().clone()), Entry::Vacant(entry) => Self::specialize_slow( &self.specializer, - self.user_specializer, self.base_descriptor.clone(), pipeline_cache, key, @@ -315,7 +302,6 @@ impl> SpecializedCache { #[cold] fn specialize_slow( specializer: &S, - user_specializer: Option>, base_descriptor: T::Descriptor, pipeline_cache: &PipelineCache, key: S::Key, @@ -325,10 +311,6 @@ impl> SpecializedCache { let mut descriptor = base_descriptor.clone(); let canonical_key = specializer.specialize(key.clone(), &mut descriptor)?; - if let Some(user_specializer) = user_specializer { - (user_specializer)(key, &mut descriptor)?; - } - // if the whole key is canonical, the secondary cache isn't needed. if ::IS_CANONICAL { return Ok(primary_entry diff --git a/examples/shader/custom_phase_item.rs b/examples/shader/custom_phase_item.rs index 16a775ac4a..3140915acf 100644 --- a/examples/shader/custom_phase_item.rs +++ b/examples/shader/custom_phase_item.rs @@ -336,8 +336,7 @@ impl FromWorld for CustomPhasePipeline { ..default() }; - let specialized_cache = - SpecializedCache::new(CustomPhaseSpecializer, None, base_descriptor); + let specialized_cache = SpecializedCache::new(CustomPhaseSpecializer, base_descriptor); Self { specialized_cache } }