Small performance improvement for subsurf

r43572: Skip subsurf normal allocation/calculation when not needed.

CCGSubsurf, the code behind the subsurf modifier, stores “grids” of subdivided data, one grid for each corner of a face. Each element of the grid contains a coordinate stored as three floats. It can also calculate normals, adding another three floats to each element.

When a mesh has UV layers, the subsurf modifier can (optionally) subdivide UV coordinates. This is done as a separate calculation from subdivision of the mesh’s face/edge data, because the connectivity of faces might look different from the UV perspective (think seams.) Because of this difference, a whole new CCGSubsurf object is created, calculated, and destroyed for each UV layer.

The change introduced in this commit is to simply disable normals calculation when it’s not needed (as in the case of UV layers.) So subdivision should runs a little bit faster and uses a little bit less memory (only during subdivision itself though; the output will use the same amount of memory, so the “Mem” number in the header will look the same.)


Since I have this domain, figure I might as well use it for something more than a static page of old patches.

Dunno yet how much I’ll post here, but I expect to use it for the occasional Blender-related post that is shorter and of less importance than what I’d post on

And probably some ranty posts and cat pictures as well, this being the Internet and all. (Standard disclaimer: I don’t actually have a cat.)