Skip to content

Commit 675c334

Browse files
authored
feat: more parallel execution options (#249)
1 parent 2f27be4 commit 675c334

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

ecsact/runtime/common.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,23 @@ typedef enum {
381381
ECSACT_SYS_NOTIFY_ONREMOVE,
382382
} ecsact_system_notify_setting;
383383

384+
typedef enum ecsact_parallel_execution {
385+
/**
386+
* Let implementation decide parallel execution.
387+
*/
388+
ECSACT_PAR_EXEC_AUTO = 0,
389+
390+
/**
391+
* Hint to implementation that parallel execution is preferred.
392+
*/
393+
ECSACT_PAR_EXEC_PREFERRED = 1,
394+
395+
/**
396+
* Disallow implementation to use parallel execution.
397+
*/
398+
ECSACT_PAR_EXEC_DENY = 2,
399+
} ecsact_parallel_execution;
400+
384401
/**
385402
* Flags for generates component set
386403
*/

ecsact/runtime/dynamic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,13 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_entity_execution_status)
474474
);
475475

476476
/**
477-
* Set a _hint_ that the system may process entities in parallel. This is
478-
* only a _hint_. The runtime implementation may choose to not run in parallel.
477+
* Sets the systems parallel execution setting.
478+
* @SEE: ecsact_parallel_execution
479479
*/
480480
ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_parallel_execution)
481481
( //
482-
ecsact_system_like_id system_like_id,
483-
bool parallel_execution
482+
ecsact_system_like_id system_like_id,
483+
ecsact_parallel_execution parallel_execution
484484
);
485485

486486
/**

ecsact/runtime/meta.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ ECSACT_META_API_FN(int32_t, ecsact_meta_get_lazy_iteration_rate)
477477
* Check if a system/action can run on multiple entities in parallel. This is
478478
* only a _hint_. The runtime implementation may choose to not run in parallel.
479479
*/
480-
ECSACT_META_API_FN(bool, ecsact_meta_get_system_parallel_execution)
480+
ECSACT_META_API_FN(
481+
ecsact_parallel_execution,
482+
ecsact_meta_get_system_parallel_execution
483+
)
481484
( //
482485
ecsact_system_like_id system_like_id
483486
);

ecsact/runtime/meta.hh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,13 @@ ECSACT_ALWAYS_INLINE auto main_package() -> std::optional<ecsact_package_id> {
641641
return main_pkg_id;
642642
}
643643

644+
template<typename SystemLikeID>
645+
ECSACT_ALWAYS_INLINE auto get_system_parallel_execution( //
646+
SystemLikeID id
647+
) -> ecsact_parallel_execution {
648+
return ecsact_meta_get_system_parallel_execution(
649+
ecsact_id_cast<ecsact_system_like_id>(id)
650+
);
651+
}
652+
644653
} // namespace ecsact::meta

0 commit comments

Comments
 (0)