Base class for sink nodes (QWindow, spout, syphon, NDI output, ...) More...
Detailed Description
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Classes | |
| struct | Configuration |
Public Member Functions | |
| virtual void | setRenderer (std::shared_ptr< RenderList >)=0 |
| virtual RenderList * | renderer () const =0 |
| OutputNodeRenderer * | createRenderer (RenderList &r) const noexcept override=0 |
| Create a renderer in a given context for this node. | |
| virtual void | startRendering ()=0 |
| virtual void | render ()=0 |
| virtual void | stopRendering ()=0 |
| virtual bool | canRender () const =0 |
| virtual void | onRendererChange ()=0 |
| virtual void | setVSyncCallback (std::function< void()>) |
| Set a callback to drive rendering when there is a single output. | |
| virtual void | createOutput (OutputConfiguration conf)=0 |
| virtual void | updateGraphicsAPI (GraphicsApi) |
| virtual void | destroyOutput ()=0 |
| virtual std::shared_ptr< RenderState > | renderState () const =0 |
| virtual Configuration | configuration () const noexcept=0 |
| virtual TextureRenderTarget | currentRenderTarget () const noexcept |
| The output's current backing render target + render-pass descriptor, as the upstream nodes should render into it NOW. | |
| 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. | |
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 | process (Message &&msg) |
| Process a message from the execution engine. | |
| 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. | |
| 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) |
Protected Member Functions | |
| void | releaseOwnedRenderList () |
| Invoke OutputConfiguration::onReleaseRenderList, if any. | |
Protected Attributes | |
| std::function< void()> | m_onReleaseRenderList |
| std::unique_ptr< GpuResourceRegistry > | m_registry |
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 {} |
Member Function Documentation
◆ acquireRegistry()
| GpuResourceRegistry & score::gfx::OutputNode::acquireRegistry | ( | ) |
Persistent GPU resource registry for this output.
Persist-across-rebuild contract: ownership is on the OutputNode, not the RenderList, so the texture-array data, the mesh slabs and the producer arena slot indices — all of which describe scene content, not framebuffer state — survive across Graph::recreateOutputRenderList.
Lifetime: lazy-allocated on first acquireRegistry() call (typically from RenderList::init), tied to the OutputNode's QRhi. Concrete outputs MUST call releaseRegistry() inside their destroyOutput() BEFORE tearing down the QRhi (via RenderState::destroy or setSwapchainFormat-style replacement) — otherwise the registry's QRhi resources would be freed against a destroyed device.
Returns a non-null reference. Always allocates if the slot is empty.
◆ createRenderer()
|
overridepure virtualnoexcept |
Create a renderer in a given context for this node.
Implements score::gfx::Node.
Implemented in score::gfx::BackgroundNode, score::gfx::DirectVideoOutputNode, score::gfx::KmsOutputNode, score::gfx::MultiWindowNode, score::gfx::ScreenNode, score::gfx::PreviewNode, Gfx::GStreamer::GStreamerOutputNode, Gfx::LibavEncoderNode, Gfx::PipeWire::PipewireOutputNode, Gfx::Sh4ltOutputNode, Gfx::ShmdataOutputNode, and Gfx::SpoutNode.
◆ currentRenderTarget()
|
inlinevirtualnoexcept |
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 -> 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 rebuilds the RenderList in place instead of reconstructing the renderer) leaves the upstream node's final pass bound to the freed render-pass descriptor — a Vulkan use-after-free of the VkRenderPass.
Reimplemented in score::gfx::BackgroundNode, and score::gfx::KmsOutputNode.
◆ releaseOwnedRenderList()
|
protected |
Invoke OutputConfiguration::onReleaseRenderList, if any.
Concrete outputs must call this immediately before any teardown of their QRhi that does not go through Graph::destroyOutputRenderList (i.e. the live swapchain-flag / -format setters). No-op outside a Graph, where the caller owns the whole lifetime anyway.
◆ releaseRegistry()
| void score::gfx::OutputNode::releaseRegistry | ( | ) |
Tear down the registry's QRhi resources directly. Idempotent.
MUST be called by concrete subclasses' destroyOutput() before they tear down the QRhi. Calls GpuResourceRegistry::destroyOwned() which deletes the buffer / texture / sampler wrappers (the QRhi is still alive at that point — the caller's responsibility), then resets the unique_ptr so a subsequent acquireRegistry() rebuilds fresh against the new QRhi.
Safe to call when no registry exists (no-op).
◆ setVSyncCallback()
|
virtual |
Set a callback to drive rendering when there is a single output.
If we render to a single window, we can use the GPU V-Sync mechanism. Otherwise the implementation will create timers to keep things in sync.
Reimplemented in score::gfx::MultiWindowNode, and score::gfx::ScreenNode.
The documentation for this class was generated from the following files:
- OutputNode.hpp
- OutputNode.cpp
Public Member Functions inherited from