Loading...
Searching...
No Matches
Gfx::GfxContext Class Reference
Inheritance diagram for Gfx::GfxContext:

Public Types

using NodePtr = std::unique_ptr< score::gfx::Node >
 

Public Member Functions

 GfxContext (const score::DocumentContext &ctx)
 
int32_t register_node (NodePtr node)
 
int32_t register_preview_node (NodePtr node)
 
void connect_preview_node (EdgeSpec e)
 
void disconnect_preview_node (EdgeSpec e)
 
void unregister_node (int32_t idx)
 
void unregister_preview_node (int32_t idx)
 
void destroyOutput (score::gfx::OutputNode *node)
 
std::span< score::gfx::OutputNode *const > outputs () const noexcept
 
void recompute_edges ()
 
void recompute_graph ()
 
void recompute_connections ()
 
void recomputeTimers ()
 
void recomputeGraphTopology ()
 
void incrementalEdgeUpdate (const ossia::flat_set< EdgeSpec > &old_edges, const ossia::flat_set< EdgeSpec > &cur_edges)
 
void update_inputs ()
 
void updateGraph ()
 
void renderFrames (int frames)
 Render exactly frames times, synchronously, and return.
 
double stepRate () const noexcept
 Step used by renderFrames(), in frames per second.
 
void setStepRate (double fps)
 
bool executionStepped () const noexcept
 Whether the execution currently only advances through renderFrames().
 
bool renderInProgress () const noexcept
 Whether a render driven from here, or a frame on one of the outputs' devices, is under way on the calling stack.
 
void send_message (score::gfx::Message &&msg) noexcept
 
AssetTable & assets () noexcept
 Session-wide content-hash decode cache.
 
const AssetTable & assets () const noexcept
 

Friends

class GfxExecutionAction
 

Member Function Documentation

◆ assets()

AssetTable & Gfx::GfxContext::assets ( )
inlinenoexcept

Session-wide content-hash decode cache.

Shared across all RenderLists in this GfxContext. Loaders stage decoded bytes here on their worker thread; downstream consumers (texture upload, mesh VB/IB assembly) acquire by content hash, avoiding re-decoding the same source asset across multiple outputs or reloads. See Gfx/AssetTable.hpp.

◆ outputs()

std::span< score::gfx::OutputNode *const > Gfx::GfxContext::outputs ( ) const
noexcept

The outputs the render clocks will drive. An output missing from here is never rendered, whatever else was built for it.

◆ renderFrames()

void Gfx::GfxContext::renderFrames ( int  frames)

Render exactly frames times, synchronously, and return.

The normal path renders off wall-clock timers, so "how many frames have I drawn" depends on how long the caller happened to wait and how fast the machine is – a harness that sleeps and then grabs gets a different frame on a Raspberry Pi than on a workstation, and an animated shader gives a different image every run.

Stepping instead makes frame N mean the same thing everywhere, which is what lets a rendered frame be compared against a stored reference at all.

Each step also hands every process node a synthetic token of frame / stepRate(), so TIME, TIMEDELTA, FRAMEINDEX and PROGRESS follow the counter rather than whatever the transport last delivered. Without it an animated shader keeps reading the execution clock and frame N is a different picture every run.

When the document is playing, each step first runs the execution for exactly one step of samples, so automations, scripts and media positions are at (frame + 1) / stepRate() seconds of execution when frame N is drawn. The count restarts at every play.

◆ renderInProgress()

bool Gfx::GfxContext::renderInProgress ( ) const
noexcept

Whether a render driven from here, or a frame on one of the outputs' devices, is under way on the calling stack.

Every entry point that updates the graph or renders (the render clocks, the free-wheel and vsync callbacks, renderFrames) returns without doing anything while this holds.

◆ setStepRate()

void Gfx::GfxContext::setStepRate ( double  fps)

A rate above zero puts the execution under the step clock: now if the document plays, else from its next play, until that play stops.


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