-
-
Notifications
You must be signed in to change notification settings - Fork 535
Open
Labels
bugSomething isn't workingSomething isn't workinghas a workaroundIt's a bug, but there's a workaroundIt's a bug, but there's a workaround
Description
Describe the bug
Component structs passed to system do not adhere to the defined memory alignment correctly.
To Reproduce
-
enable avx
-
Create component with aligned struct, e.g.
typedef struct EcsTransform3 {
__attribute((aligned(32))) mat4 value;
} EcsTransform3;
- Inside system check address of pointer to struct
void TestSystem(ecs_iter_t* it) {
EcsTransform3 *transform = ecs_term(it, EcsTransform3, 1);
printf("(EcsTransform3 *) addr = %#010x", transform);
}
Sometimes prints addresses not aligned to 32 bytes as expected from CGLM_ALIGN_MAT.
(In my case this was 0x000000011af54ef0, which is only divisible by 16, not by 32.)
This causes crashes in calls to AVX intrinsics.
Expected behavior
Address of component should be aligned correctly, in this case to 32 bytes.
Additional context
Add any other context about the problem here (operating system, hardware, ...).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghas a workaroundIt's a bug, but there's a workaroundIt's a bug, but there's a workaround