pub struct MeshPipeline {
pub view_layouts: MeshPipelineViewLayouts,
pub dummy_white_gpu_image: GpuImage,
pub clustered_forward_buffer_binding_type: BufferBindingType,
pub mesh_layouts: MeshLayouts,
pub per_object_buffer_batch_size: Option<u32>,
pub binding_arrays_are_usable: bool,
pub clustered_decals_are_usable: bool,
pub skins_use_uniform_buffers: bool,
}
Expand description
All data needed to construct a pipeline for rendering 3D meshes.
Fields§
§view_layouts: MeshPipelineViewLayouts
A reference to all the mesh pipeline view layouts.
dummy_white_gpu_image: GpuImage
§clustered_forward_buffer_binding_type: BufferBindingType
§mesh_layouts: MeshLayouts
§per_object_buffer_batch_size: Option<u32>
MeshUniform
s are stored in arrays in buffers. If storage buffers are available, they
are used and this will be None
, otherwise uniform buffers will be used with batches
of this many MeshUniform
s, stored at dynamic offsets within the uniform buffer.
Use code like this in custom shaders:
##ifdef PER_OBJECT_BUFFER_BATCH_SIZE
@group(1) @binding(0) var<uniform> mesh: array<Mesh, #{PER_OBJECT_BUFFER_BATCH_SIZE}u>;
##else
@group(1) @binding(0) var<storage> mesh: array<Mesh>;
##endif // PER_OBJECT_BUFFER_BATCH_SIZE
binding_arrays_are_usable: bool
Whether binding arrays (a.k.a. bindless textures) are usable on the current render device.
This affects whether reflection probes can be used.
clustered_decals_are_usable: bool
Whether clustered decals are usable on the current render device.
skins_use_uniform_buffers: bool
Whether skins will use uniform buffers on account of storage buffers being unavailable on this platform.
Implementations§
Source§impl MeshPipeline
impl MeshPipeline
pub fn get_image_texture<'a>( &'a self, gpu_images: &'a RenderAssets<GpuImage>, handle_option: &Option<Handle<Image>>, ) -> Option<(&'a TextureView, &'a Sampler)>
pub fn get_view_layout( &self, layout_key: MeshPipelineViewLayoutKey, ) -> &BindGroupLayout
Trait Implementations§
Source§impl Clone for MeshPipeline
impl Clone for MeshPipeline
Source§fn clone(&self) -> MeshPipeline
fn clone(&self) -> MeshPipeline
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl FromWorld for MeshPipeline
impl FromWorld for MeshPipeline
Source§fn from_world(world: &mut World) -> Self
fn from_world(world: &mut World) -> Self
Creates
Self
using data from the given World
.Source§impl GetBatchData for MeshPipeline
impl GetBatchData for MeshPipeline
Source§type Param = (Res<'static, RenderMeshInstances>, Res<'static, RenderLightmaps>, Res<'static, RenderAssets<RenderMesh>>, Res<'static, MeshAllocator>, Res<'static, SkinUniforms>)
type Param = (Res<'static, RenderMeshInstances>, Res<'static, RenderLightmaps>, Res<'static, RenderAssets<RenderMesh>>, Res<'static, MeshAllocator>, Res<'static, SkinUniforms>)
The system parameters
GetBatchData::get_batch_data
needs in
order to compute the batch data.Source§type CompareData = (MaterialBindGroupIndex, AssetId<Mesh>, Option<LightmapSlabIndex>)
type CompareData = (MaterialBindGroupIndex, AssetId<Mesh>, Option<LightmapSlabIndex>)
Data used for comparison between phase items. If the pipeline id, draw
function id, per-instance data buffer dynamic offset and this data
matches, the draws can be batched.
Source§type BufferData = MeshUniform
type BufferData = MeshUniform
The per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer
containing these data for all
instances.Source§fn get_batch_data(
(mesh_instances, lightmaps, _, mesh_allocator, skin_uniforms): &SystemParamItem<'_, '_, Self::Param>,
(_entity, main_entity): (Entity, MainEntity),
) -> Option<(Self::BufferData, Option<Self::CompareData>)>
fn get_batch_data( (mesh_instances, lightmaps, _, mesh_allocator, skin_uniforms): &SystemParamItem<'_, '_, Self::Param>, (_entity, main_entity): (Entity, MainEntity), ) -> Option<(Self::BufferData, Option<Self::CompareData>)>
Get the per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer
. If the instance can be
batched, also return the data used for comparison when deciding whether
draws can be batched, else return None for the CompareData
. Read moreSource§impl GetFullBatchData for MeshPipeline
impl GetFullBatchData for MeshPipeline
Source§type BufferInputData = MeshInputUniform
type BufferInputData = MeshInputUniform
The per-instance data that was inserted into the
crate::render_resource::BufferVec
during extraction.Source§fn get_index_and_compare_data(
(mesh_instances, lightmaps, _, _, _): &SystemParamItem<'_, '_, Self::Param>,
main_entity: MainEntity,
) -> Option<(NonMaxU32, Option<Self::CompareData>)>
fn get_index_and_compare_data( (mesh_instances, lightmaps, _, _, _): &SystemParamItem<'_, '_, Self::Param>, main_entity: MainEntity, ) -> Option<(NonMaxU32, Option<Self::CompareData>)>
Returns the index of the
GetFullBatchData::BufferInputData
that the
GPU preprocessing phase will use. Read moreSource§fn get_binned_batch_data(
(mesh_instances, lightmaps, _, mesh_allocator, skin_uniforms): &SystemParamItem<'_, '_, Self::Param>,
main_entity: MainEntity,
) -> Option<Self::BufferData>
fn get_binned_batch_data( (mesh_instances, lightmaps, _, mesh_allocator, skin_uniforms): &SystemParamItem<'_, '_, Self::Param>, main_entity: MainEntity, ) -> Option<Self::BufferData>
Get the per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer
. Read moreSource§fn get_binned_index(
(mesh_instances, _, _, _, _): &SystemParamItem<'_, '_, Self::Param>,
main_entity: MainEntity,
) -> Option<NonMaxU32>
fn get_binned_index( (mesh_instances, _, _, _, _): &SystemParamItem<'_, '_, Self::Param>, main_entity: MainEntity, ) -> Option<NonMaxU32>
Returns the index of the
GetFullBatchData::BufferInputData
that the
GPU preprocessing phase will use. Read moreSource§fn write_batch_indirect_parameters_metadata(
indexed: bool,
base_output_index: u32,
batch_set_index: Option<NonMaxU32>,
phase_indirect_parameters_buffers: &mut UntypedPhaseIndirectParametersBuffers,
indirect_parameters_offset: u32,
)
fn write_batch_indirect_parameters_metadata( indexed: bool, base_output_index: u32, batch_set_index: Option<NonMaxU32>, phase_indirect_parameters_buffers: &mut UntypedPhaseIndirectParametersBuffers, indirect_parameters_offset: u32, )
Writes the
gpu_preprocessing::IndirectParametersGpuMetadata
necessary to draw this batch into the given metadata buffer at the given
index. Read moreSource§impl SpecializedMeshPipeline for MeshPipeline
impl SpecializedMeshPipeline for MeshPipeline
type Key = MeshPipelineKey
fn specialize( &self, key: Self::Key, layout: &MeshVertexBufferLayoutRef, ) -> Result<RenderPipelineDescriptor, SpecializedMeshPipelineError>
impl Resource for MeshPipeline
Auto Trait Implementations§
impl Freeze for MeshPipeline
impl !RefUnwindSafe for MeshPipeline
impl Send for MeshPipeline
impl Sync for MeshPipeline
impl Unpin for MeshPipeline
impl !UnwindSafe for MeshPipeline
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more