diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-07 19:51:56 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-07 19:53:05 +0300 |
commit | 74979459cbbe4ec5bf7014a511775b5274b20060 (patch) | |
tree | 14b2e0ecb04ca2a063f9ff83b192b72e405ca5cc /source/blender/functions | |
parent | 9c8382e6186b519429e4dee8870265351810bc99 (diff) |
Geometry Nodes: simplify allocating dynamically sized buffer on stack
Diffstat (limited to 'source/blender/functions')
-rw-r--r-- | source/blender/functions/FN_cpp_type.hh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index a854e63288d..b8ac97d6dbd 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -935,3 +935,9 @@ inline std::unique_ptr<const CPPType> create_cpp_type(StringRef name, const T &d { \ return blender::fn::CPPType::get<TYPE_NAME>(); \ } + +/* Utility for allocating an uninitialized buffer for a single value of the given #CPPType. */ +#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name) \ + blender::DynamicStackBuffer<64, 64> stack_buffer_for_##variable_name(type.size(), \ + type.alignment()); \ + void *variable_name = stack_buffer_for_##variable_name.buffer(); |