Skip to main content

DrawGenDesc

Struct DrawGenDesc 

Source
pub struct DrawGenDesc<'a> {
Show 14 fields pub label: Option<&'a str>, pub instances: &'a [BufferHandle], pub mesh_table: BufferHandle, pub bucket_meshes: &'a [u32], pub bucket_modes: &'a [u32], pub bucket_clusters: &'a [u32], pub bucket_cluster_bases: &'a [u32], pub mesh_levels: &'a [MeshLevels], pub level_groups: &'a [LevelGroup], pub level_meshes: &'a [u32], pub instance_capacity: u32, pub hidden_view: u32, pub mode: DrawMode, pub task_lanes: u32,
}
Expand description

How large a DrawGen is, and what it draws.

Fields§

§label: Option<&'a str>

Debug name; every buffer is named after it.

§instances: &'a [BufferHandle]

The instance array, one buffer per frame in flight — the ring crate::instance_pool::InstancePool::buffers hands out. Its length is how many frames this keeps state for.

§mesh_table: BufferHandle

The mesh table both dispatches resolve ranges and bounds out of.

§bucket_meshes: &'a [u32]

Which mesh each bucket draws, as an index into the mesh table, in bucket order. One entry per indirect call the caller will record.

§bucket_modes: &'a [u32]

Which material mode each bucket draws, in the same order — the other half of a bucket’s routing key.

GpuMaterial::mode of the rows the scene holds, and the scatter sends an instance to the bucket matching its mesh and the mode its own record carries. So one mesh drawn by an opaque material and by a cutout one is two buckets, and the depth prepass and the shadow atlas bind a pipeline per bucket instead of one per frame.

The same length as bucket_meshes. All zeroes for a scene whose materials are all opaque, which is every demo in this tree: one bucket per mesh, and the region costs one word each.

§bucket_clusters: &'a [u32]

How many clusters each bucket’s mesh has, in the same order — the x extent of that bucket’s mesh dispatch, and the only word of the mesh-dispatch arguments — see DrawGen::mesh_args — the GPU does not decide.

Zero on every geometry path with no mesh stage, where nothing reads those arguments. It is still the same length as bucket_meshes: the pass writes one structure per bucket whatever the path, exactly as it writes one draw argument per bucket.

§bucket_cluster_bases: &'a [u32]

Where each bucket’s mesh’s clusters start in the cluster pool, in the same order — TableOffsets::bucket_cluster_bases_at’s region, which this pass packs and never reads.

Zero on every geometry path with no mesh stage, like bucket_clusters, and the same length as bucket_meshes.

§mesh_levels: &'a [MeshLevels]

Where each mesh’s cluster DAG is, indexed by mesh id — so this is parallel to the mesh table and long enough for every id an instance can name, not one entry per bucket.

MeshLevels::FLAT with its first_level filled in is what an entry for a mesh with no hierarchy holds, and it is also what a caller whose geometry path selects per cluster hands over for every mesh — see crcbl_shaders::level_select, which is where that arrangement is written down.

§level_groups: &'a [LevelGroup]

Every mesh’s DAG groups end to end, in the order mesh_levels points into. Empty where nothing has a hierarchy.

§level_meshes: &'a [u32]

Which mesh draws which level: element first_level + d of a mesh’s run is the mesh id of its level d.

§instance_capacity: u32

Instances the pool this culls can hold.

Sizes the visible list, its routes, and the one run region every bucket shares, which is what makes a bucket unable to overflow: at most this many instances survive, and they are spread across the buckets rather than duplicated into each — see the module docs.

It also sizes topic 25’s hysteresis state, which is one word per (instance slot, group) — see DrawGen::group_state.

§hidden_view: u32

The GpuInstance::flags bit that removes an instance from this cull, written into every frame’s cull parameters.

One bit of GpuInstance::HIDDEN_VIEWS_MASK for a generator that culls for a camera, and GpuInstance::CASTS_NO_SHADOW for one that culls for no view — a shadow cascade’s or a shadowed light’s — so an instance a camera hides still casts its shadow and one told not to cast does not. Zero rejects nothing on it.

§mode: DrawMode

The most a frame of this generator may ask for, which decides what it allocates: DrawMode::Plain is region 0 alone, as every generator was; DrawMode::Occlusion adds the two occlusion regions and dispatches the occlusion pipelines, which its DrawGenPipelines must carry; DrawMode::Faces adds six face regions and six capacities of face runs.

A frame may always run DrawMode::Plain instead — see DrawGen::begin_frame_with.

§task_lanes: u32

How many (cluster, instance slot) pairs one task workgroup of the mesh tail decides — draw_gen::Params::task_lanes.

TASK_LANES for a caller drawing behind mesh_cluster.slang’s amplification stage, which then reads each bucket’s mesh-dispatch extents as task_extents. Zero for every other caller, including a mesh path with no task stage: its meshMain launches one workgroup per pair from the (clusters, instances, 1) extents zero leaves in place.

Trait Implementations§

Source§

impl<'a> Clone for DrawGenDesc<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for DrawGenDesc<'a>

Source§

impl<'a> Debug for DrawGenDesc<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for DrawGenDesc<'a>

§

impl<'a> Freeze for DrawGenDesc<'a>

§

impl<'a> Move for DrawGenDesc<'a>

§

impl<'a> RefUnwindSafe for DrawGenDesc<'a>

§

impl<'a> Send for DrawGenDesc<'a>

§

impl<'a> Sync for DrawGenDesc<'a>

§

impl<'a> Unpin for DrawGenDesc<'a>

§

impl<'a> UnsafeUnpin for DrawGenDesc<'a>

§

impl<'a> UnwindSafe for DrawGenDesc<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.