[Bf-blender-cvs] [78362edb490] functions: optimization when indices are trivial
Jacques Lucke
noreply at git.blender.org
Sun Jun 30 16:00:40 CEST 2019
Commit: 78362edb490b84774db39916b8dd1647e598d0e3
Author: Jacques Lucke
Date: Sun Jun 30 09:55:54 2019 +0200
Branches: functions
https://developer.blender.org/rB78362edb490b84774db39916b8dd1647e598d0e3
optimization when indices are trivial
===================================================================
M source/blender/simulations/bparticles/simulate.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 013a0f0cb5f..c74d458666e 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -94,7 +94,7 @@ BLI_NOINLINE static void forward_particles_to_next_event_or_end(
auto offsets = attribute_offsets.get_float3(attribute_index);
if (particles.indices_are_trivial()) {
- for (uint pindex = 0; pindex < particles.size(); pindex++) {
+ for (uint pindex : particles.range()) {
float time_factor = time_factors_to_next_event[pindex];
values[pindex] += time_factor * offsets[pindex];
}
@@ -318,8 +318,15 @@ BLI_NOINLINE static void apply_remaining_offsets(ParticleSet particles,
auto values = particles.attributes().get_float3(name);
auto offsets = attribute_offsets.get_float3(attribute_index);
- for (uint pindex : particles.indices()) {
- values[pindex] += offsets[pindex];
+ if (particles.indices_are_trivial()) {
+ for (uint pindex : particles.range()) {
+ values[pindex] += offsets[pindex];
+ }
+ }
+ else {
+ for (uint pindex : particles.indices()) {
+ values[pindex] += offsets[pindex];
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list