Trait luminance::backend::tess::InstanceSlice[][src]

pub unsafe trait InstanceSlice<'a, V, I, W, S, T>: Tess<V, I, W, S> where
    V: TessVertexData<S>,
    I: TessIndex,
    W: TessVertexData<S>,
    S: ?Sized
{ type InstanceSliceRepr: 'a + Deref<Target = [T]>; type InstanceSliceMutRepr: 'a + DerefMut<Target = [T]>; unsafe fn instances(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::InstanceSliceRepr, TessMapError>;
unsafe fn instances_mut(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::InstanceSliceMutRepr, TessMapError>; }
Expand description

Slice instance data on CPU.

This trait must be implemented by the backend so that it’s possible to slice the instance data. The idea is that the instance storage is backend-dependent; the backend can decide to cache the data, or not, and we should assume the data to live in a memory that is costly to access. For this reason, slicing the instance data requires to get an object on which one can use Deref (and possibly DerefMut). The InstanceSlice::instances and InstanceSlice::instances_mut methods must get such objects. Implementations will typically map memory regions and retain the mapped data until the InstanceSlice::InstanceSliceRepr and InstanceSlice::InstanceSliceMutRepr objects are dropped (c.f. Drop).

Associated Types

Backend representation of an immutable instance slice.

Backend representation of a mutable instance slice.

Required methods

Obtain an immutable instance slice.

Even though this method returns an immutable slice, it has to mutably borrow the tessellation to prevent having two immutable slices living at the same time. This is a limitation that some backends might need.

Obtain a mutable instance slice.

Implementors