diff options
author | lawnjelly <lawnjelly@gmail.com> | 2022-05-20 13:28:44 +0100 |
---|---|---|
committer | lawnjelly <lawnjelly@gmail.com> | 2022-07-04 12:01:46 +0100 |
commit | b221eab4260c471c37ff2aae2546fcfa6dd7ac58 (patch) | |
tree | bdbf944f69d8a193c5a76160e314cf112ef310f2 /core/variant/variant.h | |
parent | 1d06fec5354d45c21414bf4b00435868444636cb (diff) | |
download | redot-engine-b221eab4260c471c37ff2aae2546fcfa6dd7ac58.tar.gz |
Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
Diffstat (limited to 'core/variant/variant.h')
-rw-r--r-- | core/variant/variant.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h index 872b374b13..1749702c61 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -51,6 +51,7 @@ #include "core/os/keyboard.h" #include "core/string/node_path.h" #include "core/string/ustring.h" +#include "core/templates/paged_allocator.h" #include "core/templates/rid.h" #include "core/variant/array.h" #include "core/variant/callable.h" @@ -128,6 +129,24 @@ public: }; private: + struct Pools { + union BucketSmall { + BucketSmall() {} + ~BucketSmall() {} + Transform2D _transform2d; + ::AABB _aabb; + }; + union BucketLarge { + BucketLarge() {} + ~BucketLarge() {} + Basis _basis; + Transform3D _transform3d; + }; + + static PagedAllocator<BucketSmall, true> _bucket_small; + static PagedAllocator<BucketLarge, true> _bucket_large; + }; + friend struct _VariantCall; friend class VariantInternal; // Variant takes 20 bytes when real_t is float, and 36 if double |