2#include <Gfx/Graph/Node.hpp>
3#include <Gfx/Graph/NodeRenderer.hpp>
4#include <Gfx/Graph/PointerState.hpp>
5#include <Gfx/Graph/RenderState.hpp>
6#include <Gfx/Graph/Uniforms.hpp>
8#include <score_plugin_gfx_export.h>
14class GpuResourceRegistry;
19 std::function<void()> onReady;
20 std::function<void()> onResize;
40 using score::gfx::NodeRenderer::NodeRenderer;
43 finishFrame(
RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res);
60 virtual void setRenderer(std::shared_ptr<RenderList>) = 0;
65 virtual void startRendering() = 0;
66 virtual void render() = 0;
67 virtual void stopRendering() = 0;
68 virtual bool canRender()
const = 0;
69 virtual void onRendererChange() = 0;
77 virtual void setVSyncCallback(std::function<
void()>);
82 virtual void destroyOutput() = 0;
83 virtual std::shared_ptr<RenderState> renderState()
const = 0;
97 std::optional<double> manualRenderingRate;
98 bool outputNeedsRenderPass{};
167 void releaseRegistry();
175 virtual bool deviceLost() const noexcept {
return m_deviceLost; }
180 void handleDeviceLost(
const char* output)
noexcept;
190 return m_pointerState;
198 bool checkDeviceLost(
const OffscreenFrame& frame, QRhi& rhi,
const char* output)
noexcept;
199 bool checkDeviceLost(
int frameOpResult, QRhi& rhi,
const char* output)
noexcept;
201 void resetDeviceLost() noexcept { m_deviceLost =
false; }
203 explicit OutputNode();
213 void releaseOwnedRenderList();
217 std::function<void()> m_onReleaseRenderList;
223 std::unique_ptr<GpuResourceRegistry> m_registry;
225 std::shared_ptr<PointerState> m_pointerState{std::make_shared<PointerState>()};
260SCORE_PLUGIN_GFX_EXPORT
262 RenderState& state, QRhiTexture& texture,
OutputDepth depth = OutputDepth::None,
272SCORE_PLUGIN_GFX_EXPORT
274 RenderState& state, TextureRenderTarget& target,
bool deferred =
false) noexcept;
Per-RenderList arena store for GPU-resident scene data.
Definition GpuResourceRegistry.hpp:45
Root data model for visual nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:115
Renderer for a given node.
Definition NodeRenderer.hpp:11
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:56
OutputNodeRenderer * createRenderer(RenderList &r) const noexcept override=0
Create a renderer in a given context for this node.
GpuResourceRegistry * registry() const noexcept
Non-owning accessor. Returns null if no registry has been acquired yet (e.g. queried before the first...
Definition OutputNode.hpp:153
virtual bool deviceLost() const noexcept
True once the output's graphics device was reported lost.
Definition OutputNode.hpp:175
const std::shared_ptr< PointerState > & pointerState() const noexcept
The mouse and touch points over this output, decoded from the window's events into vertexshaderart's ...
Definition OutputNode.hpp:188
Definition OutputNode.hpp:38
void removeOutputPass(RenderList &, Edge &) override
Definition OutputNode.hpp:48
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
TextureRenderTarget createOutputRenderTarget(RenderState &state, QRhiTexture &texture, OutputDepth depth, int samples)
The render target an offscreen output's input is drawn into.
Definition OutputNode.cpp:338
OutputDepth
The depth attachment of an output's render target.
Definition OutputNode.hpp:232
@ DepthStencil
Depth-stencil render buffer, as a window's swap chain has.
@ Texture
D32F texture, the format reverse-Z wants.
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:25
void releaseOutputRenderTarget(RenderState &state, TextureRenderTarget &target, bool deferred) noexcept
Frees what createOutputRenderTarget allocated, but not the texture.
Definition OutputNode.cpp:374
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:236
RAII bracket for QRhi::beginOffscreenFrame / endOffscreenFrame.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:54
Definition OutputNode.hpp:17
std::function< void()> onReleaseRenderList
Ask the owning Graph to release + deregister the RenderList that was built against this output's QRhi...
Definition OutputNode.hpp:34
Definition OutputNode.hpp:94
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:307