pub struct ClusterPool { /* private fields */ }Expand description
The four cluster buffers, and where each mesh’s clusters are in them.
Implementations§
Source§impl ClusterPool
impl ClusterPool
Sourcepub fn new(
device: &dyn Device,
label: &str,
meshes: &[PooledMesh],
) -> Result<Self, HalError>
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.
Sourcepub const fn clusters(&self) -> BufferHandle
pub const fn clusters(&self) -> BufferHandle
The cluster records, as mesh_cluster.slang’s binding 9.
Sourcepub const fn vertices(&self) -> BufferHandle
pub const fn vertices(&self) -> BufferHandle
The per-cluster vertex runs, as binding 10.
Sourcepub const fn corners(&self) -> BufferHandle
pub const fn corners(&self) -> BufferHandle
The packed corner words, as binding 11.
Sourcepub const fn selection(&self) -> BufferHandle
pub const fn selection(&self) -> BufferHandle
The per-cluster selection records, as binding 17.
Sourcepub const fn count(&self) -> u32
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.
Sourcepub fn range(&self, index: usize) -> Option<ClusterRange>
pub fn range(&self, index: usize) -> Option<ClusterRange>
Where mesh index’s clusters are, in the order ClusterPool::new
received them.