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:
authorHans Goudey <h.goudey@me.com>2022-03-09 19:23:17 +0300
committerHans Goudey <h.goudey@me.com>2022-03-09 19:23:17 +0300
commit115ff08fdb251cf0a656ce729c49ac38d96cd5f9 (patch)
tree007c5f59c96c083e268b0e57c544e6522bcf0f11 /source/blender/geometry
parent6c6f591f909a02967daff87ab348601953f61670 (diff)
Fix: Use "construct" instead of "assign" for uninitialized memory
The realize instances code used "assign", but the attribute buffers on the result aren't necessarily initialized. This doesn't make a difference for trivial types like `int`, but it would with more complex types.
Diffstat (limited to 'source/blender/geometry')
-rw-r--r--source/blender/geometry/intern/realize_instances.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc
index c2337c37d1f..9acabae10ab 100644
--- a/source/blender/geometry/intern/realize_instances.cc
+++ b/source/blender/geometry/intern/realize_instances.cc
@@ -646,7 +646,7 @@ static void execute_realize_pointcloud_task(const RealizeInstancesOptions &optio
const GSpan src_span = *pointcloud_info.attributes[attribute_index];
threading::parallel_for(
IndexRange(pointcloud.totpoint), 1024, [&](const IndexRange range) {
- cpp_type.copy_assign_n(
+ cpp_type.copy_construct_n(
src_span.slice(range).data(), dst_span.slice(range).data(), range.size());
});
}
@@ -657,7 +657,7 @@ static void execute_realize_pointcloud_task(const RealizeInstancesOptions &optio
/* As the fallback value for the attribute. */
threading::parallel_for(
IndexRange(pointcloud.totpoint), 1024, [&](const IndexRange range) {
- cpp_type.fill_assign_n(
+ cpp_type.fill_construct_n(
attribute_fallback, dst_span.slice(range).data(), range.size());
});
}
@@ -943,9 +943,9 @@ static void execute_realize_mesh_task(const RealizeInstancesOptions &options,
const GSpan src_span = *mesh_info.attributes[attribute_index];
threading::parallel_for(
IndexRange(element_slice.size()), 1024, [&](const IndexRange sub_range) {
- cpp_type.copy_assign_n(src_span.slice(sub_range).data(),
- dst_span.slice(sub_range).data(),
- sub_range.size());
+ cpp_type.copy_construct_n(src_span.slice(sub_range).data(),
+ dst_span.slice(sub_range).data(),
+ sub_range.size());
});
}
else {
@@ -954,7 +954,7 @@ static void execute_realize_mesh_task(const RealizeInstancesOptions &options,
}
threading::parallel_for(
IndexRange(element_slice.size()), 1024, [&](const IndexRange sub_range) {
- cpp_type.fill_assign_n(
+ cpp_type.fill_construct_n(
attribute_fallback, dst_span.slice(sub_range).data(), sub_range.size());
});
}
@@ -1251,9 +1251,9 @@ static void execute_realize_curve_task(const RealizeInstancesOptions &options,
const GSpan src_span = *curves_info.attributes[attribute_index];
threading::parallel_for(
IndexRange(element_slice.size()), 1024, [&](const IndexRange sub_range) {
- cpp_type.copy_assign_n(src_span.slice(sub_range).data(),
- dst_span.slice(sub_range).data(),
- sub_range.size());
+ cpp_type.copy_construct_n(src_span.slice(sub_range).data(),
+ dst_span.slice(sub_range).data(),
+ sub_range.size());
});
}
else {
@@ -1262,7 +1262,7 @@ static void execute_realize_curve_task(const RealizeInstancesOptions &options,
}
threading::parallel_for(
IndexRange(element_slice.size()), 1024, [&](const IndexRange sub_range) {
- cpp_type.fill_assign_n(
+ cpp_type.fill_construct_n(
attribute_fallback, dst_span.slice(sub_range).data(), sub_range.size());
});
}