Skip to main content

FrameCounters

Struct FrameCounters 

Source
pub struct FrameCounters {
    pub draws: u64,
    pub instances: u64,
    pub drawn: Option<u64>,
    pub triangles: Option<u64>,
    pub clusters: Option<u64>,
    pub cull_frame: Option<u64>,
}
Expand description

Draw calls, instances and triangles one frame recorded.

Built by plusing each renderer’s contribution onto FrameCounters::default; see the module docs for what the two Options mean and when they are None.

Fields§

§draws: u64

Draw calls the frame’s passes recorded.

Always known, on every geometry path: an indirect call is still a call the CPU wrote into the command buffer. On the GPU-driven path this is the number topic 03 §3.3 is about — one per bucket, independent of what the scene holds.

§instances: u64

Instances the frame submitted to be drawn or culled.

Also always known: a sprite pass uploads its instances and a ForwardRenderer knows how many live instances its pool holds, which is what the cull dispatch is given.

§drawn: Option<u64>

Instances the recorded draws actually cover, or None where nothing counted them.

The pair with instances is the plan’s “instances submitted vs drawn”. Where a pass culls nothing the two are equal and deliberately so — that is the true answer, not a placeholder.

On the GPU-driven path this is what the cull kept, off crcbl_render::cull_stats’s ring, and therefore a number about the frame cull_frame names. None there means the ring has not come round yet, or the device would not give one — see the module docs.

§triangles: Option<u64>

Triangles those draws cover, or None where a pass draws indirectly.

Exact where it is Some: a sprite is six vertices of a triangle list and the UI pass draws an index count it wrote itself. Nothing here is a per-mesh average, and nothing derives one from a cluster count.

§clusters: Option<u64>

Clusters the amplification stage kept, or None where nothing counted them.

None on the two indirect geometry paths and on a device with Features::MESH_SHADER and no Features::TASK_SHADER: those frames have no amplification stage, so nothing rejects a cluster and nothing counts one. The row says UNKNOWN there, which is a different claim from the zero that word would otherwise be — “every cluster was rejected” about a frame that drew all of them.

Some(0) for a frame of sprites and UI, which really did draw no clusters. That is what makes Default the identity of plus here as it is for the others.

§cull_frame: Option<u64>

Which frame drawn and clusters came back from, where either came off the GPU.

None on a frame whose counters are entirely the CPU’s own, which is every frame with no ForwardRenderer in it — there is no second lag to declare, so there is no row.

Implementations§

Source§

impl FrameCounters

Source

pub const fn plus(self, other: FrameCounters) -> FrameCounters

These and another pass’s contribution, added.

The two totals sum. The two Options sum only when both sides know — one unknown makes the total unknown, because a sum that dropped the unknown side’s share would be a smaller number wearing a total’s name.

Trait Implementations§

Source§

impl Clone for FrameCounters

Source§

fn clone(&self) -> FrameCounters

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 FrameCounters

Source§

impl Debug for FrameCounters

Source§

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

Formats the value using the given formatter. Read more
Source§

impl DebugModule for FrameCounters

The panel row.

Labels are long enough to be unique across the whole panel: DebugModule labels share one namespace and nothing detects a collision, so a bare drawn here would be the same label apps/horde’s scene section already uses, and a test searching the draw list by label text would read whichever came first.

The last row is the frame stamp, and it appears only when something in the section came off the GPU — see the module docs on the two lags this section carries and why the newer one is not allowed to speak for both.

Source§

fn debug_section(&self, out: &mut DebugSection)

Writes this system’s title and rows into out.
Source§

impl Default for FrameCounters

A frame that recorded nothing — and knows it did.

Hand-written rather than derived, because a derived Default would leave the two Options at None, which is this type’s word for “the GPU knows and the CPU does not”. Those are opposite claims, and the accumulator has to start from the first one: this value is the identity of plus, so summing a frame’s renderers onto it reports exactly what they recorded.

Source§

fn default() -> FrameCounters

Returns the “default value” for a type. Read more
Source§

impl Eq for FrameCounters

Source§

impl PartialEq for FrameCounters

Source§

fn eq(&self, other: &FrameCounters) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FrameCounters

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.