Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::render::GpuRenderTimeTracker Class Reference

Thread-safe holder for the latest GPU render-time sample. More...

#include <gpu_render_time.hpp>

Public Member Functions

void store (std::uint64_t elapsed_ns, bool callback_ok)
 Store a sample from the finished-with-stats callback.
bool have_sample () const
 True once at least one valid sample has landed.
double last_ms () const
 The most recent valid GPU render duration in milliseconds (0 until the first sample lands).

Detailed Description

Thread-safe holder for the latest GPU render-time sample.

The Graphite finished-with-stats callback fires on whatever thread pumps GPU completion (the render thread, via Context::submit), while the inspector reads from the UI thread. A scalar duration + a "have a sample yet" flag are independent atomics; a stale read across the pair is harmless (it only ever shows a slightly older valid duration). Relaxed ordering is sufficient — there is no other state these guard.

Member Function Documentation

◆ have_sample()

bool pulp::render::GpuRenderTimeTracker::have_sample ( ) const
inlinenodiscard

True once at least one valid sample has landed.

Lets the inspector distinguish "supported, waiting for the first sample" from "0 ms".

◆ last_ms()

double pulp::render::GpuRenderTimeTracker::last_ms ( ) const
inlinenodiscard

The most recent valid GPU render duration in milliseconds (0 until the first sample lands).

◆ store()

void pulp::render::GpuRenderTimeTracker::store ( std::uint64_t elapsed_ns,
bool callback_ok )
inline

Store a sample from the finished-with-stats callback.

Ignored when the callback failed or the elapsed time is zero (so the last good sample is retained rather than being clobbered by a "no sample" frame).


The documentation for this class was generated from the following file: