Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::rg::PassTimer Class Reference

A frame's full-screen passes, compiled and run. More...

#include <RenderGraph.hpp>

Classes

struct  Entry

Public Member Functions

 PassTimer (GfxDevice &device)
bool available ()
void beginFrame ()
void endFrame ()
void begin (const std::string &name)
void end ()
void segment (const std::string &name)
const std::vector< Entry > & last () const
f32 lastTotalMs () const
u32 framesRead () const
u32 framesDropped () const
u32 framesDisjoint () const
u32 framesSkipped () const
 Frames not timed because every slot was still waiting on the device.

Detailed Description

A frame's full-screen passes, compiled and run.

One instance is reused across frames: the graph is rebuilt every frame (cheap — a handful of passes) while the target pool it draws from persists, which is what makes reuse possible at all.

The pool is BORROWED, not owned: a graph is one chain and a frame holds several (per camera, plus the screen stack), so a pool inside the graph could hold nothing across two of them. Given one, every chain draws from the same targets, and so can a frame-lived resource.

What each pass of a graph cost the GPU, read a few frames late.

One timer query per pass per frame, in a ring so a result is fetched after the GPU has had time to finish it and the CPU never waits. A bracketing backend (GL) gets a begin/end around the pass; an arming one (WebGPU) gets the next pass named. Same-named passes of a frame (two cameras, two shadow views) are summed. Costs a query per pass, so it runs only while the profiler is on.

Definition at line 164 of file RenderGraph.hpp.

Constructor & Destructor Documentation

◆ PassTimer()

esengine::rg::PassTimer::PassTimer ( GfxDevice & device)
inlineexplicit

Definition at line 171 of file RenderGraph.hpp.

Member Function Documentation

◆ available()

bool esengine::rg::PassTimer::available ( )

Whether the device can time GPU work at all; probes on first call.

Definition at line 28 of file RenderGraph.cpp.

◆ begin()

void esengine::rg::PassTimer::begin ( const std::string & name)

Around one pass; arms or brackets by what the device does.

Definition at line 127 of file RenderGraph.cpp.

References end().

◆ beginFrame()

void esengine::rg::PassTimer::beginFrame ( )

Starts a frame: fetches what the ring has finished and claims this frame's slot.

Definition at line 61 of file RenderGraph.cpp.

Referenced by esengine::RenderFrame::end().

◆ end()

void esengine::rg::PassTimer::end ( )

Definition at line 144 of file RenderGraph.cpp.

Referenced by begin(), endFrame(), and segment().

◆ endFrame()

void esengine::rg::PassTimer::endFrame ( )

Definition at line 105 of file RenderGraph.cpp.

References end().

Referenced by esengine::RenderFrame::endFrame().

◆ framesDisjoint()

u32 esengine::rg::PassTimer::framesDisjoint ( ) const
inline

Definition at line 199 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ framesDropped()

u32 esengine::rg::PassTimer::framesDropped ( ) const
inline

Definition at line 198 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ framesRead()

u32 esengine::rg::PassTimer::framesRead ( ) const
inline

Why last() is as old as it is: frames read back, frames dropped unanswered, and frames the device said were disturbed, since the timer was made (render.gpuTimer.*).

Definition at line 197 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ framesSkipped()

u32 esengine::rg::PassTimer::framesSkipped ( ) const
inline

Frames not timed because every slot was still waiting on the device.

Definition at line 201 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ last()

const std::vector< Entry > & esengine::rg::PassTimer::last ( ) const
inline

The newest frame whose every pass was read back. Empty until one has been.

Definition at line 192 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ lastTotalMs()

f32 esengine::rg::PassTimer::lastTotalMs ( ) const
inline

Definition at line 193 of file RenderGraph.hpp.

Referenced by esengine::RenderFrame::endFrame().

◆ segment()

void esengine::rg::PassTimer::segment ( const std::string & name)

Splits the open pass: what has run so far is closed under the pass's own name, and the time from here is <pass>/<name> until the next split or the pass's end. Only where a pass is bracketed (GL); where it is armed the pass is one timestamp pair and this does nothing.

Definition at line 111 of file RenderGraph.cpp.

References end().


The documentation for this class was generated from the following files:
  • /home/runner/work/estella/estella/src/esengine/renderer/graph/RenderGraph.hpp
  • /home/runner/work/estella/estella/src/esengine/renderer/graph/RenderGraph.cpp