[Bf-blender-cvs] [661dcd813cc] temp_bmesh_multires: Merge performance improvements from trimesh branch into this one.

Joseph Eagar noreply at git.blender.org
Sun Oct 25 03:42:31 CET 2020


Commit: 661dcd813cccff1e8f3a75a459af3e09e9a7faf6
Author: Joseph Eagar
Date:   Sat Oct 24 19:41:54 2020 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB661dcd813cccff1e8f3a75a459af3e09e9a7faf6

Merge performance improvements from trimesh branch into this one.

===================================================================

M	.clang-format
M	source/blender/blenkernel/BKE_collection.h
M	source/blender/blenkernel/BKE_lib_id.h
M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/anim_data.c
M	source/blender/blenkernel/intern/mesh_validate.cc
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/blenkernel/intern/pbvh_intern.h
M	source/blender/blenlib/BLI_ghash.h
M	source/blender/blenlib/intern/BLI_ghash_utils.c
M	source/blender/blenlib/intern/task_pool.cc
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_automasking.c
M	source/blender/editors/sculpt_paint/sculpt_boundary.c
M	source/blender/editors/sculpt_paint/sculpt_detail.c
M	source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_smooth.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/gpu/GPU_buffers.h
M	source/blender/gpu/intern/gpu_buffers.c

===================================================================

diff --git a/.clang-format b/.clang-format
index 8a992fea3a9..780b718d3aa 100644
--- a/.clang-format
+++ b/.clang-format
@@ -262,6 +262,7 @@ ForEachMacros:
   - SET_SLOT_PROBING_BEGIN
   - MAP_SLOT_PROBING_BEGIN
   - VECTOR_SET_SLOT_PROBING_BEGIN
+  - TGSET_ITER
 
 # Use once we bump the minimum version to version 8.
 # # Without this string literals that in-line 'STRINGIFY' behave strangely (a bug?).
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index f4393742dff..517ab59b44b 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -26,6 +26,8 @@
 #include "BLI_sys_types.h"
 
 #include "DNA_listBase.h"
+#include "DNA_userdef_types.h"
+#include "BKE_lib_id.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -65,8 +67,8 @@ bool BKE_collection_delete(struct Main *bmain, struct Collection *collection, bo
 struct Collection *BKE_collection_duplicate(struct Main *bmain,
                                             struct Collection *parent,
                                             struct Collection *collection,
-                                            const uint duplicate_flags,
-                                            const uint duplicate_options);
+                                            const eDupli_ID_Flags duplicate_flags,
+                                            const eLibIDDuplicateFlags duplicate_options);
 
 /* Master Collection for Scene */
 
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h
index e54e2fb4b87..e89ed08b423 100644
--- a/source/blender/blenkernel/BKE_lib_id.h
+++ b/source/blender/blenkernel/BKE_lib_id.h
@@ -46,6 +46,7 @@
  */
 
 #include "BLI_compiler_attrs.h"
+#include "DNA_userdef_types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -244,7 +245,7 @@ struct ID *BKE_id_copy_ex(struct Main *bmain,
                           const int flag);
 struct ID *BKE_id_copy_for_duplicate(struct Main *bmain,
                                      struct ID *id,
-                                     const uint duplicate_flags);
+                                     const eDupli_ID_Flags duplicate_flags);
 
 void BKE_lib_id_swap(struct Main *bmain, struct ID *id_a, struct ID *id_b);
 void BKE_lib_id_swap_full(struct Main *bmain, struct ID *id_a, struct ID *id_b);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 0a992f2cb58..8c48e5bb17f 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -25,6 +25,8 @@
 #include "BLI_sys_types.h"
 
 #include "DNA_object_enums.h"
+#include "DNA_userdef_types.h"
+#include "BKE_lib_id.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -141,8 +143,8 @@ bool BKE_object_obdata_is_libdata(const struct Object *ob);
 
 struct Object *BKE_object_duplicate(struct Main *bmain,
                                     struct Object *ob,
-                                    uint dupflag,
-                                    const uint duplicate_options);
+                                    eDupli_ID_Flags dupflag,
+                                    const eLibIDDuplicateFlags duplicate_options);
 
 void BKE_object_obdata_size_init(struct Object *ob, const float size);
 
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 150d0d9b011..94bb3d7cb03 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -26,6 +26,7 @@
 #include "BLI_bitmap.h"
 #include "BLI_utildefines.h"
 #include "DNA_object_enums.h"
+#include "BKE_pbvh.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -286,10 +287,10 @@ typedef struct SculptClothLengthConstraint {
    * point, position for a previous state). In that case, elem_index_a and elem_index_b should be
    * the same to avoid affecting two different vertices when solving the constraints.
    * *elem_position points to the position which is owned by the element. */
-  int elem_index_a;
+  SculptVertRef elem_index_a;
   float *elem_position_a;
 
-  int elem_index_b;
+  SculptVertRef elem_index_b;
   float *elem_position_b;
 
   float length;
@@ -342,7 +343,7 @@ typedef struct SculptPersistentBase {
 
 typedef struct SculptVertexInfo {
   /* Indexed by vertex, stores and ID of its topologically connected component. */
-  int *connected_component;
+  SculptVertRef *connected_component;
 
   /* Indexed by base mesh vertex index, stores if that vertex is a boundary. */
   BLI_bitmap *boundary;
@@ -350,7 +351,7 @@ typedef struct SculptVertexInfo {
 
 typedef struct SculptBoundaryEditInfo {
   /* Vertex index from where the topology propagation reached this vertex. */
-  int original_vertex;
+  SculptVertRef original_vertex;
 
   /* How many steps were needed to reach this vertex from the boundary. */
   int num_propagation_steps;
@@ -367,7 +368,7 @@ typedef struct SculptBoundaryPreviewEdge {
 
 typedef struct SculptBoundary {
   /* Vertex indices of the active boundary. */
-  int *vertices;
+  SculptVertRef *vertices;
   int vertices_capacity;
   int num_vertices;
 
@@ -385,12 +386,12 @@ typedef struct SculptBoundary {
   bool forms_loop;
 
   /* Initial vertex in the boundary which is closest to the current sculpt active vertex. */
-  int initial_vertex;
+  SculptVertRef initial_vertex;
 
   /* Vertex that at max_propagation_steps from the boundary and closest to the original active
    * vertex that was used to initialize the boundary. This is used as a reference to check how much
    * the deformation will go into the mesh and to calculate the strength of the brushes. */
-  int pivot_vertex;
+  SculptVertRef pivot_vertex;
 
   /* Stores the initial positions of the pivot and boundary initial vertex as they may be deformed
    * during the brush action. This allows to use them as a reference positions and vectors for some
@@ -430,7 +431,7 @@ typedef struct SculptFakeNeighbors {
   float current_max_distance;
 
   /* Indexed by vertex, stores the vertex index of its fake neighbor if available. */
-  int *fake_neighbor_index;
+  SculptVertRef *fake_neighbor_index;
 
 } SculptFakeNeighbors;
 
@@ -500,7 +501,7 @@ typedef struct SculptSession {
   struct FilterCache *filter_cache;
 
   /* Cursor data and active vertex for tools */
-  int active_vertex_index;
+  SculptVertRef active_vertex_index;
 
   int active_face_index;
   int active_grid_index;
@@ -520,6 +521,8 @@ typedef struct SculptSession {
   struct RegionView3D *rv3d;
   struct View3D *v3d;
   struct Scene *scene;
+  int cd_origco_offset;
+  int cd_origno_offset;
 
   /* Dynamic mesh preview */
   int *preview_vert_index_list;
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 86f615cadee..2567407f10b 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -26,16 +26,20 @@
 
 /* For embedding CCGKey in iterator. */
 #include "BKE_ccg.h"
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef int64_t SculptVertRef;
+
 struct BMLog;
 struct BMesh;
 struct CCGElem;
 struct CCGKey;
 struct CustomData;
+struct TableGSet;
 struct DMFlagMat;
 struct GPU_PBVH_Buffers;
 struct IsectRayPrecalc;
@@ -71,7 +75,7 @@ typedef struct ProxyVertArray {
   float (*fno)[3];
   short (*no)[3];
   float *mask, **ownermask;
-  int *index;
+  SculptVertRef *index;
   float **ownercolor, (*color)[4];
 
   ProxyKey (*neighbors)[MAX_PROXY_NEIGHBORS];
@@ -97,7 +101,7 @@ typedef enum {
 
 typedef struct ProxyVertUpdateRec {
   float *co, *no, *mask, *color;
-  int index, newindex;
+  SculptVertRef index, newindex;
 } ProxyVertUpdateRec;
 
 #  define PBVH_PROXY_DEFAULT CO | INDEX | MASK
@@ -113,7 +117,7 @@ void BKE_pbvh_ensure_proxyarray(
     struct PBVHNode *node,
     int mask,
     struct GHash
-        *vert_node_map,  // vert_node_map maps vertex SculptIdxs to PBVHNode indices; optional
+        *vert_node_map,  // vert_node_map maps vertex SculptVertRefs to PBVHNode indices; optional
     bool check_indexmap,
     bool force_update);
 void BKE_pbvh_gather_proxyarray(PBVH *pbvh, PBVHNode **nodes, int totnode);
@@ -150,6 +154,7 @@ typedef enum {
 
   PBVH_UpdateTopology = 1 << 13,
   PBVH_UpdateColor = 1 << 14,
+  PBVH_Delete = 1 << 15
 } PBVHNodeFlags;
 
 typedef struct PBVHFrustumPlanes {
@@ -196,7 +201,9 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh,
                           bool smooth_shading,
                           struct BMLog *log,
                           const int cd_vert_node_offset,
-                          const int cd_face_node_offset);
+                          const int cd_face_node_offset,
+                          const int cd_origco_offset,
+                          const int cd_origno_offset);
 void BKE_pbvh_free(PBVH *pbvh);
 
 /* Hierarchical Search in the BVH, two methods:
@@ -232,7 +239,7 @@ bool BKE_pbvh_node_raycast(PBVH *pbvh,
                            const float ray_normal[3],
                            struct IsectRayPrecalc *isect_precalc,
                            float *depth,
-                           int *active_vertex_index,
+                           SculptVertRef *active_vertex_index,
                            int *active_face_grid_index,
                            float *face_normal);
 
@@ -321,7 +328,8 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
                                     const float view_normal[3],
                                     float radius,
                                     const bool use_frontface,
-                                    const bool use_projected);
+                                    const bool use_projected,
+                                    int symaxis);
 
 /* Node Access */
 
@@ -363,9 +371,9 @@ bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, void *frustum);
 /* test if AABB is at least partially outside the PBVHFrustumPlanes volume */
 bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum);
 
-struct GSet *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node);
-struct GSet *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node);
-struct GSet *BKE_pbvh_bmesh_node_faces(PBVHNode *node);
+struct TableGSet *BKE_pbvh_bmesh_node_unique_verts(P

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list