pub struct MeshCullingDataBuffer(/* private fields */);Expand description
A GPU buffer that holds the information needed to cull meshes on GPU.
At the moment, this simply holds each mesh’s AABB.
To avoid wasting CPU time in the CPU culling case, this buffer will be empty if GPU culling isn’t in use.
Methods from Deref<Target = AtomicSparseBufferVec<MeshCullingData>>§
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are no elements in the CPU side copy of the buffer.
Sourcepub fn buffer(&self) -> Option<&Buffer>
pub fn buffer(&self) -> Option<&Buffer>
Returns a handle to the buffer, if the data has been uploaded.
Sourcepub fn set(&self, index: u32, value: T)
pub fn set(&self, index: u32, value: T)
Sets the value at the given index.
If the index isn’t in range of the buffer, this method panics.
Internally, the value is converted to its blob representation.
Note that this method is thread-safe and doesn’t require &mut self.
It’s your responsibility, however, to ensure synchronization; though
this method is memory-safe, it’s possible for other threads to observe
partially-overwritten values if Self::get or similar methods are
called while the write operation is occurring.
Sourcepub fn reserve(&mut self, new_capacity: usize, render_device: &RenderDevice)
pub fn reserve(&mut self, new_capacity: usize, render_device: &RenderDevice)
Ensures that the backing buffer for this buffer vector is present and appropriately sized on the GPU.
Sourcepub fn grow(&mut self, new_len: u32)
pub fn grow(&mut self, new_len: u32)
Grows the buffer by adding default values so that it’s at least the given size.
If the buffer is already large enough, this method does nothing.
Sourcepub fn truncate(&mut self, len: u32)
pub fn truncate(&mut self, len: u32)
Truncates the buffer to the given length.
If the buffer is already that length or shorter, this method does nothing.
Sourcepub fn write_buffers(
&mut self,
render_device: &RenderDevice,
render_queue: &RenderQueue,
)
pub fn write_buffers( &mut self, render_device: &RenderDevice, render_queue: &RenderQueue, )
Writes the data to the GPU, either via a sparse upload or a bulk data upload.
Sourcepub fn prepare_to_populate_buffers(
&mut self,
render_device: &RenderDevice,
pipeline_cache: &PipelineCache,
sparse_buffer_update_jobs: &mut SparseBufferUpdateJobs,
sparse_buffer_update_bind_groups: &mut SparseBufferUpdateBindGroups,
sparse_buffer_update_pipelines: &SparseBufferUpdatePipelines,
)
pub fn prepare_to_populate_buffers( &mut self, render_device: &RenderDevice, pipeline_cache: &PipelineCache, sparse_buffer_update_jobs: &mut SparseBufferUpdateJobs, sparse_buffer_update_bind_groups: &mut SparseBufferUpdateBindGroups, sparse_buffer_update_pipelines: &SparseBufferUpdatePipelines, )
If a sparse update has been scheduled, prepares all GPU resources necessary to perform a sparse buffer update, other than updating the metadata uniform.
Trait Implementations§
Source§impl Component for MeshCullingDataBuffer
impl Component for MeshCullingDataBuffer
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Default for MeshCullingDataBuffer
impl Default for MeshCullingDataBuffer
Source§impl Deref for MeshCullingDataBuffer
impl Deref for MeshCullingDataBuffer
Source§type Target = AtomicSparseBufferVec<MeshCullingData>
type Target = AtomicSparseBufferVec<MeshCullingData>
Source§impl DerefMut for MeshCullingDataBuffer
impl DerefMut for MeshCullingDataBuffer
impl Resource for MeshCullingDataBuffer
Auto Trait Implementations§
impl !RefUnwindSafe for MeshCullingDataBuffer
impl !UnwindSafe for MeshCullingDataBuffer
impl Freeze for MeshCullingDataBuffer
impl Send for MeshCullingDataBuffer
impl Sync for MeshCullingDataBuffer
impl Unpin for MeshCullingDataBuffer
impl UnsafeUnpin for MeshCullingDataBuffer
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
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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
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>
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>
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)
&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)
&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<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
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>
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