Skip to main content

PassCommitListener Class

Interface for receiving notifications when a pass reaches its commit point. More...

Declaration

class helios::engine::runtime::gameloop::PassCommitListener { ... }

Derived Classes

classGameLoop

Central orchestrator for the game update cycle. More...

Public Destructor Index

~PassCommitListener ()=default

Virtual destructor for proper polymorphic cleanup. More...

Public Member Functions Index

voidonPassCommit (CommitPoint commitPoint, helios::engine::runtime::world::UpdateContext &updateContext) noexcept=0

Called when a pass reaches its commit point. More...

Description

Interface for receiving notifications when a pass reaches its commit point.

The PassCommitListener provides a callback mechanism for responding to pass-level synchronization events within the game loop. When a Pass has a configured CommitPoint and finishes execution, registered listeners are notified via `onPassCommit()`.

This interface is primarily implemented by the GameLoop class to handle:

  • **Event buffer swapping:** Making pass-level events readable to subsequent passes.
  • **Command flushing:** Executing deferred commands from the CommandBuffer.
  • **Manager flushing:** Processing queued requests (e.g., spawn/despawn operations).

The CommitPoint flags determine which synchronization actions are performed:

| Flag | Action | |------|--------| | `PassEvents` | Swaps pass event bus buffers | | `FlushCommands` | Executes pending commands | | `FlushManagers` | Processes manager requests | | `Structural` | Combines all three flags |

Integration with GameLoop

The GameLoop implements this interface and registers itself with each Phase. When a Pass with a commit point completes, the Phase calls `onPassCommit()`, allowing the GameLoop to perform the appropriate synchronization.

```cpp // In GameLoop::onPassCommit(): if ((commitPoint & CommitPoint::PassEvents) == CommitPoint::PassEvents) { passEventBus_.swapBuffers(); } if ((commitPoint & CommitPoint::FlushCommands) == CommitPoint::FlushCommands) { commandBuffer_.flush(updateContext.gameWorld()); } if ((commitPoint & CommitPoint::FlushManagers) == CommitPoint::FlushManagers) { updateContext.gameWorld().flushManagers(updateContext); } ```

See Also

GameLoop

See Also

Phase

See Also

Pass

See Also

CommitPoint

Definition at line 62 of file PassCommitListener.ixx.

Public Destructor

~PassCommitListener()

virtual helios::engine::runtime::gameloop::PassCommitListener::~PassCommitListener ()
virtual default

Virtual destructor for proper polymorphic cleanup.

Definition at line 70 of file PassCommitListener.ixx.

Public Member Functions

onPassCommit()

virtual void helios::engine::runtime::gameloop::PassCommitListener::onPassCommit (CommitPoint commitPoint, helios::engine::runtime::world::UpdateContext & updateContext)
noexcept

Called when a pass reaches its commit point.

Implementations should check the CommitPoint flags and perform the appropriate synchronization actions. The order of operations should be:

1. **PassEvents** — Swap event buffers first so subsequent actions can emit events. 2. **FlushCommands** — Execute commands before managers to generate spawn requests. 3. **FlushManagers** — Process requests after commands have been executed.

Parameters
commitPoint

The flags specifying which synchronization actions to perform.

updateContext

The current frame's update context.

info

This method is marked `noexcept` as it is called during the game loop hot path and should not throw exceptions.

See Also

CommitPoint

See Also

Pass::addCommitPoint()

Definition at line 92 of file PassCommitListener.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.