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). | |
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.
|
inlinenodiscard |
True once at least one valid sample has landed.
Lets the inspector distinguish "supported, waiting for the first sample" from "0 ms".
|
inlinenodiscard |
The most recent valid GPU render duration in milliseconds (0 until the first sample lands).
|
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).