Loading...
Searching...
No Matches
score::gfx::SinkNode Class Referencefinal

An output that draws nowhere. More...

Inheritance diagram for score::gfx::SinkNode:
score::gfx::OutputNode score::gfx::Node

Detailed Description

An output that draws nowhere.

The render graph only runs the nodes that lead to an output, so a node whose result is data (an AI model's Data outlet, an analysis) and whose texture goes nowhere never ran. This output pulls its input into an offscreen target at rate frames per second, and shows nothing.

The render clock ticks at the application's render rate; frames between two due ones are skipped, so the rate can change while playing without rebuilding the clocks. It is capped by the application's rate.

Public Member Functions

 SinkNode (double rate)
 
void setRate (double fps) noexcept
 
double rate () const noexcept
 
void process (Message &&msg) override
 Process a message from the execution engine.
 
void startRendering () override
 
void render () override
 
bool canRender () const override
 
void onRendererChange () override
 
void stopRendering () override
 
void setRenderer (std::shared_ptr< RenderList > r) override
 
RenderList * renderer () const override
 
void createOutput (OutputConfiguration conf) override
 
void destroyOutput () override
 
void updateGraphicsAPI (GraphicsApi api) override
 
std::shared_ptr< RenderState > renderState () const override
 
TextureRenderTarget currentRenderTarget () const noexcept override
 The output's current backing render target + render-pass descriptor, as the upstream nodes should render into it NOW.
 
OutputNodeRenderer * createRenderer (RenderList &r) const noexcept override
 Create a renderer in a given context for this node.
 
Configuration configuration () const noexcept override
 
int64_t frames () const noexcept
 
- Public Member Functions inherited from score::gfx::OutputNode
virtual void setVSyncCallback (std::function< void()>)
 Set a callback to drive rendering when there is a single output.
 
GpuResourceRegistry & acquireRegistry ()
 Persistent GPU resource registry for this output.
 
GpuResourceRegistry * registry () const noexcept
 Non-owning accessor. Returns null if no registry has been acquired yet (e.g. queried before the first RenderList::init).
 
void releaseRegistry ()
 Tear down the registry's QRhi resources directly. Idempotent.
 
virtual bool deviceLost () const noexcept
 True once the output's graphics device was reported lost.
 
void handleDeviceLost (const char *output) noexcept
 Mark the device as lost; logs once per device.
 
- Public Member Functions inherited from score::gfx::Node
 Node (const Node &)=delete
 
 Node (Node &&)=delete
 
Node & operator= (const Node &)=delete
 
Node & operator= (Node &&)=delete
 
virtual void renderedNodesChanged ()
 Whenever render nodes are added / removed.
 
virtual void update ()
 
void materialChange () noexcept
 Used to notify a material change from the model to the renderers.
 
bool hasMaterialChanged (int64_t &renderer) const noexcept
 
void renderTargetChange () noexcept
 Used to notify a render target (texture inlet) change from the model to the renderers.
 
bool hasRenderTargetChanged (int64_t &renderer) const noexcept
 
bool hasExplicitRenderTargetSize (int32_t port) const noexcept
 Whether a given port has a user-specified render target size.
 
bool hasExplicitRenderTargetSpecs (int32_t port) const noexcept
 Whether the user set a size or a format on a texture inlet.
 
QSize resolveRenderTargetSize (int32_t port, RenderList &renderer) const noexcept
 
RenderTargetSpecs resolveRenderTargetSpecs (int32_t port, RenderList &renderer) const noexcept
 
std::optional< RenderTargetSpecs > firstInputRenderTargetSpecs () const noexcept
 What the first texture input asks to be rendered into.
 
void process (int32_t port, const ossia::render_target_spec &v)
 

Additional Inherited Members

- Public Attributes inherited from score::gfx::Node
std::vector< Port * > input
 Input ports of that node.
 
ossia::small_pod_vector< Port *, 1 > output
 Output ports of that node.
 
ossia::flat_map< RenderList *, score::gfx::NodeRenderer * > renderedNodes
 Map associating each RenderList to a Renderer for this model.
 
ossia::flat_map< int32_t, ossia::render_target_spec > renderTargetSpecs
 Render target info.
 
std::atomic_int64_t materialChanged {0}
 
std::atomic_int64_t renderTargetSpecChanged {-1}
 
int32_t nodeId = score::gfx::invalid_node_index
 
bool requiresDepth {}
 
- Protected Member Functions inherited from score::gfx::OutputNode
bool checkDeviceLost (const OffscreenFrame &frame, QRhi &rhi, const char *output) noexcept
 Calls handleDeviceLost when the frame or the QRhi report a lost device. Returns deviceLost().
 
bool checkDeviceLost (int frameOpResult, QRhi &rhi, const char *output) noexcept
 
void resetDeviceLost () noexcept
 
void releaseOwnedRenderList ()
 Invoke OutputConfiguration::onReleaseRenderList, if any.
 
- Protected Attributes inherited from score::gfx::OutputNode
std::function< void()> m_onReleaseRenderList
 
std::unique_ptr< GpuResourceRegistry > m_registry
 
bool m_deviceLost {}
 

Member Function Documentation

◆ canRender()

bool score::gfx::SinkNode::canRender ( ) const
overridevirtual

◆ configuration()

OutputNode::Configuration score::gfx::SinkNode::configuration ( ) const
overridevirtualnoexcept

◆ createOutput()

void score::gfx::SinkNode::createOutput ( OutputConfiguration  conf)
overridevirtual

◆ createRenderer()

OutputNodeRenderer * score::gfx::SinkNode::createRenderer ( RenderList &  r) const
overridevirtualnoexcept

Create a renderer in a given context for this node.

Implements score::gfx::OutputNode.

◆ currentRenderTarget()

TextureRenderTarget score::gfx::SinkNode::currentRenderTarget ( ) const
overridevirtualnoexcept

The output's current backing render target + render-pass descriptor, as the upstream nodes should render into it NOW.

A sink whose render target / render-pass descriptor can be recreated mid-session (e.g. an offscreen BackgroundNode on a viewport resize, which deleteLater()s the old target and installs a fresh one) must override this so that a renderer which cached the target by value at construction can re-adopt the live handles when it is rebuilt (RenderList::maybeRebuild or rebuildOutputTargets -> OutputNodeRenderer::init). The default returns an empty target, meaning "nothing to refresh — keep the value captured at createRenderer() time".

Without this, the resize fast-path (resizeSwapchainSizedTargets, which re-inits the output renderer in place instead of reconstructing it) leaves the upstream node's final pass bound to the freed render-pass descriptor — a Vulkan use-after-free of the VkRenderPass.

Reimplemented from score::gfx::OutputNode.

◆ destroyOutput()

void score::gfx::SinkNode::destroyOutput ( )
overridevirtual

◆ onRendererChange()

void score::gfx::SinkNode::onRendererChange ( )
overridevirtual

◆ process()

void score::gfx::SinkNode::process ( Message &&  msg)
overridevirtual

Process a message from the execution engine.

Reimplemented from score::gfx::Node.

◆ render()

void score::gfx::SinkNode::render ( )
overridevirtual

◆ renderer()

RenderList * score::gfx::SinkNode::renderer ( ) const
overridevirtual

◆ renderState()

std::shared_ptr< RenderState > score::gfx::SinkNode::renderState ( ) const
overridevirtual

◆ setRenderer()

void score::gfx::SinkNode::setRenderer ( std::shared_ptr< RenderList >  r)
overridevirtual

◆ startRendering()

void score::gfx::SinkNode::startRendering ( )
overridevirtual

◆ stopRendering()

void score::gfx::SinkNode::stopRendering ( )
overridevirtual

◆ updateGraphicsAPI()

void score::gfx::SinkNode::updateGraphicsAPI ( GraphicsApi  api)
overridevirtual

Reimplemented from score::gfx::OutputNode.


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