nCine::RenderCommandPool class

Pool of reusable render commands.

Keeps allocated RenderCommand instances alive between frames so they can be recycled instead of reallocated. Commands move from the free pool to the used pool when handed out, and Reset() returns them all to the free pool at the end of a frame.

Constructors, destructors, conversion operators

RenderCommandPool(std::uint32_t poolSize) explicit
~RenderCommandPool()

Public functions

auto Add() -> RenderCommand*
Adds a new command to the used pool and returns it.
auto Add(GLShaderProgram* shaderProgram) -> RenderCommand*
Adds a new command bound to the specified shader program and returns it.
auto Retrieve(GLShaderProgram* shaderProgram) -> RenderCommand*
Returns an unused command bound to the specified shader program, or nullptr if none is available.
auto RetrieveOrAdd(GLShaderProgram* shaderProgram, bool& commandAdded) -> RenderCommand*
Returns a command bound to the specified shader program, adding a new one if none can be reused.
void Reset()
Releases all used commands back to the free pool.

Function documentation

RenderCommand* nCine::RenderCommandPool::Add()

Adds a new command to the used pool and returns it.

RenderCommand* nCine::RenderCommandPool::Add(GLShaderProgram* shaderProgram)

Adds a new command bound to the specified shader program and returns it.