Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-07 19:51:56 +0300
committerJacques Lucke <jacques@blender.org>2021-03-07 19:53:05 +0300
commit74979459cbbe4ec5bf7014a511775b5274b20060 (patch)
tree14b2e0ecb04ca2a063f9ff83b192b72e405ca5cc /source/blender/blenkernel/intern/attribute_access.cc
parent9c8382e6186b519429e4dee8870265351810bc99 (diff)
Geometry Nodes: simplify allocating dynamically sized buffer on stack
Diffstat (limited to 'source/blender/blenkernel/intern/attribute_access.cc')
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 61dc0903cc8..b04af5327ca 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -438,9 +438,6 @@ class ConvertedReadAttribute final : public ReadAttribute {
ReadAttributePtr base_attribute_;
const nodes::DataTypeConversions &conversions_;
- static constexpr int MaxValueSize = 64;
- static constexpr int MaxValueAlignment = 64;
-
public:
ConvertedReadAttribute(ReadAttributePtr base_attribute, const CPPType &to_type)
: ReadAttribute(base_attribute->domain(), to_type, base_attribute->size()),
@@ -449,17 +446,13 @@ class ConvertedReadAttribute final : public ReadAttribute {
base_attribute_(std::move(base_attribute)),
conversions_(nodes::get_implicit_type_conversions())
{
- if (from_type_.size() > MaxValueSize || from_type_.alignment() > MaxValueAlignment) {
- throw std::runtime_error(
- "type is larger than expected, the buffer size has to be increased");
- }
}
void get_internal(const int64_t index, void *r_value) const override
{
- AlignedBuffer<MaxValueSize, MaxValueAlignment> buffer;
- base_attribute_->get(index, buffer.ptr());
- conversions_.convert(from_type_, to_type_, buffer.ptr(), r_value);
+ BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
+ base_attribute_->get(index, buffer);
+ conversions_.convert(from_type_, to_type_, buffer, r_value);
}
};