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 (std::unique_ptr< score::gfx::OutputNode > 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) |
| int32_t | add_preview (port_index producer, QSize size, std::shared_ptr< QRhiReadbackResult > readback) |
Previews what producer outputs, into readback, at most size. | |
| void | set_preview_producer (int32_t id, port_index producer) |
| void | set_preview_size (int32_t id, QSize size) |
| void | remove_preview (int32_t id) |
| bool | preview_is_tapped (int32_t id) const noexcept |
| Whether the preview reads from a render list of the patch. | |
| bool | preview_is_on_hub (int32_t id) const noexcept |
| Whether the preview reads from the shared output of the previews. | |
| void | want_preview_frame (int32_t id) const noexcept |
| 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 |
Static Public Attributes | |
| static constexpr int | max_preview_size = 1024 |
| The largest a preview renders and reads back at, on either side. | |
Friends | |
| class | GfxExecutionAction |
Member Function Documentation
◆ add_preview()
| int32_t Gfx::GfxContext::add_preview | ( | port_index | producer, |
| QSize | size, | ||
| std::shared_ptr< QRhiReadbackResult > | readback | ||
| ) |
Previews what producer outputs, into readback, at most size.
When an output of the patch renders the producer, its render list reads the port back (score::gfx::PreviewTap): nothing is rendered twice and the preview shows what the output shows. Otherwise the preview gets an offscreen output of its own, which renders the producer's chain, until an output of the patch renders it. Returns an id for the calls below.
◆ 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()
|
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()
|
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.
◆ want_preview_frame()
|
noexcept |
The consumer took the latest image: the next frame of the list reading the preview back reads it again. See score::gfx::PreviewTap::wanted.
The documentation for this class was generated from the following files:
- GfxContext.hpp
- GfxContext.cpp