Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::rg::RenderGraph Class Reference

#include <RenderGraph.hpp>

Public Member Functions

 RenderGraph (GfxDevice &device, TargetPool &pool)
 RenderGraph (GfxDevice &device)
 ~RenderGraph ()
 RenderGraph (const RenderGraph &)=delete
RenderGraph & operator= (const RenderGraph &)=delete
void begin (u32 refWidth, u32 refHeight)
ResourceId importTexture (TextureHandle texture, u32 width, u32 height)
ResourceId importTarget (FramebufferHandle target, u32 width, u32 height, bool output=true, TextureHandle readable=TextureHandle::Invalid)
 The framebuffer the graph must end in (the screen, an editor FBO).
ResourceId createTarget (const TargetDesc &desc)
ResourceId createExternalTarget (const TargetDesc &desc)
 A pooled target filled by a producer OUTSIDE any pass callback.
FramebufferHandle framebufferOf (ResourceId id) const
void addPass (PassDesc pass)
void execute ()
void setPassTimer (PassTimer *timer)
TextureHandle textureOf (ResourceId id) const
TextureHandle depthTextureOf (ResourceId id) const
TextureHandle gbufferTextureOf (ResourceId id) const
TextureHandle albedoTextureOf (ResourceId id) const
 The third attachment of a gbuffer target: the surface's diffuse colour (alpha 1 where one was written).
void releasePool ()
TargetPool & pool ()
u32 pooledTargetCount () const
u64 pooledTargetBytes () const
u32 lastExecutedPassCount () const

Detailed Description

Definition at line 240 of file RenderGraph.hpp.

Constructor & Destructor Documentation

◆ RenderGraph() [1/3]

esengine::rg::RenderGraph::RenderGraph ( GfxDevice & device,
TargetPool & pool )

Borrows the caller's pool: a frame's chains share one.

Definition at line 16 of file RenderGraph.cpp.

References pool().

Referenced by RenderGraph(), and operator=().

◆ RenderGraph() [2/3]

esengine::rg::RenderGraph::RenderGraph ( GfxDevice & device)
explicit

Owns a pool of its own — for a lone chain and for tests.

Definition at line 19 of file RenderGraph.cpp.

References esengine::makeUnique().

◆ ~RenderGraph()

esengine::rg::RenderGraph::~RenderGraph ( )
default

◆ RenderGraph() [3/3]

esengine::rg::RenderGraph::RenderGraph ( const RenderGraph & )
delete

References RenderGraph().

Member Function Documentation

◆ addPass()

void esengine::rg::RenderGraph::addPass ( PassDesc pass)

Definition at line 224 of file RenderGraph.cpp.

Referenced by esengine::DynamicGI::declare(), and esengine::VoxelGI::declare().

◆ albedoTextureOf()

TextureHandle esengine::rg::RenderGraph::albedoTextureOf ( ResourceId id) const

The third attachment of a gbuffer target: the surface's diffuse colour (alpha 1 where one was written).

Definition at line 464 of file RenderGraph.cpp.

References esengine::Invalid, and esengine::rg::kNoTarget.

Referenced by esengine::DynamicGI::declare(), and esengine::VoxelGI::declare().

◆ begin()

void esengine::rg::RenderGraph::begin ( u32 refWidth,
u32 refHeight )

Starts a new graph. refWidth/refHeight are what scale is a fraction of.

Definition at line 152 of file RenderGraph.cpp.

References esengine::rg::kNoResource.

◆ createExternalTarget()

ResourceId esengine::rg::RenderGraph::createExternalTarget ( const TargetDesc & desc)

A pooled target filled by a producer OUTSIDE any pass callback.

The scene cannot be written from inside execute(): a frame reaches the host as several calls with the geometry drawn between them, so its target has to exist first. Pooled and recycled at its last read like any transient — the exception is WHEN it is filled, not who owns it.

Definition at line 207 of file RenderGraph.cpp.

References createTarget(), esengine::rg::kNoResource, and esengine::rg::kNoTarget.

◆ createTarget()

ResourceId esengine::rg::RenderGraph::createTarget ( const TargetDesc & desc)

A target the graph allocates from the pool and recycles after its last read.

Definition at line 198 of file RenderGraph.cpp.

Referenced by createExternalTarget(), esengine::DynamicGI::declare(), and esengine::VoxelGI::declare().

◆ depthTextureOf()

TextureHandle esengine::rg::RenderGraph::depthTextureOf ( ResourceId id) const

Its depth attachment, for a resource declared with one. Invalid for an import (the graph did not make it) and for a target without depth.

Definition at line 450 of file RenderGraph.cpp.

References esengine::Invalid, and esengine::rg::kNoTarget.

Referenced by esengine::DynamicGI::declare(), and esengine::VoxelGI::declare().

◆ execute()

◆ framebufferOf()

FramebufferHandle esengine::rg::RenderGraph::framebufferOf ( ResourceId id) const

The framebuffer behind a resource, for an external target to be drawn into.

Definition at line 216 of file RenderGraph.cpp.

References esengine::Default, and esengine::rg::kNoTarget.

◆ gbufferTextureOf()

TextureHandle esengine::rg::RenderGraph::gbufferTextureOf ( ResourceId id) const

Its second colour attachment, for a resource declared with one. Invalid otherwise.

Definition at line 457 of file RenderGraph.cpp.

References esengine::Invalid, and esengine::rg::kNoTarget.

Referenced by esengine::DynamicGI::declare(), and esengine::VoxelGI::declare().

◆ importTarget()

ResourceId esengine::rg::RenderGraph::importTarget ( FramebufferHandle target,
u32 width,
u32 height,
bool output = true,
TextureHandle readable = TextureHandle::Invalid )

The framebuffer the graph must end in (the screen, an editor FBO).

Also what culling works back from: a pass no path reaches from here did not contribute to the image and is dropped. Set output false for a persistent intermediate capture: importing it must not move the final output away from the scene or its post stack. readable is the colour texture behind target, so a later pass can read what this one wrote — a history buffer is imported to be written and then sampled, by the next pass and by the next frame.

Definition at line 184 of file RenderGraph.cpp.

◆ importTexture()

ResourceId esengine::rg::RenderGraph::importTexture ( TextureHandle texture,
u32 width,
u32 height )

A texture the graph reads but does not own — the scene capture.

Definition at line 174 of file RenderGraph.cpp.

◆ lastExecutedPassCount()

u32 esengine::rg::RenderGraph::lastExecutedPassCount ( ) const
inline

Passes the last execute() ran, after culling. Diagnostics and tests.

Definition at line 324 of file RenderGraph.hpp.

◆ operator=()

RenderGraph & esengine::rg::RenderGraph::operator= ( const RenderGraph & )
delete

References RenderGraph(), and esengine::Invalid.

◆ pool()

TargetPool & esengine::rg::RenderGraph::pool ( )
inline

The targets this graph draws from — shared with the frame's other chains when one was given, its own otherwise.

Definition at line 314 of file RenderGraph.hpp.

Referenced by RenderGraph().

◆ pooledTargetBytes()

u64 esengine::rg::RenderGraph::pooledTargetBytes ( ) const
inline

What those targets cost in GPU memory, so the number a budget reads is bytes rather than a count of things with no common size.

Definition at line 321 of file RenderGraph.hpp.

◆ pooledTargetCount()

u32 esengine::rg::RenderGraph::pooledTargetCount ( ) const
inline

How many physical targets the pool is holding. Diagnostics and tests.

Definition at line 317 of file RenderGraph.hpp.

◆ releasePool()

void esengine::rg::RenderGraph::releasePool ( )

Drops every pooled target. For shutdown and for device loss, after which the handles the pool holds name nothing.

Definition at line 471 of file RenderGraph.cpp.

References esengine::Invalid, and esengine::rg::kNoTarget.

◆ setPassTimer()

void esengine::rg::RenderGraph::setPassTimer ( PassTimer * timer)
inline

Times each pass of the next execute()s into timer; null stops. Borrowed.

Definition at line 293 of file RenderGraph.hpp.

◆ textureOf()

TextureHandle esengine::rg::RenderGraph::textureOf ( ResourceId id) const

The texture behind a resource — valid for imports, and for a transient only while it holds a physical target.

Definition at line 445 of file RenderGraph.cpp.

References esengine::Invalid.

Referenced by execute().


The documentation for this class was generated from the following files:
  • /home/runner/work/estella/estella/src/esengine/renderer/graph/RenderGraph.hpp
  • /home/runner/work/estella/estella/src/esengine/renderer/graph/RenderGraph.cpp