diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-25 10:03:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-26 10:07:05 +0300 |
commit | b5542c1ea4c29c56338706158578c41f6e65df5c (patch) | |
tree | 2d6c0a62a7f9b91a5172ef96ef1076904566545f /source/blender/bmesh/intern/bmesh_mesh_partial_update.h | |
parent | c1fe58244646c7ecc58fba1bdbf7c511750b14c9 (diff) |
Edit Mesh: optimize common use-cases for partial updates
Skip updating normals & tessellation for contiguous geometry regions
for operations such as translate & uniform scale.
This means when all geometry is selected, no updates are needed
as the relative locations of vertices aren't being modified.
Performance:
As this is skipping a multi-threaded operation,
larger improvements are noticeable on systems with fewer cores.
- ~1.15x to ~1.3x overall gain for 32 cores.
- ~1.7x to ~2.2x overall gain for 1 core (limited using `-t 1` argument).
Details:
- Rotate & non-uniform scale only skip tessellation.
- Proportional editing and axis-mirror have special handling
ensure geometry is properly grouped before considering
a face part of a single group that can be skipped.
- Loose vertices always need their normals to be recalculated
since they're calculated based on the location.
- Non-affine transform operations such as shrink-fatten & bend,
don't take advantage of this optimization.
- Snap projection also disables the optimization.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh_partial_update.h')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_partial_update.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h index 3dbfb985e92..cf4eab22836 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h @@ -54,9 +54,20 @@ typedef struct BMPartialUpdate { BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, const BMPartialUpdate_Params *params, - const int verts_len, - bool (*filter_fn)(BMVert *, void *user_data), - void *user_data) - ATTR_NONNULL(1, 2, 4) ATTR_WARN_UNUSED_RESULT; + const unsigned int *verts_mask, + const int verts_mask_count) + ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; + +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_single( + BMesh *bm, + const BMPartialUpdate_Params *params, + const unsigned int *verts_mask, + const int verts_mask_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; + +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_multi( + BMesh *bm, + const BMPartialUpdate_Params *params, + const int *verts_group, + const int verts_group_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo) ATTR_NONNULL(1); |