[Bf-blender-cvs] [21d4c9e] temp-cycles-microdisplacement: Fix performance regression during mesh sync
Mai Lavelle
noreply at git.blender.org
Mon Jul 11 01:12:25 CEST 2016
Commit: 21d4c9e649cc7f2e721938cd0534a5a28cc9ba51
Author: Mai Lavelle
Date: Sun Jul 10 19:04:36 2016 -0400
Branches: temp-cycles-microdisplacement
https://developer.blender.org/rB21d4c9e649cc7f2e721938cd0534a5a28cc9ba51
Fix performance regression during mesh sync
The switch from std::vector to ccl::array in Mesh caused quite a big slowdown
during mesh sync. Using a quick fix for now. Proper thing to do would be to
avoid most memory allocation in subd code.
===================================================================
M intern/cycles/subd/subd_dice.cpp
===================================================================
diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp
index d99050c..f2d44d7 100644
--- a/intern/cycles/subd/subd_dice.cpp
+++ b/intern/cycles/subd/subd_dice.cpp
@@ -48,6 +48,11 @@ void EdgeDice::reserve(int num_verts)
vert_offset = mesh->verts.size();
tri_offset = mesh->num_triangles();
+ /* todo: optimize so we can reserve in advance, this is like push_back_slow() */
+ if(vert_offset + num_verts > mesh->verts.capacity()) {
+ mesh->reserve_mesh(size_t((vert_offset + num_verts) * 1.2), mesh->num_triangles());
+ }
+
mesh->resize_mesh(vert_offset + num_verts, tri_offset);
Attribute *attr_vN = mesh->attributes.add(ATTR_STD_VERTEX_NORMAL);
More information about the Bf-blender-cvs
mailing list