Geometry Nodes: Parallelize Attribute Curve Map node
This adds `parallel_for` to the Attribute Curve Map node to improve performance. Grain size set to 512. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D11194
This commit is contained in:
parent
8e3a73bf81
commit
7d90b0ab11
|
@ -1 +1 @@
|
|||
Subproject commit f7b706dd6434db2d752f47c4b8c3148b2990fd73
|
||||
Subproject commit 2cef4877edc40875978c4e95322bb5193f5815bf
|
|
@ -1 +1 @@
|
|||
Subproject commit 4cb833e84acfd2be5fa08ce75118ce9cb60643b8
|
||||
Subproject commit bcd08a9506d33bdd7358201031b04d041ef22d94
|
|
@ -1 +1 @@
|
|||
Subproject commit 8970953d4a8a4ea3bf77c66370c817ed0cf1308a
|
||||
Subproject commit f948f658ba33eb670a65e0bba058d43138abea7e
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_task.hh"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
|
||||
|
@ -143,9 +144,11 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon
|
|||
GVArray_Typed<float> attribute_in = component.attribute_get_for_read<float>(
|
||||
input_name, result_domain, float(0.0f));
|
||||
MutableSpan<float> results = attribute_result.as_span<float>();
|
||||
for (const int i : IndexRange(attribute_in.size())) {
|
||||
results[i] = BKE_curvemapping_evaluateF(cumap, 3, attribute_in[i]);
|
||||
}
|
||||
parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
results[i] = BKE_curvemapping_evaluateF(cumap, 3, attribute_in[i]);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case CD_PROP_FLOAT3: {
|
||||
|
@ -153,9 +156,11 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon
|
|||
GVArray_Typed<float3> attribute_in = component.attribute_get_for_read<float3>(
|
||||
input_name, result_domain, float3(0.0f));
|
||||
MutableSpan<float3> results = attribute_result.as_span<float3>();
|
||||
for (const int i : IndexRange(attribute_in.size())) {
|
||||
BKE_curvemapping_evaluate3F(cumap, results[i], attribute_in[i]);
|
||||
}
|
||||
parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
BKE_curvemapping_evaluate3F(cumap, results[i], attribute_in[i]);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case CD_PROP_COLOR: {
|
||||
|
@ -163,9 +168,11 @@ static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryCompon
|
|||
GVArray_Typed<Color4f> attribute_in = component.attribute_get_for_read<Color4f>(
|
||||
input_name, result_domain, Color4f(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
MutableSpan<Color4f> results = attribute_result.as_span<Color4f>();
|
||||
for (const int i : IndexRange(attribute_in.size())) {
|
||||
BKE_curvemapping_evaluateRGBF(cumap, results[i], attribute_in[i]);
|
||||
}
|
||||
parallel_for(IndexRange(attribute_in.size()), 512, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
BKE_curvemapping_evaluateRGBF(cumap, results[i], attribute_in[i]);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
Loading…
Reference in New Issue