Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
TargetPool.hpp File Reference

The render targets a frame borrows from, keyed by shape — owned by the frame, not by any one graph that draws from it. More...

#include "../../core/Types.hpp"
#include "../rhi/Framebuffer.hpp"
#include "../rhi/GfxEnums.hpp"
#include <vector>
Include dependency graph for TargetPool.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::rg::TargetShape
class  esengine::rg::TargetPool

Namespaces

namespace  esengine
namespace  esengine::rg

Typedefs

using esengine::rg::TargetHandle = u32
 A borrowed target: a slot index, and the generation of what is in it.

Variables

constexpr TargetHandle esengine::rg::kNoTarget = static_cast<TargetHandle>(-1)

Detailed Description

The render targets a frame borrows from, keyed by shape — owned by the frame, not by any one graph that draws from it.

A RenderGraph is a CHAIN, and a frame holds several of them: one per camera and one for the screen-level stack. While the pool lived inside the graph, every begin() handed every target back, so nothing could be borrowed across two chains — which is why the shadow atlas had to be a framebuffer of its own, created on the first shadowed frame and held for the rest of the run.

Splitting it out makes the lifetime the borrower's to state: a chain's transient goes back at its last read, the atlas goes back at the end of the frame, and both come out of the same physical targets on the next one.

Handles carry a generation. A slot outlives the target in it — evicting frees the memory and leaves the slot to be refilled — so an index alone would let a handle taken before an eviction name whatever landed in that slot afterwards, and a frame holding the atlas across a window resize would draw its shadows into a post-process target. The generation makes a stale handle name nothing.

Definition in file TargetPool.hpp.