CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RenderGraph2::RenderGraph Class Reference

Represents a graph type that can be used for describring the whole rendering process in the engine. More...

#include <CeresEngine/Renderer/RenderGraph2/RenderGraph.hpp>

Inheritance diagram for CeresEngine::RenderGraph2::RenderGraph:
CeresEngine::Graph CeresEngine::RefCounted< Graph >

Public Member Functions

 RenderGraph ()=default
 Creates a new RenderGraph instance.
 
 ~RenderGraph () noexcept override=default
 Destroys RenderGraph instance.
 
const Vector< RenderGraphResourcePtr > & getResources () const noexcept
 A list of resources managed by the graph.
 
RenderGraphImageaddImage (const RenderGraphImageDescriptor &descriptor, StringView name="")
 Adds a new image render resource.
 
RenderGraphBufferaddBuffer (const RenderGraphBufferDescriptor &descriptor, StringView name="")
 Adds a new buffer render resource.
 
void removeResource (RenderGraphResource &resource)
 Removes a resource from the render graph.
 
SPtr< RenderGraphProgramcompile (GraphSocket &output) const
 Compiles the graph into a sequence of commands that is suitable for submitting commands to the GPU.
 
- Public Member Functions inherited from CeresEngine::Graph
 Graph ()=default
 
virtual ~Graph () noexcept=default
 
GraphNodegetNode (StringView name) const
 
const Vector< GraphNodePtr > & getNodes () const noexcept
 
void addNode (GraphNode &node)
 
template<typename T , typename... Args>
requires (std::is_base_of_v<GraphNode, T>)
TaddNode (Args &&... args)
 
void removeNode (GraphNode &node)
 
GraphConnectionconnect (GraphSocket &outputSocket, GraphSocket &inputSocket)
 
GraphInstancePtr instantiate ()
 
- Public Member Functions inherited from CeresEngine::RefCounted< Graph >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Private Attributes

Vector< RenderGraphResourcePtrmResources
 A list of resources managed by the graph.
 

Additional Inherited Members

- Public Attributes inherited from CeresEngine::Graph
Event< void()> onChange
 
Event< void(GraphNode &)> onNodeAdded
 
Event< void(GraphNode &)> onNodeRemoved
 

Detailed Description

Represents a graph type that can be used for describring the whole rendering process in the engine.

Nodes can be added, removed or changed to customize rendering behavior and effects.

When certain rendering features are disabled, the graph can optimize itself and disable any remaining dangling nodes whose output is not required for the current configuration.

Constructor & Destructor Documentation

◆ RenderGraph()

CeresEngine::RenderGraph2::RenderGraph::RenderGraph ( )
explicitdefault

Creates a new RenderGraph instance.

◆ ~RenderGraph()

CeresEngine::RenderGraph2::RenderGraph::~RenderGraph ( )
overridedefaultnoexcept

Destroys RenderGraph instance.

Member Function Documentation

◆ addBuffer()

RenderGraphBuffer & CeresEngine::RenderGraph2::RenderGraph::addBuffer ( const RenderGraphBufferDescriptor descriptor,
StringView  name = "" 
)

Adds a new buffer render resource.

Parameters
descriptorA structure that describes the buffer to be created.
nameAn optional string that includes a human readable name for the resource.

◆ addImage()

RenderGraphImage & CeresEngine::RenderGraph2::RenderGraph::addImage ( const RenderGraphImageDescriptor descriptor,
StringView  name = "" 
)

Adds a new image render resource.

Parameters
descriptorA structure that describes the image to be created.
nameAn optional string that includes a human readable name for the resource.

◆ compile()

SPtr< RenderGraphProgram > CeresEngine::RenderGraph2::RenderGraph::compile ( GraphSocket output) const

Compiles the graph into a sequence of commands that is suitable for submitting commands to the GPU.

At this stage, a several actions are performed. The graph is first validated to ensure that it doesn't contain cycles or has all required inputs connected. Next, it orders the execution of each render task such as that all it's inputs are rendered before it and appropriately handles memory barriers for such resources.

After that, a the implementation can perform other optimizations such as merging multiple render passes into one or alising of resource memory.

The baked render graph returned by this method can be used and re-used to perform rendering on the GPU. It can be re-utilized for as long as the originating render graph doesn't change. Any changes to the render graph will require a new compilation of it before executing.

Returns
An object that contains the baked representation of the graph.

◆ getResources()

const Vector< RenderGraphResourcePtr > & CeresEngine::RenderGraph2::RenderGraph::getResources ( ) const
inlinenoexcept

A list of resources managed by the graph.

◆ removeResource()

void CeresEngine::RenderGraph2::RenderGraph::removeResource ( RenderGraphResource resource)

Removes a resource from the render graph.

A resource can only be removed if it is no longer referenced by any task.

Parameters
resourceThe resource to be removed.

Member Data Documentation

◆ mResources

Vector<RenderGraphResourcePtr> CeresEngine::RenderGraph2::RenderGraph::mResources
private

A list of resources managed by the graph.


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