RenderPipeline

Render pipeline interface.

Overview

Typical use cases:

  • Providing an interface for render pipeline implementations

Header

<RaeptorCogs/GAPI/Common/Core/Internal/RenderPipeline.hpp>

Metadata

Author

Estorc

Version

v1.0

Copyright

Copyright (c) 2025 Estorc MIT License.

Types

Type Definitions

Type

Description

RaeptorCogs::GAPI::Common::ComponentBuffer

Component buffer type.

using RaeptorCogs::GAPI::Common::ComponentBuffer = std::vector<Component*>

Component buffer type.

Holds pointers to components used in rendering.

Enums

Enumerations

Enum

Description

RaeptorCogs::GAPI::Common::PrivateRenderListID

Private render list identifiers.

enum class RaeptorCogs::GAPI::Common::PrivateRenderListID : int

Private render list identifiers.

Defines reserved identifiers for internal render lists.

Values:

enumerator DRAW

Reserved for internal draw calls

Classes

Classes

Class

Description

RaeptorCogs::GAPI::Common::RenderPipeline

Render pipeline interface.

class RenderPipeline

Render pipeline interface.

Provides an interface for render pipeline implementations.

Subclassed by RaeptorCogs::GAPI::GL::RenderPipeline, RaeptorCogs::GAPI::Vulkan::RenderPipeline

Public Functions

inline RenderPipeline(RendererBackend &renderer)

Constructor.

Parameters:

renderer – Reference to the renderer backend singleton.

virtual ~RenderPipeline() = default

Virtual destructor.

bool compatibleBatches(GraphicBatchHandler *a, GraphicBatchHandler *b)

Check if two batches are compatible for merging.

Note

Batches are compatible if they share the same rendering parameters.

Parameters:
Returns:

True if the batches are compatible, false otherwise.

void beginBatch(int x, int y, int width, int height, ObjectHandler<Shader> &shader)

Begin a new batch for rendering.

Note

Sets up the rendering state for the new batch.

Parameters:
  • x – X coordinate of the batch viewport.

  • y – Y coordinate of the batch viewport.

  • width – Width of the batch viewport.

  • height – Height of the batch viewport.

  • shaderShader to be used for the batch.

void processBatch(std::function<void()> postDrawCallback = nullptr)

Process the current batch for rendering.

RaeptorCogs::Renderer().processBatch([]() {
   // Custom operations after drawing
});

Note

Uploads instance data and issues draw calls for the batch.

Parameters:

postDrawCallback – Optional callback to be executed after drawing.

void drawBatch(GraphicBatchHandler *firstHandler, size_t instanceOffset, size_t instanceCount, std::function<void()> postDrawCallback = nullptr)

Draw a batch of instances.

Note

Issues the draw call for the specified batch of instances.

Parameters:
  • firstHandler – Pointer to the first GraphicBatchHandler in the batch.

  • instanceOffset – Offset of the first instance to draw.

  • instanceCount – Number of instances to draw.

  • postDrawCallback – Optional callback to be executed after drawing.

void flushBatch()

Flush the current batch.

Completes the current batch and prepares for the next one.

void setRenderListID(int index)

See also

Renderer::setRenderListID

RenderList &getRenderList()

Get the current render list.

Returns:

Reference to the current render list.

RenderList &getMaskRenderList()

Get the mask render list of the current render list.

Returns:

Reference to the mask render list.

void clearRenderLists()

Clear the render lists.

Note

Removes all graphics from all render lists.

Warning

Use with caution as this will clear all pending graphics to be rendered.

inline ComponentBuffer &getComponentBuffer()

Get the component buffer.

Returns:

Reference to the component buffer.

GraphicBatchHandler &getBatchHandlerAt(size_t index)

Get the batch handler at the specified index.

Note

Used for accessing batch handlers directly.

Parameters:

index – Index of the batch handler.

Returns:

Reference to the GraphicBatchHandler.

inline FrameData &getFrameData()

Get the frame data.

Returns:

Reference to the FrameData structure.

Protected Functions

inline RendererBackend &getRenderer() const

Get the renderer pointer.

Returns:

Pointer to the renderer backend singleton.

inline RenderListBuffer &getRenderLists()

Get the render lists.

Returns:

Reference to the render list buffer.

void useMaskRenderList()

Use the mask render list.

Sets the current render list to the mask render list.

void useNormalRenderList()

Use the normal render list.

Sets the current render list to the normal render list.

Private Functions

virtual void beginFrame() = 0

Begin frame operations.

Called at the start of each frame.

virtual void endFrame() = 0

End frame operations.

Called at the end of each frame.

Private Members

RendererBackend &renderer

Reference to the renderer backend.

Holds a reference to the renderer backend singleton.

BatchBuffer batch

Batch buffer.

Holds batch handlers for rendering.

ComponentBuffer componentBuffer

Component buffer.

Holds component data for rendering.

RenderListBuffer renderLists

Render list buffer.

Holds render lists indexed by their IDs.

FrameData frameData

Frame data.

Holds data relevant to the current frame.

int currentBatchIndex = 0

Current batch index.

Indicates the active batch for rendering.

Friends

friend void MainLoop(const std::function<void(Window&)> updateFunction, Window &window)