diff --git a/ecsact/runtime/common.h b/ecsact/runtime/common.h index c9fe0af2..c5a087b0 100644 --- a/ecsact/runtime/common.h +++ b/ecsact/runtime/common.h @@ -381,6 +381,23 @@ typedef enum { ECSACT_SYS_NOTIFY_ONREMOVE, } ecsact_system_notify_setting; +typedef enum ecsact_parallel_execution { + /** + * Let implementation decide parallel execution. + */ + ECSACT_PAR_EXEC_AUTO = 0, + + /** + * Hint to implementation that parallel execution is preferred. + */ + ECSACT_PAR_EXEC_PREFERRED = 1, + + /** + * Disallow implementation to use parallel execution. + */ + ECSACT_PAR_EXEC_DENY = 2, +} ecsact_parallel_execution; + /** * Flags for generates component set */ diff --git a/ecsact/runtime/dynamic.h b/ecsact/runtime/dynamic.h index 255d04cb..7c316110 100644 --- a/ecsact/runtime/dynamic.h +++ b/ecsact/runtime/dynamic.h @@ -474,13 +474,13 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_entity_execution_status) ); /** - * Set a _hint_ that the system may process entities in parallel. This is - * only a _hint_. The runtime implementation may choose to not run in parallel. + * Sets the systems parallel execution setting. + * @SEE: ecsact_parallel_execution */ ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_parallel_execution) ( // - ecsact_system_like_id system_like_id, - bool parallel_execution + ecsact_system_like_id system_like_id, + ecsact_parallel_execution parallel_execution ); /** diff --git a/ecsact/runtime/meta.h b/ecsact/runtime/meta.h index abed788c..cbbf77ee 100644 --- a/ecsact/runtime/meta.h +++ b/ecsact/runtime/meta.h @@ -477,7 +477,10 @@ ECSACT_META_API_FN(int32_t, ecsact_meta_get_lazy_iteration_rate) * Check if a system/action can run on multiple entities in parallel. This is * only a _hint_. The runtime implementation may choose to not run in parallel. */ -ECSACT_META_API_FN(bool, ecsact_meta_get_system_parallel_execution) +ECSACT_META_API_FN( + ecsact_parallel_execution, + ecsact_meta_get_system_parallel_execution +) ( // ecsact_system_like_id system_like_id ); diff --git a/ecsact/runtime/meta.hh b/ecsact/runtime/meta.hh index f9050d26..de4fe8c4 100644 --- a/ecsact/runtime/meta.hh +++ b/ecsact/runtime/meta.hh @@ -641,4 +641,13 @@ ECSACT_ALWAYS_INLINE auto main_package() -> std::optional { return main_pkg_id; } +template +ECSACT_ALWAYS_INLINE auto get_system_parallel_execution( // + SystemLikeID id +) -> ecsact_parallel_execution { + return ecsact_meta_get_system_parallel_execution( + ecsact_id_cast(id) + ); +} + } // namespace ecsact::meta