Cycles: Optimize out default normals setups in case of OPENSUBDIV Catmull-Clark
Simple local optimization: not doing the rather expensive normals setups (face and vertex) for Catmull-Clark subsivisions (which do not make use of these normals and regenerate them internally). Pull Request: https://projects.blender.org/blender/blender/pulls/132469
This commit is contained in:
committed by
Sergey Sharybin
parent
4546367bb3
commit
ddbb3d673c
@@ -734,17 +734,26 @@ void GeometryManager::device_update(Device *device,
|
||||
if (geom->is_mesh() || geom->is_volume()) {
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
|
||||
/* Update normals. */
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
|
||||
if (mesh->need_attribute(scene, ATTR_STD_POSITION_UNDISPLACED)) {
|
||||
mesh->add_undisplaced();
|
||||
}
|
||||
|
||||
/* Test if we need tessellation. */
|
||||
/* Test if we need tessellation and setup normals if required. */
|
||||
if (mesh->need_tesselation()) {
|
||||
total_tess_needed++;
|
||||
/* OPENSUBDIV Catmull-Clark does not make use of input normals and will overwrite them.
|
||||
*/
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
if (mesh->get_subdivision_type() != Mesh::SUBDIVISION_CATMULL_CLARK)
|
||||
#endif
|
||||
{
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
}
|
||||
}
|
||||
else {
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
}
|
||||
|
||||
/* Test if we need displacement. */
|
||||
|
||||
Reference in New Issue
Block a user