Skip to main content

GpuComponentArrayBuffer

Trait GpuComponentArrayBuffer 

Source
pub trait GpuComponentArrayBuffer:
    Component
    + Send
    + Sync
    + 'static {
    type QueryData: ReadOnlyQueryData;
    type QueryFilter: QueryFilter;
    type Out: NoUninit + AnyBitPattern;

    // Required method
    fn extract_component(
        item: QueryItem<'_, '_, Self::QueryData>,
    ) -> Option<Self::Out>;

    // Provided methods
    fn label() -> Cow<'static, str> { ... }
    fn buffer_usage() -> BufferUsages { ... }
}
Expand description

A lightweight mechanism to expose component data that may differ between mesh instances to the GPU in the form of a ShaderBuffer.

Required Associated Types§

Source

type QueryData: ReadOnlyQueryData

The query to perform to update the component data.

Source

type QueryFilter: QueryFilter

An optional filter to apply to the query.

Source

type Out: NoUninit + AnyBitPattern

The packed GPU data.

Required Methods§

Source

fn extract_component( item: QueryItem<'_, '_, Self::QueryData>, ) -> Option<Self::Out>

Packs the component into a form suitable for the GPU.

If None is returned, then the component data is removed from the component array buffer entirely.

Provided Methods§

Source

fn label() -> Cow<'static, str>

Override this function to supply a custom debugging label for the buffer.

Source

fn buffer_usage() -> BufferUsages

Override this function to provide a custom set of allowed buffer usages for the buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§