Skip to main content

GeneratedDraws

Struct GeneratedDraws 

Source
pub struct GeneratedDraws {
    pub args: BufferHandle,
    pub args_id: BufferId,
    pub counts: BufferHandle,
    pub counts_id: BufferId,
    pub flat_args_offset: u64,
    pub runs_id: BufferId,
    pub group_state_id: BufferId,
    pub visible_count_id: BufferId,
}
Expand description

What one frame’s generated draws live in.

Returned by DrawGen::add_passes and consumed by the caller’s render pass, which needs both halves: the BufferIds to declare its reads with, so the graph transitions them, and the handles to name in the indirect call itself.

Fields§

§args: BufferHandle

The indirect arguments, draw_gen::DRAW_ARGS_SIZE bytes per bucket.

A buffer of its own, unlike the counts and dispatch extents below, and for the one reason that survives the storage-buffer squeeze the module docs describe: the mesh path reads these as a shader read in the same pass that executes those as indirect arguments, and a resource is in one state at a time.

§args_id: BufferId

The same buffer as the graph knows it. Declare it in ResourceState::IndirectArgument, or as a shader read on the mesh path.

§counts: BufferHandle

The per-bucket draw counts and the per-bucket mesh-dispatch arguments, in that order, in one buffer.

At DrawGen::count_offset(b) is bucket b’s u32 draw count: 1 for a bucket with something in it and 0 for one without, which is what GeometryPath::IndirectCount’s call reads. At DrawGen::mesh_args_offset(b) are its draw_gen::MESH_ARGS_SIZE bytes of (clusters, surviving instances, 1) — or, where DrawGenDesc::task_lanes is non-zero, task_extents of those two — which is what CommandEncoder::draw_mesh_tasks_indirect reads on GeometryPath::MeshShader.

One buffer because no pass reads both: the two indirect tails execute the counts and the mesh path executes the extents, so it is in ResourceState::IndirectArgument either way and never in two states at once.

§counts_id: BufferId

The same buffer as the graph knows it. Declare it in ResourceState::IndirectArgument — once, whichever region the pass reads.

§flat_args_offset: u64

Byte offset in counts of region 0’s first flat task dispatch: behind every region this generator allocates, one draw_gen::MESH_ARGS_SIZE structure per flat segment a region, which is where a flat call’s arguments are — see DrawGen::flat_args_offset. Per generator rather than per renderer, because it sits behind however many regions the generator was built with.

§runs_id: BufferId

cull.slang’s survivor list, each survivor’s route, the per-bucket runs of surviving instance indices the vertex stage reads, and where each run starts this frame, in that order, in one buffer. Declare it as a shader read.

A pass that draws reads only the starts and the runs: bucket b’s start at word DrawGen::bucket_start_word(b) — which is the number DrawConstants::start_at carries — and then the run from the word that start names.

§group_state_id: BufferId

Topic 25’s hysteresis state, as the graph knows it.

Here because a caller whose geometry path has an amplification stage reads it: mesh_cluster.slang looks up the two groups a cluster names, so the pass that runs it declares ResourceState::ShaderRead on this id and the graph orders that read after the draw-argument pass’s write. A caller on a path with no amplification stage declares nothing, and the state is then written and read by that pass alone.

§visible_count_id: BufferId

The frame’s culling statistics, as the graph knows them — the buffer DrawGen::visible_count hands out.

Here because §3.5’s amplification stage writes it: it counts surviving clusters into CLUSTER_SURVIVOR_WORD, so the pass that runs it declares ResourceState::ShaderReadWrite on this id and the graph orders that write after the draw-argument pass’s read. A caller on a geometry path with no amplification stage declares nothing and the counter keeps the zero the clearing pass wrote.

Trait Implementations§

Source§

impl Clone for GeneratedDraws

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 Copy for GeneratedDraws

Source§

impl Debug for GeneratedDraws

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> 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.