Loading...
Searching...
No Matches
score::gfx::Graph Struct Reference

Represents a graph of renderers. More...

Detailed Description

Represents a graph of renderers.

Public Member Functions

 Graph ()
 Create a render graph.
 
void addNode (score::gfx::Node *n)
 Add a node to the graph.
 
void removeNode (score::gfx::Node *n)
 Remove a node from the graph.
 
void addEdge (Port *source, Port *sink, Process::CableType t)
 Add an edge between two nodes.
 
void removeEdge (Port *source, Port *sink)
 Remove an edge between two nodes.
 
EdgefindEdge (Port *source, Port *sink)
 Live edge for a port pair, or null.
 
void removeNodeFromRenderLists (Node *node)
 Remove a node's renderers from all render lists.
 
void removeNodeAndEdges (Node *node)
 
void onEdgeRemoved (Edge &edge, const ossia::hash_set< const Port * > *preserveSinks=nullptr)
 
void updateSinkSampler (Edge &edge)
 
void createAllMissingPasses ()
 Create missing passes and update samplers for ALL edges in ALL render lists.
 
void updateAllSinkSamplers ()
 
void createPassForEdgeIfMissing (Edge &edge)
 
void reconcileAllRenderLists ()
 
void clearEdges ()
 Remove all edges.
 
void createAllRenderLists (GraphicsApi graphicsApi)
 For each output node, create the sequence of render events that will be called.
 
void createSingleRenderList (score::gfx::OutputNode &node, GraphicsApi graphicsApi)
 Create a sequence of render events for a single output node.
 
void destroyOutputRenderList (score::gfx::OutputNode &node)
 Free the render list of an output node if any.
 
void releaseOutputRenderList (score::gfx::OutputNode &node)
 Release + deregister the render list built against node's QRhi, leaving the output itself alone.
 
void relinkGraph ()
 Recreate the connections between renderers when edges changed.
 
bool canDoVSync () const noexcept
 True if the graph supports being driven by the screen vertical synchronization.
 
void createMissingRenderLists ()
 Build render lists for outputs that lost or never got one.
 
const std::vector< std::shared_ptr< RenderList > > & renderLists () const noexcept
 
std::span< OutputNode *const > outputs () const noexcept
 
void setAssetTable (Gfx::AssetTable *a) noexcept
 Inject the session-wide AssetTable.
 
Gfx::AssetTableassetTable () const noexcept
 

Member Function Documentation

◆ createMissingRenderLists()

void score::gfx::Graph::createMissingRenderLists ( )

Build render lists for outputs that lost or never got one.

An output whose swapchain was not ready when the graph was built gets no RenderList (initializeOutput does nothing when renderState() exists but canRender() is false), and a createOutputRenderList that threw leaves it renderer-less too. Both are invisible to every incremental path until the next full rebuild. Called once per graph tick as a recovery.

◆ createPassForEdgeIfMissing()

void score::gfx::Graph::createPassForEdgeIfMissing ( Edge edge)

For an added edge, create the output pass on the source renderer if it exists but doesn't already have a pass for this edge.

◆ onEdgeRemoved()

void score::gfx::Graph::onEdgeRemoved ( Edge edge,
const ossia::hash_set< const Port * > *  preserveSinks = nullptr 
)

Called when an edge is removed from the graph.

Parameters
preserveSinksOptional set of sink Ports whose input render target should be kept alive even if this edge was their only feed. GfxContext::incrementalEdgeUpdate uses this to bridge the brief "sink has 0 edges" window that appears during a mid-batch filter insertion (A→B removed, A→F and F→B added in the same batch). Without this, B's input RT would be destroyed and immediately re-allocated with the same spec.

◆ reconcileAllRenderLists()

void score::gfx::Graph::reconcileAllRenderLists ( )

After all edges have been added/removed, reconcile all render lists: retopological sort, create renderers for newly-reachable nodes, create render targets and passes, remove unreachable nodes.

◆ releaseOutputRenderList()

void score::gfx::Graph::releaseOutputRenderList ( score::gfx::OutputNode node)

Release + deregister the render list built against node's QRhi, leaving the output itself alone.

This is the half of destroyOutputRenderList() that must run before an output destroys its own device (live swapchain-flag / -format toggles). Handed to outputs as OutputConfiguration::onReleaseRenderList.

◆ removeNodeAndEdges()

void score::gfx::Graph::removeNodeAndEdges ( Node node)

Incrementally remove a non-output node: notify renderers of each edge being removed, delete edges from m_edges, release the node's renderers, retopological sort affected render lists, remove from m_nodes.

◆ setAssetTable()

void score::gfx::Graph::setAssetTable ( Gfx::AssetTable a)
inlinenoexcept

Inject the session-wide AssetTable.

GfxContext owns the AssetTable and calls this once at graph construction. All RenderLists subsequently created by this Graph receive the pointer via their constructor, so the preprocessor can hit the content-hash cache when decoding texture_source / buffer_resource payloads.

Null is allowed (tests, early teardown) — consumers guard.

◆ updateSinkSampler()

void score::gfx::Graph::updateSinkSampler ( Edge edge)

For an added edge, update the sink renderer's input sampler to point to the (possibly new) render target texture.


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