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: BufferHandleThe 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: u32Instances 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.
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: DrawModeThe 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: u32How 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.