Skip to content

Commit

Permalink
Split off entity filters (union/bitset terms) from query code
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Dec 14, 2022
1 parent 08ab99a commit 6e246dd
Show file tree
Hide file tree
Showing 15 changed files with 885 additions and 826 deletions.
854 changes: 440 additions & 414 deletions flecs.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions flecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,7 @@ typedef struct ecs_iter_private_t {
ecs_worker_iter_t worker;
} iter; /* Iterator specific data */

void *entity_iter; /* Filter applied after matching a table */
ecs_iter_cache_t cache; /* Inline arrays to reduce allocations */
} ecs_iter_private_t;

Expand Down
1 change: 1 addition & 0 deletions include/flecs/private/api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ typedef struct ecs_iter_private_t {
ecs_worker_iter_t worker;
} iter; /* Iterator specific data */

void *entity_iter; /* Filter applied after matching a table */
ecs_iter_cache_t cache; /* Inline arrays to reduce allocations */
} ecs_iter_private_t;

Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ flecs_src = files(
'src/datastructures/vector.c',
'src/bootstrap.c',
'src/entity.c',
'src/entity_filter.c',
'src/filter.c',
'src/hierarchy.c',
'src/id_record.c',
Expand Down
1 change: 1 addition & 0 deletions src/addons/system/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ ecs_entity_t ecs_run_intern(
}
} else {
action(&qit);
ecs_iter_fini(&qit);
}

if (measure_time) {
Expand Down
9 changes: 9 additions & 0 deletions src/datastructures/stack_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void* flecs_stack_alloc(
ecs_size_t size,
ecs_size_t align);

#define flecs_stack_alloc_t(stack, T)\
flecs_stack_alloc(stack, ECS_SIZEOF(T), ECS_ALIGNOF(T))

#define flecs_stack_alloc_n(stack, T, count)\
flecs_stack_alloc(stack, ECS_SIZEOF(T) * count, ECS_ALIGNOF(T))

Expand All @@ -40,13 +43,19 @@ void* flecs_stack_calloc(
ecs_size_t size,
ecs_size_t align);

#define flecs_stack_calloc_t(stack, T)\
flecs_stack_calloc(stack, ECS_SIZEOF(T), ECS_ALIGNOF(T))

#define flecs_stack_calloc_n(stack, T, count)\
flecs_stack_calloc(stack, ECS_SIZEOF(T) * count, ECS_ALIGNOF(T))

void flecs_stack_free(
void *ptr,
ecs_size_t size);

#define flecs_stack_free_t(ptr, T)\
flecs_stack_free(ptr, ECS_SIZEOF(T))

#define flecs_stack_free_n(ptr, T, count)\
flecs_stack_free(ptr, ECS_SIZEOF(T) * count)

Expand Down
Loading

0 comments on commit 6e246dd

Please sign in to comment.