BMesh: Respect data alignment for attributes #109237

Open
Joseph Eagar wants to merge 8 commits from JosephEagar/blender:temp-customdata-aligned-offsets into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

8 Commits

Author SHA1 Message Date
Joseph Eagar d8dd5b03b1 Merge branch 'main' into temp-customdata-aligned-offsets 2023-06-22 23:43:00 -07:00
Joseph Eagar df8091f3fb More consts 2023-06-22 04:56:28 -07:00
Joseph Eagar eca42ce5ee Add a const 2023-06-22 04:55:57 -07:00
Joseph Eagar 26f92c7c61 Add another customData_update_typemap in early return if statement. 2023-06-22 04:53:29 -07:00
Joseph Eagar 5d691a6172 Restore deleted call to CustomData_update_typemap 2023-06-22 04:50:30 -07:00
Joseph Eagar bbbbc0ee40 Remove unneeded dependency 2023-06-22 04:48:24 -07:00
Joseph Eagar 1e3de4c7c7 Make patch changes 2023-06-22 04:47:33 -07:00
Joseph Eagar 61b45ec8c0 Core: Respect data alignment for BMesh attributes
This PR modifes customData_update_offsets to respect
memory alignment when laying out BMesh attribute
blocks. While most consumer CPUs (and all x86s) support
nonaligned memory access it can lead to performance
degredation.

The alignment process is simple; large attributes
are layed out first and then small ones, and padding
bytes are added as necessary.  Common vector types
are assumed to align to their base type (e.g.
CD_PROP_FLOAT3 has an alignment of 4).

In the future we should probably allocate BMesh attributes
seperately in some kind of shared memory pool collection.
But for now this should improve performance.
2023-06-22 03:46:26 -07:00