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

#include <PerDrawBlocks.hpp>

Classes

struct  Range
 Where one draw's block was staged; a default one binds the zero block. More...

Public Member Functions

void init (GfxDevice &device, u32 blockSize)
 Claims the pool for blocks of blockSize bytes, plus the zero one.
void shutdown ()
 Releases every page and the zero block while the device is alive.
void beginFrame ()
 Hands every range back. Called once per FRAME — see the file note.
Range stage (const void *bytes, u32 size)
 Copies size bytes of bytes into a range of this frame's, to reach the GPU at the next upload(); a block it cannot hold stages nothing.
void upload ()
 Sends what was staged since the last upload, one write per page.
void bind (u32 slot, Range range) const
 Binds range to slot — the zero block for a range staging refused.
void bindZero (u32 slot) const
 Binds what a draw with nothing to say reads: zeroed once and never written, so "none" is an object rather than an erasure.
u32 used () const
 Ranges this frame has handed out — a per-frame cost, for the profile.

Detailed Description

Definition at line 29 of file PerDrawBlocks.hpp.

Member Function Documentation

◆ beginFrame()

void esengine::PerDrawBlocks::beginFrame ( )
inline

Hands every range back. Called once per FRAME — see the file note.

Definition at line 67 of file PerDrawBlocks.hpp.

◆ bind()

void esengine::PerDrawBlocks::bind ( u32 slot,
Range range ) const
inline

Binds range to slot — the zero block for a range staging refused.

Definition at line 117 of file PerDrawBlocks.hpp.

References bindZero(), esengine::PerDrawBlocks::Range::offset, and esengine::PerDrawBlocks::Range::page.

Referenced by esengine::DrawList::execute().

◆ bindZero()

void esengine::PerDrawBlocks::bindZero ( u32 slot) const
inline

Binds what a draw with nothing to say reads: zeroed once and never written, so "none" is an object rather than an erasure.

Definition at line 128 of file PerDrawBlocks.hpp.

Referenced by bind().

◆ init()

void esengine::PerDrawBlocks::init ( GfxDevice & device,
u32 blockSize )
inline

Claims the pool for blocks of blockSize bytes, plus the zero one.

Definition at line 38 of file PerDrawBlocks.hpp.

References esengine::GfxDevice::createBuffer(), esengine::GfxContent::retained(), shutdown(), and esengine::Uniform.

◆ shutdown()

void esengine::PerDrawBlocks::shutdown ( )
inline

Releases every page and the zero block while the device is alive.

Definition at line 53 of file PerDrawBlocks.hpp.

References esengine::Invalid.

Referenced by init().

◆ stage()

Range esengine::PerDrawBlocks::stage ( const void * bytes,
u32 size )
inline

Copies size bytes of bytes into a range of this frame's, to reach the GPU at the next upload(); a block it cannot hold stages nothing.

The next range starts after the bytes staged: a draw reads only what it was given, so the rest of its binding may be the next draw's. Grows rather than wraps, which would share a range.

Definition at line 81 of file PerDrawBlocks.hpp.

References esengine::GfxContent::transient(), and esengine::Uniform.

◆ upload()

void esengine::PerDrawBlocks::upload ( )
inline

Sends what was staged since the last upload, one write per page.

Definition at line 106 of file PerDrawBlocks.hpp.

◆ used()

u32 esengine::PerDrawBlocks::used ( ) const
inline

Ranges this frame has handed out — a per-frame cost, for the profile.

Definition at line 133 of file PerDrawBlocks.hpp.


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