Skip to main content

ClusterPool

Struct ClusterPool 

Source
pub struct ClusterPool { /* private fields */ }
Expand description

The four cluster buffers, and where each mesh’s clusters are in them.

Implementations§

Source§

impl ClusterPool

Source

pub fn new( device: &dyn Device, label: &str, meshes: &[PooledMesh], ) -> Result<Self, HalError>

Uploads meshes’ clusters, concatenated in the order given, and returns the pool plus a range per mesh.

The three buffers are HostUpload rather than device-local with a staging copy, on InstancePool’s terms: they are written once at start-up and read by every frame, and a staging copy would buy a transfer submit and a barrier for bytes that never change. A bake cache that streams clusters is what would make them device-local, and that is §3.5’s own later slice.

§Errors

HalError from any seam call, and HalError::InvalidDescriptor if meshes cluster into nothing — a pipeline whose cluster buffer is empty has a mesh stage that cannot safely read element zero, which is the read its out-of-range path makes.

Source

pub const fn clusters(&self) -> BufferHandle

The cluster records, as mesh_cluster.slang’s binding 9.

Source

pub const fn vertices(&self) -> BufferHandle

The per-cluster vertex runs, as binding 10.

Source

pub const fn corners(&self) -> BufferHandle

The packed corner words, as binding 11.

Source

pub const fn selection(&self) -> BufferHandle

The per-cluster selection records, as binding 17.

Source

pub const fn count(&self) -> u32

How many clusters the pool holds in total — the length of the buffer a frame records its chosen cut into.

Source

pub fn range(&self, index: usize) -> Option<ClusterRange>

Where mesh index’s clusters are, in the order ClusterPool::new received them.

Source

pub fn destroy(self, device: &dyn Device)

Releases the four buffers. The device must be idle.

Trait Implementations§

Source§

impl Debug for ClusterPool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HalThreadSafe for T
where T: Send + Sync,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.