use bevy_ecs::world::World;1use bevy_mesh::{MeshVertexBufferLayoutRef, MissingVertexAttributeError};2use bevy_platform::sync::Arc;3use core::any::Any;4use thiserror::Error;56use crate::{7descriptor::{CachedRenderPipelineId, RenderPipelineDescriptor},8key::ErasedMaterialPipelineKey,9MaterialProperties,10};1112/// A type erased function pointer for specializing a material pipeline. The implementation is13/// expected to:14/// - Look up the appropriate specializer from the world15/// - Downcast the erased key to the concrete key type16/// - Call `SpecializedMeshPipelines::specialize` with the specializer and return the resulting pipeline id17pub type BaseSpecializeFn = fn(18&mut World,19ErasedMaterialPipelineKey,20&MeshVertexBufferLayoutRef,21&Arc<MaterialProperties>,22) -> Result<CachedRenderPipelineId, SpecializedMeshPipelineError>;2324/// A type erased function pointer for specializing a material prepass pipeline. The implementation is25/// expected to:26/// - Look up the appropriate specializer from the world27/// - Downcast the erased key to the concrete key type28/// - Call `SpecializedMeshPipelines::specialize` with the specializer and return the resulting pipeline id29pub type PrepassSpecializeFn = fn(30&mut World,31ErasedMaterialPipelineKey,32&MeshVertexBufferLayoutRef,33&Arc<MaterialProperties>,34) -> Result<CachedRenderPipelineId, SpecializedMeshPipelineError>;3536/// A type erased function pointer for specializing a material prepass pipeline. The implementation is37/// expected to:38/// - Look up the appropriate specializer from the world39/// - Downcast the erased key to the concrete key type40/// - Call `SpecializedMeshPipelines::specialize` with the specializer and return the resulting pipeline id41pub type UserSpecializeFn = fn(42&dyn Any,43&mut RenderPipelineDescriptor,44&MeshVertexBufferLayoutRef,45ErasedMaterialPipelineKey,46) -> Result<(), SpecializedMeshPipelineError>;4748#[derive(Error, Debug)]49pub enum SpecializedMeshPipelineError {50#[error(transparent)]51MissingVertexAttribute(#[from] MissingVertexAttributeError),52}535455