jbikker / tinybvh

Single-header BVH construction and traversal library.
MIT License
533 stars 25 forks source link

Align Fragment allocation. #14

Closed eloj closed 3 weeks ago

eloj commented 3 weeks ago

Not doing so results in immediate crashes on Linux. Exclude MSVC since it apparently works anyway (larger default alignment?).

There are a myriad ways to do this. Perhaps it'd be cleaner to change the new[]/delete[] to one of the existing aligned allocation macros, or add ones for arrays specifically.

Just doing struct ALIGNED( 32 ) Fragment works too, but I imagine this may waste more memory(?)

jbikker commented 3 weeks ago

This can (and should) simply be done with the existing MALLOC_ALIGNED, no need for new macros here.

jbikker commented 3 weeks ago

I am in the middle of some changes, will publish a fix with the next commit.