Page MenuHome

Transform: support multi-threading for most modes
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Jun 29 2021, 4:19 PM.

Details

Summary

Multi-threading support for transform modes:
bevel-weight, crease, push-pull, rotate, shear, shrink-fatten,
skin-resize, to-sphere, trackball & translate.

This is done using a parallel loop over transform data.

From testing a 1.5million polygon mesh on a 32 core system the
overall performance gains were between ~20-28%

To ensure the code is thread-safe arguments to shared data are const.


Details for review:

  • This runs each objects transform data in parallel, instead of splitting the task between multiple objects in multi-object edit-mode. This was done because it's more common to have a few high poly meshes than many low poly objects in edit-mode.
  • The non-threaded loops are kept, this allows to easily disable threading if some situations don't support it.
  • Rotation was more involved as it caches rotation matrices to avoid expensive recalculation.
  • There are a few callbacks that could be converted into constants (isLockConstraint for e.g), this can be done as a separate refactor.

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 15492
Build 15492: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Jun 29 2021, 4:19 PM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) retitled this revision from Multi-threaded transform modes to Transform: support multi-threading for most modes.Jun 29 2021, 4:41 PM

Overall good.
Just a few observations:

source/blender/editors/transform/transform_mode_push_pull.c
92

typo: transdata_elem_push_pull_fn

source/blender/editors/transform/transform_mode_translate.c
152

Maybe it's worth checking the impact of accessing the array's pointer more directly rather than getting tc first.

This revision is now accepted and ready to land.Jun 29 2021, 6:53 PM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Update based on feedback