diff options
author | Jacques Lucke <jacques@blender.org> | 2021-12-05 17:10:11 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-05 17:10:11 +0300 |
commit | b32f9bf801ec6cc0e3b40b87de16f34eba3f593e (patch) | |
tree | 6a1fb164156a65945aee22d6885747300dfaf0ae /source/blender/blenkernel/BKE_geometry_set.h | |
parent | d19443074a8ed9a5717b56f0254bd416c5e76923 (diff) |
Geometry Nodes: use array instead of map in GeometrySet
`GeometrySet` contains at most one component of each type.
Previously, a map was used to make sure that each component
type only exists once. The overhead of a map (especially with
inline storage) is rather large though. Since all component types
are known at compile time and the number of types is low,
a simple `std::array` works as well.
Some benefits of using `std::array` here:
* Looking up the component of a specific type is a bit faster.
* The size of `GeometrySet` becomes much smaller from 192 to 40 bytes.
* Debugging a `GeometrySet` in many tools becomes simpler because
one can easily see which components exists and which don't
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.h')
-rw-r--r-- | source/blender/blenkernel/BKE_geometry_set.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.h b/source/blender/blenkernel/BKE_geometry_set.h index 17cdb9d6a42..2d6218f1036 100644 --- a/source/blender/blenkernel/BKE_geometry_set.h +++ b/source/blender/blenkernel/BKE_geometry_set.h @@ -39,6 +39,8 @@ typedef enum GeometryComponentType { GEO_COMPONENT_TYPE_CURVE = 4, } GeometryComponentType; +#define GEO_COMPONENT_TYPE_ENUM_SIZE 5 + void BKE_geometry_set_free(struct GeometrySet *geometry_set); bool BKE_object_has_geometry_set_instances(const struct Object *ob); |