score::gfx::RenderList Class Reference

List of nodes to be rendered to an output. More...

Detailed Description

List of nodes to be rendered to an output.

This references all the score::gfx::Node that have an effect on a given output, and manages all the matching renderers, as well as a few shared data, such as output-specific UBOs, shared textures and buffers, etc.

The score::gfx::Graph creates one RenderList per OutputNode in the graph.

Public Types

using Buffers = std::pair< const Mesh *const, MeshBuffers >
 

Public Member Functions

 RenderList (OutputNode &output, const std::shared_ptr< RenderState > &state)
 
void init ()
 Initialize data for this renderer.
 
QRhiResourceUpdateBatch * initialBatch () const noexcept
 Initial resource update batch. More...
 
MeshBuffers initMeshBuffer (const Mesh &mesh, QRhiResourceUpdateBatch &res)
 Create buffers for a mesh and mark them for upload. More...
 
void update (QRhiResourceUpdateBatch &res)
 Update / upload this RenderList's shared data.
 
void render (QRhiCommandBuffer &commands, bool force=false)
 Render every node in order.
 
void release ()
 Release GPU resources owned by this render list.
 
void maybeRebuild ()
 Check if the render size has changed in order to rebuild the pipelines.
 
TextureRenderTarget renderTargetForOutput (const Edge &edge) noexcept
 Obtain the texture corresponding to an output port. More...
 
QImage adaptImage (const QImage &in)
 Adapts an image to the GPU limits / format. More...
 
Buffers acquireMesh (const ossia::geometry_spec &, QRhiResourceUpdateBatch &res) noexcept
 
void clearRenderers ()
 Clear the renderers so that they get reinitialized on the next frame.
 
QRhiTexture & emptyTexture () const noexcept
 Texture to use when a texture is missing.
 
QRhiBuffer & outputUBO () const noexcept
 UBO corresponding to the output parameters: More...
 
const score::gfx::MeshdefaultQuad () const noexcept
 A quad mesh correct for this API.
 
const score::gfx::MeshdefaultTriangle () const noexcept
 A triangle mesh correct for this API.
 
int samples () const noexcept
 
bool canRender () const noexcept
 

Public Attributes

OutputNodeoutput
 Output node to which this RenderList is rendering to.
 
RenderStatestate
 RenderState corresponding to this RenderList.
 
std::vector< score::gfx::Node * > nodes
 Nodes present in this RenderList, in order.
 
std::vector< score::gfx::NodeRenderer * > renderers
 Renderers - one per node.
 

Member Function Documentation

◆ adaptImage()

QImage score::gfx::RenderList::adaptImage ( const QImage &  in)

Adapts an image to the GPU limits / format.

e.g. Y direction, texture size limits...

◆ initialBatch()

QRhiResourceUpdateBatch * score::gfx::RenderList::initialBatch ( ) const
noexcept

Initial resource update batch.

See QRhiResourceUpdateBatch::merge for documentation on this

◆ initMeshBuffer()

MeshBuffers score::gfx::RenderList::initMeshBuffer ( const Mesh mesh,
QRhiResourceUpdateBatch &  res 
)

Create buffers for a mesh and mark them for upload.

The meshes used by the nodes are cached (as most are just rendering on a full-screen triangle, which we can reuse).

◆ outputUBO()

QRhiBuffer& score::gfx::RenderList::outputUBO ( ) const
inlinenoexcept

UBO corresponding to the output parameters:

  • Render size
  • Per-API adjustments and globals

◆ renderTargetForOutput()

TextureRenderTarget score::gfx::RenderList::renderTargetForOutput ( const Edge edge)
noexcept

Obtain the texture corresponding to an output port.

This is done by looking for the render target which corresponds to a given port.


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