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: u64Draw 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: u64Instances 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
impl FrameCounters
Sourcepub const fn plus(self, other: FrameCounters) -> FrameCounters
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
impl Clone for FrameCounters
Source§fn clone(&self) -> FrameCounters
fn clone(&self) -> FrameCounters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FrameCounters
Source§impl Debug for FrameCounters
impl Debug for FrameCounters
Source§impl DebugModule for FrameCounters
The panel row.
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)
fn debug_section(&self, out: &mut DebugSection)
out.Source§impl Default for FrameCounters
A frame that recorded nothing — and knows it did.
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.