Skip to content

Commit 5668ccd

Browse files
committed
feat: respect parallel system parameter
feat: new parallel value meaning
1 parent 7bda631 commit 5668ccd

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

rt_entt_codegen/shared/parallel.cc

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,25 @@ auto ecsact::rt_entt_codegen::parallel::can_entities_parallel(
199199
return true;
200200
}
201201

202+
/**
203+
* Quick check to see if a system should run independently regardless of it's
204+
* system capbilities.
205+
*/
206+
static auto should_run_independently(ecsact_system_like_id id) -> bool {
207+
// User has explicitly marked a system as not parallel; respect that.
208+
if(ecsact_meta_get_system_parallel_execution(id) == ECSACT_PARA_EXEC_DENY) {
209+
return true;
210+
}
211+
212+
// Generator systems increase storage so they may not run in parallel with
213+
// other systems.
214+
if(!ecsact::meta::get_system_generates_ids(id).empty()) {
215+
return true;
216+
}
217+
218+
return false;
219+
}
220+
202221
static auto loop_iterator(
203222
const std::vector<system_like_id_variant>& system_list,
204223
const std::vector<system_like_id_variant>::iterator begin,
@@ -211,10 +230,8 @@ static auto loop_iterator(
211230

212231
for(auto iterator = begin; iterator != system_list.end(); iterator++) {
213232
auto sys_like_id = *iterator;
214-
auto capabilities = ecsact::meta::system_capabilities(sys_like_id);
215-
auto generate_ids = ecsact::meta::get_system_generates_ids(sys_like_id);
216233

217-
if(!generate_ids.empty()) {
234+
if(should_run_independently(sys_like_id)) {
218235
if(!parallel_system_list.empty()) {
219236
parallel_system_cluster.push_back(parallel_system_list);
220237
}
@@ -230,8 +247,8 @@ static auto loop_iterator(
230247
return;
231248
}
232249

233-
std::set<ecsact_component_like_id> child_unsafe_comps{};
234-
250+
auto capabilities = ecsact::meta::system_capabilities(sys_like_id);
251+
auto child_unsafe_comps = std::set<ecsact_component_like_id>{};
235252
auto child_systems = ecsact::meta::get_child_system_ids(sys_like_id);
236253

237254
for(auto child_sys_id : child_systems) {

0 commit comments

Comments
 (0)