Page MenuHome

Particles: Fixed thread work size calculation.
ClosedPublic

Authored by Stefan Werner (swerner) on Jan 20 2021, 11:23 AM.

Details

Summary

Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Diff Detail

Repository
rB Blender

Event Timeline

Stefan Werner (swerner) requested review of this revision.Jan 20 2021, 11:23 AM
Stefan Werner (swerner) created this revision.

Unfortunately, I do not have permission to provide my test scene.

I think this fix should also be included in 2.92 and 2.83LTS.

@Lukas Tönne (lukastoenne) I'm adding you as a reviewer since git tells me you wrote the code I'm changing here.

This revision is now accepted and ready to land.Jan 21 2021, 4:48 PM
Ben Thery (oxben) added inline comments.
source/blender/blenkernel/intern/particle_system.c
479

Out of curiosity, why not use the modulo operator here ?

int remainder = numtasks > 0 ? (endpart - startpart) % numtasks : 0;