Skip to content

Commit 03412eb

Browse files
authored
feat: add parallel execution hint option (#176)
1 parent cae3239 commit 03412eb

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

ecsact/runtime/dynamic.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,16 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_entity_execution_status)
436436
ecsact_ees execution_status
437437
);
438438

439+
/**
440+
* Set a _hint_ that the system may process entities in parallel. This is
441+
* only a _hint_. The runtime implementation may choose to not run in parallel.
442+
*/
443+
ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_parallel_execution)
444+
( //
445+
ecsact_system_like_id system_like_id,
446+
bool parallel_execution
447+
);
448+
439449
// # BEGIN FOR_EACH_ECSACT_DYNAMIC_API_FN
440450
#ifdef ECSACT_MSVC_TRADITIONAL
441451
# define FOR_EACH_ECSACT_DYNAMIC_API_FN(fn, ...) \
@@ -484,7 +494,8 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_entity_execution_status)
484494
fn(ecsact_remove_system_generates, __VA_ARGS__); \
485495
fn(ecsact_system_generates_set_component, __VA_ARGS__); \
486496
fn(ecsact_system_generates_unset_component, __VA_ARGS__); \
487-
fn(ecsact_set_entity_execution_status, __VA_ARGS__)
497+
fn(ecsact_set_entity_execution_status, __VA_ARGS__); \
498+
fn(ecsact_set_system_parallel_execution, __VA_ARGS__)
488499
#endif
489500

490501
#endif // ECSACT_RUNTIME_DYNAMIC_H

ecsact/runtime/meta.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,15 @@ ECSACT_META_API_FN(int32_t, ecsact_meta_get_lazy_iteration_rate)
408408
ecsact_system_id system_id
409409
);
410410

411+
/**
412+
* Check if a system/action can run on multiple entities in parallel. This is
413+
* only a _hint_. The runtime implementation may choose to not run in parallel.
414+
*/
415+
ECSACT_META_API_FN(bool, ecsact_meta_get_system_parallel_execution)
416+
( //
417+
ecsact_system_like_id system_like_id
418+
);
419+
411420
// # BEGIN FOR_EACH_ECSACT_META_API_FN
412421
#ifdef ECSACT_MSVC_TRADITIONAL
413422
# define FOR_EACH_ECSACT_META_API_FN(fn, ...) ECSACT_MSVC_TRADITIONAL_ERROR()
@@ -462,7 +471,8 @@ ECSACT_META_API_FN(int32_t, ecsact_meta_get_lazy_iteration_rate)
462471
fn(ecsact_meta_get_parent_system_id, __VA_ARGS__); \
463472
fn(ecsact_meta_count_top_level_systems, __VA_ARGS__); \
464473
fn(ecsact_meta_get_top_level_systems, __VA_ARGS__); \
465-
fn(ecsact_meta_get_lazy_iteration_rate, __VA_ARGS__)
474+
fn(ecsact_meta_get_lazy_iteration_rate, __VA_ARGS__); \
475+
fn(ecsact_meta_get_system_parallel_execution, __VA_ARGS__)
466476
#endif
467477

468478
#endif // ECSACT_RUNTIME_META_H

0 commit comments

Comments
 (0)