Loading...
Searching...
No Matches
score::gfx::RenderClock Class Referenceabstract

Abstract render clock. More...

Inheritance diagram for score::gfx::RenderClock:
score::gfx::DisplayVSyncClock score::gfx::ExternalGenlockClock score::gfx::TimerClock

Detailed Description

Abstract render clock.

A RenderClock owns how render ticks are delivered to an output and guarantees that the render callback runs on score's render thread. Two facets exist in the wild:

  • a push facet: a swap-chain vsync callback or a QTimer fires and we react (DisplayVSyncClock, TimerClock);
  • a pull facet: a thread blocks on a hardware event (a card's vertical interrupt) and marshals the render onto the render thread (ExternalGenlockClock).

This interface wraps the two clocks score already had — the display vsync callback and the shared wall-timer — with byte-identical behaviour. Nothing is gated behind a flag: this is a pure refactor.

Public Types

enum class  Kind { Timer , DisplayVSync , ExternalGenlock }
 

Public Member Functions

virtual Kind kind () const noexcept=0
 
virtual void start (std::function< void()> tick)=0
 Begin delivering ticks.
 
virtual void stop ()=0
 Stop delivering ticks and release the underlying tick source.
 

Member Function Documentation

◆ start()

virtual void score::gfx::RenderClock::start ( std::function< void()>  tick)
pure virtual

Begin delivering ticks.

tick is invoked once per render tick, on the render thread. The clock owns the tick source (timer, vsync registration, or hardware wait loop).

Implemented in score::gfx::TimerClock, score::gfx::DisplayVSyncClock, and score::gfx::ExternalGenlockClock.

◆ stop()

virtual void score::gfx::RenderClock::stop ( )
pure virtual

Stop delivering ticks and release the underlying tick source.

Implemented in score::gfx::TimerClock, score::gfx::DisplayVSyncClock, and score::gfx::ExternalGenlockClock.


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