TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::VsyncLock Class Reference

Whether frames are locked to the vsync, told by how long presenting them waited. More...

#include <gui_core/frame/gui_frame_clock.h>

Public Member Functions

void NotePresent (double presentSeconds, float refreshHz)
 After presenting a frame: the seconds present took; refreshHz 0 when unknown, which counts as not waiting.
bool IsLocked () const

Static Public Attributes

static constexpr int kFramesToSwitch = 3
 Presents in a row that waited, or didn't, before the lock changes.
static constexpr double kWaitedShare = 0.1
 The share of a refresh period present must wait to count as a vsync wait.

Detailed Description

Whether frames are locked to the vsync, told by how long presenting them waited.

A window the driver flips on the vsync waits most of a period in present; one the OS compositor draws (an unfocused window on Windows, a mailbox swapchain) returns at once, and its frames are shown on whichever vsync the compositor picks. FrameClock snaps to the refresh only while locked. It switches after kFramesToSwitch presents in a row say so, so one long frame, which leaves present nothing to wait for, doesn't unlock it.

Member Function Documentation

◆ NotePresent()

void tachyon::VsyncLock::NotePresent ( double presentSeconds,
float refreshHz )

After presenting a frame: the seconds present took; refreshHz 0 when unknown, which counts as not waiting.

◆ IsLocked()

bool tachyon::VsyncLock::IsLocked ( ) const
inline

Member Data Documentation

◆ kFramesToSwitch

int tachyon::VsyncLock::kFramesToSwitch = 3
staticconstexpr

Presents in a row that waited, or didn't, before the lock changes.

◆ kWaitedShare

double tachyon::VsyncLock::kWaitedShare = 0.1
staticconstexpr

The share of a refresh period present must wait to count as a vsync wait.


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