Skip to main content

PassCommitListener.ixx File

Interface for listeners notified when a pass commits its state. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacegameloop

Central game loop orchestration module. More...

Classes Index

classPassCommitListener

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

Description

Interface for listeners notified when a pass commits its state.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file PassCommitListener.ixx
3 * @brief Interface for listeners notified when a pass commits its state.
4 */
5module;
6
7
8export module helios.engine.runtime.gameloop.PassCommitListener;
9
10import helios.engine.runtime.gameloop.CommitPoint;
11
12import helios.engine.runtime.world.UpdateContext;
13
15
16 /**
17 * @brief Interface for receiving notifications when a pass reaches its commit point.
18 *
19 * @details
20 * The PassCommitListener provides a callback mechanism for responding to pass-level
21 * synchronization events within the game loop. When a Pass has a configured CommitPoint
22 * and finishes execution, registered listeners are notified via `onPassCommit()`.
23 *
24 * This interface is primarily implemented by the GameLoop class to handle:
25 * - **Event buffer swapping:** Making pass-level events readable to subsequent passes.
26 * - **Command flushing:** Executing deferred commands from the CommandBuffer.
27 * - **Manager flushing:** Processing queued requests (e.g., spawn/despawn operations).
28 *
29 * The CommitPoint flags determine which synchronization actions are performed:
30 *
31 * | Flag | Action |
32 * |------|--------|
33 * | `PassEvents` | Swaps pass event bus buffers |
34 * | `FlushCommands` | Executes pending commands |
35 * | `FlushManagers` | Processes manager requests |
36 * | `Structural` | Combines all three flags |
37 *
38 * @par Integration with GameLoop
39 *
40 * The GameLoop implements this interface and registers itself with each Phase.
41 * When a Pass with a commit point completes, the Phase calls `onPassCommit()`,
42 * allowing the GameLoop to perform the appropriate synchronization.
43 *
44 * ```cpp
45 * // In GameLoop::onPassCommit():
46 * if ((commitPoint & CommitPoint::PassEvents) == CommitPoint::PassEvents) {
47 * passEventBus_.swapBuffers();
48 * }
49 * if ((commitPoint & CommitPoint::FlushCommands) == CommitPoint::FlushCommands) {
50 * commandBuffer_.flush(updateContext.gameWorld());
51 * }
52 * if ((commitPoint & CommitPoint::FlushManagers) == CommitPoint::FlushManagers) {
53 * updateContext.gameWorld().flushManagers(updateContext);
54 * }
55 * ```
56 *
57 * @see GameLoop
58 * @see Phase
59 * @see Pass
60 * @see CommitPoint
61 */
63
64
65 public:
66
67 /**
68 * @brief Virtual destructor for proper polymorphic cleanup.
69 */
70 virtual ~PassCommitListener() = default;
71
72 /**
73 * @brief Called when a pass reaches its commit point.
74 *
75 * @details
76 * Implementations should check the CommitPoint flags and perform the
77 * appropriate synchronization actions. The order of operations should be:
78 *
79 * 1 **PassEvents** — Swap event buffers first so subsequent actions can emit events.
80 * 2 **FlushCommands** — Execute commands before managers to generate spawn requests.
81 * 3 **FlushManagers** — Process requests after commands have been executed.
82 *
83 * @param commitPoint The flags specifying which synchronization actions to perform.
84 * @param updateContext The current frame's update context.
85 *
86 * @note This method is marked `noexcept` as it is called during the game loop
87 * hot path and should not throw exceptions.
88 *
89 * @see CommitPoint
90 * @see Pass::addCommitPoint()
91 */
92 virtual void onPassCommit(
93 CommitPoint commitPoint,
94 helios::engine::runtime::world::UpdateContext& updateContext) noexcept = 0;
95 };
96
97
98}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.