|
JNGL
Easy to use cross-platform 2D game library
|
Measures how long the GPU takes for what's drawn between start() and stop(), e.g. More...
#include <jngl/GpuTimer.hpp>
Public Member Functions | |
| GpuTimer (const GpuTimer &)=delete | |
| GpuTimer & | operator= (const GpuTimer &)=delete |
| GpuTimer (GpuTimer &&) noexcept | |
| GpuTimer & | operator= (GpuTimer &&) noexcept |
| void | start () |
| Starts measuring what's drawn from now on. | |
| void | stop () |
| Stops measuring, for poll() to return how long the GPU took once that's known. | |
| std::optional< std::chrono::nanoseconds > | poll () |
| The oldest measurement that has come in since the last call, in the order of stop(), or nullopt if there's none (yet) | |
Static Public Member Functions | |
| static bool | isSupported () |
| Whether the GPU's time can be measured here. | |
Measures how long the GPU takes for what's drawn between start() and stop(), e.g.
a frame, without waiting for it to finish: a measurement comes in a few frames later, see poll().
Needs OpenGL 3.3's timer queries, which OpenGL ES and WebGL don't have. Without them, see isSupported(), start() and stop() do nothing and poll() never returns anything.
Example:
Definition at line 28 of file GpuTimer.hpp.
| void start | ( | ) |