From e35f971da1903be3743f016aaf60fc4caf2fc055 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 12 Apr 2023 15:49:09 -0400 Subject: [PATCH] Mesh: Avoid unnecessarily initializing corner topology arrays This data should be initialized when building the mesh. If the arrays aren't already initialized, there is already a bug. Theoretically this could improve performance, since we can use `malloc` instead of `calloc`. In practice I observed less than a 1% difference though. --- source/blender/blenkernel/intern/mesh.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 3bad954f141..780064623a6 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -992,11 +992,11 @@ static void mesh_ensure_cdlayers_primary(Mesh &mesh) } if (!CustomData_get_layer_named(&mesh.ldata, CD_PROP_INT32, ".corner_vert")) { CustomData_add_layer_named( - &mesh.ldata, CD_PROP_INT32, CD_SET_DEFAULT, mesh.totloop, ".corner_vert"); + &mesh.ldata, CD_PROP_INT32, CD_CONSTRUCT, mesh.totloop, ".corner_vert"); } if (!CustomData_get_layer_named(&mesh.ldata, CD_PROP_INT32, ".corner_edge")) { CustomData_add_layer_named( - &mesh.ldata, CD_PROP_INT32, CD_SET_DEFAULT, mesh.totloop, ".corner_edge"); + &mesh.ldata, CD_PROP_INT32, CD_CONSTRUCT, mesh.totloop, ".corner_edge"); } }