2#include <Gfx/Graph/CommonUBOs.hpp>
3#include <Gfx/Graph/GpuTiming.hpp>
4#include <Gfx/Graph/Node.hpp>
6#include <ossia/detail/hash_map.hpp>
17class GpuResourceRegistry;
19class VertexFallbackPool;
33 QRhiCommandBuffer* m_currentCommands{};
34 std::shared_ptr<RenderState> m_state;
50 [[nodiscard]] QRhiResourceUpdateBatch* initialBatch()
const noexcept;
58 void setInitialBatch(QRhiResourceUpdateBatch* batch)
noexcept { m_initialBatch = batch; }
69 void flushInitialBatch();
77 MeshBuffers initMeshBuffer(
const Mesh& mesh, QRhiResourceUpdateBatch& res);
82 void update(QRhiResourceUpdateBatch& res);
87 void render(QRhiCommandBuffer& commands,
bool force =
false);
94 return m_currentCommands;
102 void releaseBuffer(QRhiBuffer* buf);
107 bool maybeRebuild(
bool force =
false);
134 bool resizeSwapchainSizedTargets(QSize newOutputSize, QSize newRenderSize);
159 QImage adaptImage(
const QImage& in);
171 using Buffers = std::pair<const Mesh* const, MeshBuffers>;
173 const ossia::geometry_spec&, QRhiResourceUpdateBatch& res,
const Mesh* current,
179 std::vector<score::gfx::Node*>
nodes;
187 void clearRenderers();
215 QRhiBuffer&
outputUBO() const noexcept {
return *m_outputUBO; }
255 const GpuTimings& gpuTimings() const noexcept {
return m_gpuTimings; }
275 const
score::gfx::Mesh& defaultTriangle() const noexcept;
282 bool requiresDepth(const
score::gfx::Port& p) const noexcept;
283 bool anyNodeRequiresDepth() const noexcept {
return m_requiresDepth; }
285 int samples() const noexcept {
return m_samples; }
287 bool canRender() const noexcept {
return m_ready; }
289 QSize renderSize(
const Edge* e)
const noexcept;
292 float currentDate[4]{};
294 void createAllInputRenderTargets();
303 void markBuilt() noexcept { m_built =
true; m_lastSize = state.renderSize; }
315 [[nodiscard]]
bool isBuilt() const noexcept {
return m_built; }
331 onEdgeRemoved(
Edge& edge,
const ossia::hash_set<const Port*>* preserveSinks =
nullptr);
334 void removeInputRenderTarget(
const Port* port);
343 QSize resolveDownstreamSize(
345 const ossia::small_flat_map<const Port*, RenderTargetSpecs, 16>& resolvedSpecs)
352 QRhiResourceUpdateBatch* m_initialBatch{};
364 GpuResourceRegistry* m_registry{};
369 std::unique_ptr<VertexFallbackPool> m_vertexFallbackPool;
373 GpuTimings m_gpuTimings;
380 QRhiBuffer* m_outputUBO{};
381 QRhiTexture* m_emptyTexture{};
382 QRhiTexture* m_emptyTexture3D{};
383 QRhiTexture* m_emptyTextureCube{};
384 QRhiTexture* m_emptyTextureArray{};
389 ossia::flat_map<Mesh*, MeshBuffers> m_vertexBuffers;
391 ossia::flat_map<ossia::geometry_spec, Mesh*> m_customMeshCache;
399 ossia::small_flat_map<const Port*, TextureRenderTarget, 8> m_inputRenderTargets;
410 bool m_requiresDepth{};
422SCORE_PLUGIN_GFX_EXPORT
431SCORE_PLUGIN_GFX_EXPORT
Cross-RenderList content-hash dedup for decoded asset bytes.
Definition AssetTable.hpp:71
Per-RenderList arena store for GPU-resident scene data.
Definition GpuResourceRegistry.hpp:44
Named-bucket GPU timing collector.
Definition GpuTiming.hpp:38
Root data model for visual nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:74
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:54
List of nodes to be rendered to an output.
Definition RenderList.hpp:30
GpuResourceRegistry & registry() noexcept
Per-output GPU arena store for scene-graph source nodes.
Definition RenderList.hpp:235
void markBuilt() noexcept
Mark this render list as fully built.
Definition RenderList.hpp:303
VertexFallbackPool & vertexFallbackPool() noexcept
Per-RenderList pool of neutral fallback vertex buffers for "REQUIRED: false" VERTEX_INPUTS whose upst...
Definition RenderList.hpp:245
void setInitialBatch(QRhiResourceUpdateBatch *batch) noexcept
Store a resource update batch to be submitted on the next render frame.
Definition RenderList.hpp:58
bool isBuilt() const noexcept
Is this render list currently coherent with its output's GPU objects?
Definition RenderList.hpp:315
QRhiBuffer & outputUBO() const noexcept
UBO corresponding to the output parameters:
Definition RenderList.hpp:215
void markRequiresDepth(bool value) noexcept
Definition RenderList.hpp:321
QRhiTexture & emptyTexture3D() const noexcept
Texture to use when a 3D (sampler3D) texture is missing.
Definition RenderList.hpp:197
QRhiTexture & emptyTextureCube() const noexcept
Texture to use when a cubemap (samplerCube) is missing.
Definition RenderList.hpp:202
std::vector< score::gfx::NodeRenderer * > renderers
Renderers - one per node.
Definition RenderList.hpp:184
QRhiTexture & emptyTextureArray() const noexcept
Texture to use when a 2D array (sampler2DArray) is missing.
Definition RenderList.hpp:207
Gfx::AssetTable * assetTable() const noexcept
Session-wide asset decode cache.
Definition RenderList.hpp:264
QRhiCommandBuffer * currentCommandBuffer() const noexcept
Definition RenderList.hpp:92
std::vector< score::gfx::Node * > nodes
Nodes present in this RenderList, in order.
Definition RenderList.hpp:179
RenderState & state
RenderState corresponding to this RenderList.
Definition RenderList.hpp:169
QRhiTexture & emptyTexture() const noexcept
Texture to use when a texture is missing (2D)
Definition RenderList.hpp:192
OutputNode & output
Output node to which this RenderList is rendering to.
Definition RenderList.hpp:164
GpuTimings & gpuTimings() noexcept
Per-RenderList GPU-timing collector.
Definition RenderList.hpp:254
Definition VertexFallbackPool.hpp:43
Binds the rendering pipeline to ossia processes.
Definition AssetTable.cpp:7
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
QRhiTexture::Format imageTextureFormat(const QRhi &rhi) noexcept
Texture format to use for images uploaded from the CPU.
Definition RenderList.cpp:671
QImage adaptImageFormat(QImage img, QRhiTexture::Format fmt)
Put an image in the byte order imageTextureFormat() asks for.
Definition RenderList.cpp:677
Base toolkit upon which the software is built.
Definition Application.cpp:116
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:103
Represents a graph of renderers.
Definition score-plugin-gfx/Gfx/Graph/Graph.hpp:22
Data model for meshes.
Definition Mesh.hpp:179
UBO shared across all entities shown on the same output.
Definition CommonUBOs.hpp:82
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:82
Global state associated to a rendering context.
Definition RenderState.hpp:37
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:152