Record GPU render time
The render loop only takes the CPU render time into account at the moment, i.e. how long it takes to record rendering commands.
When gaming, the GPU is moderately loaded so the GPU render time can outnumber the CPU render time. The render loop has to insert timer queries.
The easiest way to implement that is to make the render backend provide the frame timings along the vblank timestamp, i.e.
struct FrameInfo
{
struct {
std::chrono::time_point start;
std::chrono::time_point end;
} cpu, gpu;
std::chrono::time_point vblankTimestamp;
};
and the RenderLoop private API must use it
class RenderLoopPrivate
{
public:
void notifyFrameCompleted(const FrameInfo &frameInfo);
};
Q: Why not just make the RenderJournal insert the timer queries?
A: It's simpler if the render backend provides the frame timings, the render journal doesn't need to wait on any timer queries or handle graphics resets.