WIP: Cycles: Parallelize copying geometry attributes from Blender #106694
|
@ -88,7 +88,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const bool *src = static_cast<const bool *>(b_bool_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeFloat, element);
|
||||
float *data = attr->data_float();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = float(src[i]);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const int *src = static_cast<const int *>(b_int_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeFloat, element);
|
||||
float *data = attr->data_float();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = float(src[i]);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const float(*src)[3] = static_cast<const float(*)[3]>(b_vector_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeVector, element);
|
||||
float3 *data = attr->data_float3();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = make_float3(src[i][0], src[i][1], src[i][2]);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const uchar(*src)[4] = static_cast<const uchar(*)[4]>(b_color_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeRGBA, element);
|
||||
float4 *data = attr->data_float4();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = make_float4(color_srgb_to_linear(byte_to_float(src[i][0])),
|
||||
color_srgb_to_linear(byte_to_float(src[i][1])),
|
||||
|
@ -139,7 +139,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const float(*src)[4] = static_cast<const float(*)[4]>(b_color_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeRGBA, element);
|
||||
float4 *data = attr->data_float4();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = make_float4(src[i][0], src[i][1], src[i][2], src[i][3]);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static void copy_attributes(PointCloud *pointcloud,
|
|||
const float(*src)[2] = static_cast<const float(*)[2]>(b_float2_attribute.data[0].ptr.data);
|
||||
Attribute *attr = attributes.add(name, TypeFloat2, element);
|
||||
float2 *data = attr->data_float2();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = make_float2(src[i][0], src[i][1]);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ static void export_pointcloud(Scene *scene,
|
|||
const float(*b_attr_position)[3] = find_position_attribute(b_pointcloud);
|
||||
float3 *points = pointcloud->get_points().data();
|
||||
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
points[i] = make_float3(b_attr_position[i][0], b_attr_position[i][1], b_attr_position[i][2]);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ static void export_pointcloud(Scene *scene,
|
|||
if (pointcloud->need_attribute(scene, ATTR_STD_POINT_RANDOM)) {
|
||||
Attribute *attr_random = pointcloud->attributes.add(ATTR_STD_POINT_RANDOM);
|
||||
float *data = attr_random->data_float();
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<int> &r) {
|
||||
parallel_for(blocked_range<int>(0, num_points, 4096), [&](const blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i != r.end(); i++) {
|
||||
data[i] = hash_uint2_to_float(i, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue