Skip to content

feat: more parallel execution options #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ecsact/runtime/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 4 additions & 4 deletions ecsact/runtime/dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,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
);

/**
Expand Down
5 changes: 4 additions & 1 deletion ecsact/runtime/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
9 changes: 9 additions & 0 deletions ecsact/runtime/meta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,13 @@ ECSACT_ALWAYS_INLINE auto main_package() -> std::optional<ecsact_package_id> {
return main_pkg_id;
}

template<typename SystemLikeID>
ECSACT_ALWAYS_INLINE auto get_system_parallel_execution( //
SystemLikeID id
) -> ecsact_parallel_execution {
return ecsact_meta_get_system_parallel_execution(
ecsact_id_cast<ecsact_system_like_id>(id)
);
}

} // namespace ecsact::meta
Loading