Skip to content
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
21 changes: 7 additions & 14 deletions distr/flecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28150,8 +28150,6 @@ struct ecs_pipeline_state_t {
ecs_entity_t last_system; /* Last system run by pipeline */
int32_t match_count; /* Used to track if rebuild is necessary */
int32_t rebuild_count; /* Number of pipeline rebuilds */
ecs_iter_t *iters; /* Iterator for worker(s) */
int32_t iter_count;

/* Members for continuing pipeline iteration after pipeline rebuild */
ecs_pipeline_op_t *cur_op; /* Current pipeline op */
Expand Down Expand Up @@ -62670,7 +62668,6 @@ static void flecs_pipeline_state_free(
ecs_allocator_t *a = &world->allocator;
ecs_vec_fini_t(a, &p->ops, ecs_pipeline_op_t);
ecs_vec_fini_t(a, &p->systems, ecs_system_t*);
ecs_os_free(p->iters);
ecs_os_free(p);
}
}
Expand Down Expand Up @@ -63162,12 +63159,6 @@ bool flecs_pipeline_update(

bool rebuilt = flecs_pipeline_build(world, pq);
if (start_of_frame) {
/* Initialize iterators */
int32_t i, count = pq->iter_count;
for (i = 0; i < count; i ++) {
ecs_world_t *stage = ecs_get_stage(world, i);
pq->iters[i] = ecs_query_iter(stage, pq->query);
}
pq->cur_op = ecs_vec_first_t(&pq->ops, ecs_pipeline_op_t);
pq->cur_i = 0;
} else {
Expand Down Expand Up @@ -74939,8 +74930,6 @@ void flecs_pipeline_memory_get(
ECS_SIZEOF(ecs_pipeline_op_t);
result->bytes_pipelines += ecs_vec_size(&ps->systems) *
ECS_SIZEOF(ecs_entity_t);
result->bytes_pipelines += ps->iter_count *
ECS_SIZEOF(ecs_iter_t);
}
}
}
Expand Down Expand Up @@ -85716,12 +85705,16 @@ ecs_iter_t flecs_query_iter(

flecs_query_cache_iter_init(&it, qit, impl);

ecs_size_t vars_size = var_count * ECS_SIZEOF(ecs_var_t);
ecs_size_t written_size = op_count * ECS_SIZEOF(ecs_write_flags_t);
char *scratch = flecs_iter_calloc(
&it, vars_size + written_size, ECS_ALIGNOF(ecs_var_t));
if (var_count) {
qit->vars = flecs_iter_calloc_n(&it, ecs_var_t, var_count);
qit->vars = (ecs_var_t*)(void*)scratch;
}
qit->written = (ecs_write_flags_t*)(void*)(scratch + vars_size);

if (op_count) {
qit->written = flecs_iter_calloc_n(&it, ecs_write_flags_t, op_count);
if (impl->ops || !impl->cache) {
qit->op_ctx = flecs_iter_calloc_n(&it, ecs_query_op_ctx_t, op_count);
}

Expand Down
12 changes: 7 additions & 5 deletions distr/flecs_no_addons.c
Original file line number Diff line number Diff line change
Expand Up @@ -23907,8 +23907,6 @@ struct ecs_pipeline_state_t {
ecs_entity_t last_system; /* Last system run by pipeline */
int32_t match_count; /* Used to track if rebuild is necessary */
int32_t rebuild_count; /* Number of pipeline rebuilds */
ecs_iter_t *iters; /* Iterator for worker(s) */
int32_t iter_count;

/* Members for continuing pipeline iteration after pipeline rebuild */
ecs_pipeline_op_t *cur_op; /* Current pipeline op */
Expand Down Expand Up @@ -48017,12 +48015,16 @@ ecs_iter_t flecs_query_iter(

flecs_query_cache_iter_init(&it, qit, impl);

ecs_size_t vars_size = var_count * ECS_SIZEOF(ecs_var_t);
ecs_size_t written_size = op_count * ECS_SIZEOF(ecs_write_flags_t);
char *scratch = flecs_iter_calloc(
&it, vars_size + written_size, ECS_ALIGNOF(ecs_var_t));
if (var_count) {
qit->vars = flecs_iter_calloc_n(&it, ecs_var_t, var_count);
qit->vars = (ecs_var_t*)(void*)scratch;
}
qit->written = (ecs_write_flags_t*)(void*)(scratch + vars_size);

if (op_count) {
qit->written = flecs_iter_calloc_n(&it, ecs_write_flags_t, op_count);
if (impl->ops || !impl->cache) {
qit->op_ctx = flecs_iter_calloc_n(&it, ecs_query_op_ctx_t, op_count);
}

Expand Down
7 changes: 0 additions & 7 deletions src/addons/pipeline/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ static void flecs_pipeline_state_free(
ecs_allocator_t *a = &world->allocator;
ecs_vec_fini_t(a, &p->ops, ecs_pipeline_op_t);
ecs_vec_fini_t(a, &p->systems, ecs_system_t*);
ecs_os_free(p->iters);
ecs_os_free(p);
}
}
Expand Down Expand Up @@ -511,12 +510,6 @@ bool flecs_pipeline_update(

bool rebuilt = flecs_pipeline_build(world, pq);
if (start_of_frame) {
/* Initialize iterators */
int32_t i, count = pq->iter_count;
for (i = 0; i < count; i ++) {
ecs_world_t *stage = ecs_get_stage(world, i);
pq->iters[i] = ecs_query_iter(stage, pq->query);
}
pq->cur_op = ecs_vec_first_t(&pq->ops, ecs_pipeline_op_t);
pq->cur_i = 0;
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/addons/pipeline/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ struct ecs_pipeline_state_t {
ecs_entity_t last_system; /* Last system run by pipeline */
int32_t match_count; /* Used to track if rebuild is necessary */
int32_t rebuild_count; /* Number of pipeline rebuilds */
ecs_iter_t *iters; /* Iterator for worker(s) */
int32_t iter_count;

/* Members for continuing pipeline iteration after pipeline rebuild */
ecs_pipeline_op_t *cur_op; /* Current pipeline op */
Expand Down
2 changes: 0 additions & 2 deletions src/addons/stats/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,6 @@ void flecs_pipeline_memory_get(
ECS_SIZEOF(ecs_pipeline_op_t);
result->bytes_pipelines += ecs_vec_size(&ps->systems) *
ECS_SIZEOF(ecs_entity_t);
result->bytes_pipelines += ps->iter_count *
ECS_SIZEOF(ecs_iter_t);
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/query/engine/eval_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,16 @@ ecs_iter_t flecs_query_iter(

flecs_query_cache_iter_init(&it, qit, impl);

ecs_size_t vars_size = var_count * ECS_SIZEOF(ecs_var_t);
ecs_size_t written_size = op_count * ECS_SIZEOF(ecs_write_flags_t);
char *scratch = flecs_iter_calloc(
&it, vars_size + written_size, ECS_ALIGNOF(ecs_var_t));
if (var_count) {
qit->vars = flecs_iter_calloc_n(&it, ecs_var_t, var_count);
qit->vars = (ecs_var_t*)(void*)scratch;
}
qit->written = (ecs_write_flags_t*)(void*)(scratch + vars_size);

if (op_count) {
qit->written = flecs_iter_calloc_n(&it, ecs_write_flags_t, op_count);
if (impl->ops || !impl->cache) {
qit->op_ctx = flecs_iter_calloc_n(&it, ecs_query_op_ctx_t, op_count);
}

Expand Down
Loading