Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
system_schedule_scratch.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include <cstdint>
5
6#include "gaia/cnt/darray.h"
7#include "gaia/core/utility.h"
8#include "gaia/ecs/id.h"
9#include "gaia/ecs/sched.h"
10
11namespace gaia {
12 namespace ecs {
13 class World;
14
15 namespace detail {
19 Entity entity = EntityBad;
22
23 PendingSystemJob() = default;
27 PendingSystemJob(Entity systemEntity, SchedJob&& systemJob): entity(systemEntity), job(GAIA_MOV(systemJob)) {}
28 };
29
33 Entity entity = EntityBad;
35 Entity phase = EntityBad;
37 uint32_t phaseDepth = 0;
39 uint32_t systemDepth = 0;
41 uint32_t phaseOrder = 0;
43 uint32_t systemOrder = 0;
45 bool hasPhase = false;
46 };
47
51 Entity phase = EntityBad;
53 uint32_t depth = 0;
55 uint32_t order = 0;
56 };
57
61 uint32_t child = 0;
63 uint32_t target = 0;
65 uint32_t next = UINT32_MAX;
66 };
67
109
117
131 } // namespace detail
132 } // namespace ecs
133} // namespace gaia
Array with variable size of elements of type.
Definition darray_impl.h:27
Move-only wrapper for scheduler-owned ECS work.
Definition sched.h:118
Owns entities, components, archetypes, queries, observers, and systems.
Definition world.h:80
Identifier of an entity or component instance in the world. Packs the entity index,...
Definition id.h:296
Pending scheduler-backed system job owned by World::systems_run().
Definition system_schedule_scratch.h:17
SchedJob job
Deferred system work.
Definition system_schedule_scratch.h:21
PendingSystemJob(Entity systemEntity, SchedJob &&systemJob)
Creates a pending entry for systemEntity.
Definition system_schedule_scratch.h:27
Entity entity
System entity that created job.
Definition system_schedule_scratch.h:19
Context used while collecting system scheduling keys.
Definition system_schedule_scratch.h:111
cnt::darray< SystemScheduleItem > * pItems
Output array receiving scheduling keys.
Definition system_schedule_scratch.h:115
World * pWorld
World that owns collected systems.
Definition system_schedule_scratch.h:113
Scheduling key for one explicit phase entity.
Definition system_schedule_scratch.h:49
Entity phase
Phase entity.
Definition system_schedule_scratch.h:51
uint32_t depth
Depth of phase in the phase DependsOn graph.
Definition system_schedule_scratch.h:53
uint32_t order
Deterministic child-before-target order of phase.
Definition system_schedule_scratch.h:55
Context used by the erased system run callback.
Definition system_schedule_scratch.h:119
bool hasCurrent
True once current has been initialized.
Definition system_schedule_scratch.h:127
cnt::darray< PendingSystemJob > * pPending
Pending scheduler jobs in the current phase/system-dependency batch.
Definition system_schedule_scratch.h:123
bool canScheduleSystems
True when the active scheduler can prepare dependency-ready jobs.
Definition system_schedule_scratch.h:129
SystemScheduleItem current
Current scheduling batch key.
Definition system_schedule_scratch.h:125
World * pWorld
World that owns collected systems.
Definition system_schedule_scratch.h:121
Direct child-before-target scheduling edge between collected systems.
Definition system_schedule_scratch.h:59
uint32_t child
Item index that must run first.
Definition system_schedule_scratch.h:61
uint32_t next
Next edge index in the same child adjacency list.
Definition system_schedule_scratch.h:65
uint32_t target
Item index that must run after child.
Definition system_schedule_scratch.h:63
Scheduling key for one enabled system entity.
Definition system_schedule_scratch.h:31
uint32_t systemDepth
Depth of the system in the DependsOn graph, excluding the phase marker target.
Definition system_schedule_scratch.h:39
uint32_t systemOrder
Deterministic child-before-target order of entity inside its scheduling group.
Definition system_schedule_scratch.h:43
Entity entity
System entity to run.
Definition system_schedule_scratch.h:33
uint32_t phaseDepth
Depth of phase in the phase DependsOn graph.
Definition system_schedule_scratch.h:37
uint32_t phaseOrder
Deterministic child-before-target order of phase.
Definition system_schedule_scratch.h:41
bool hasPhase
True when phase is valid.
Definition system_schedule_scratch.h:45
Entity phase
Phase entity assigned with SystemBuilder::phase(), or EntityBad for unphased systems.
Definition system_schedule_scratch.h:35
Reusable scratch arrays for one system schedule ordering pass.
Definition system_schedule_scratch.h:69
cnt::darray< uint32_t > sortedPhases
Phase indices sorted by entity id.
Definition system_schedule_scratch.h:91
cnt::darray< uint32_t > nextSiblings
Next sibling index per child item.
Definition system_schedule_scratch.h:89
cnt::darray< SystemScheduleItem > items
Collected systems for the current run.
Definition system_schedule_scratch.h:71
cnt::darray< uint32_t > primaryTargets
Primary dependency target per item.
Definition system_schedule_scratch.h:85
cnt::darray< uint32_t > readyNext
Next item in the ready list.
Definition system_schedule_scratch.h:103
cnt::darray< uint32_t > childCounts
Direct child count per target item.
Definition system_schedule_scratch.h:97
cnt::darray< uint32_t > groupIndices
Reused group item indices.
Definition system_schedule_scratch.h:95
cnt::darray< Entity > entityStack
Shared entity traversal stack.
Definition system_schedule_scratch.h:79
cnt::darray< SystemScheduleItem > ordered
Ordered item output used when explicit edges exist.
Definition system_schedule_scratch.h:77
cnt::darray< uint32_t > entityIndices
Item indices sorted by entity id.
Definition system_schedule_scratch.h:81
cnt::darray< uint32_t > sortedIndices
Item indices sorted by final deterministic key.
Definition system_schedule_scratch.h:99
cnt::darray< uint8_t > visited
Visit states for the final topological pass.
Definition system_schedule_scratch.h:107
cnt::darray< uint32_t > firstEdges
First edge index per child item.
Definition system_schedule_scratch.h:101
cnt::darray< uint32_t > sortedGroupIndices
Item indices sorted inside the active group.
Definition system_schedule_scratch.h:83
cnt::darray< uint32_t > firstChildren
First child index per target item.
Definition system_schedule_scratch.h:87
cnt::darray< SystemScheduleEdge > edges
Explicit dependency edges for the current run.
Definition system_schedule_scratch.h:75
cnt::darray< uint32_t > primaryPhases
Primary dependency target per phase.
Definition system_schedule_scratch.h:93
cnt::darray< SystemPhaseScheduleItem > phases
Collected unique phases for the current run.
Definition system_schedule_scratch.h:73
cnt::darray< uint8_t > states
Visit states reused by group and phase traversal.
Definition system_schedule_scratch.h:105