diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-03 23:40:58 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-07 14:18:15 +0300 |
commit | d809853513c1333c9d9a22ab6ba35617b5ed2b8c (patch) | |
tree | 6c159a81df1f72c587a247ed31219705399a3788 /intern | |
parent | d9c5f0d25fc91b069158ae1ab4fddc21bfd85846 (diff) |
Cleanup: simplify Cycles primitive attribute map storage
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/geom/geom_attribute.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_motion_curve.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/attribute.cpp | 54 | ||||
-rw-r--r-- | intern/cycles/render/attribute.h | 11 | ||||
-rw-r--r-- | intern/cycles/render/geometry.cpp | 195 | ||||
-rw-r--r-- | intern/cycles/render/hair.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 12 |
9 files changed, 89 insertions, 206 deletions
diff --git a/intern/cycles/kernel/geom/geom_attribute.h b/intern/cycles/kernel/geom/geom_attribute.h index 456608bfa22..e1b0e6fb81c 100644 --- a/intern/cycles/kernel/geom/geom_attribute.h +++ b/intern/cycles/kernel/geom/geom_attribute.h @@ -29,17 +29,11 @@ ccl_device_inline uint subd_triangle_patch(KernelGlobals *kg, const ShaderData * ccl_device_inline uint attribute_primitive_type(KernelGlobals *kg, const ShaderData *sd) { -#ifdef __HAIR__ - if (sd->type & PRIMITIVE_ALL_CURVE) { - return ATTR_PRIM_CURVE; - } - else -#endif - if (subd_triangle_patch(kg, sd) != ~0) { + if ((sd->type & PRIMITIVE_ALL_TRIANGLE) && subd_triangle_patch(kg, sd) != ~0) { return ATTR_PRIM_SUBD; } else { - return ATTR_PRIM_TRIANGLE; + return ATTR_PRIM_GEOMETRY; } } diff --git a/intern/cycles/kernel/geom/geom_motion_curve.h b/intern/cycles/kernel/geom/geom_motion_curve.h index 7380c506bf4..0e2a00e9d2e 100644 --- a/intern/cycles/kernel/geom/geom_motion_curve.h +++ b/intern/cycles/kernel/geom/geom_motion_curve.h @@ -36,7 +36,7 @@ ccl_device_inline int find_attribute_curve_motion(KernelGlobals *kg, * zero iterations and rendering is really slow with motion curves. For until other * areas are speed up it's probably not so crucial to optimize this out. */ - uint attr_offset = object_attribute_map_offset(kg, object) + ATTR_PRIM_CURVE; + uint attr_offset = object_attribute_map_offset(kg, object) + ATTR_PRIM_GEOMETRY; uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset); while (attr_map.x != id) { diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 1e1d161ff9b..bf34450df4b 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -725,9 +725,8 @@ typedef enum PrimitiveType { /* Attributes */ typedef enum AttributePrimitive { - ATTR_PRIM_TRIANGLE = 0, + ATTR_PRIM_GEOMETRY = 0, ATTR_PRIM_SUBD, - ATTR_PRIM_CURVE, ATTR_PRIM_TYPES } AttributePrimitive; diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index db5ad06d3fc..0994bfaf950 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -382,10 +382,6 @@ int OSLShader::find_attribute(KernelGlobals *kg, { /* for OSL, a hash map is used to lookup the attribute by name. */ int object = sd->object * ATTR_PRIM_TYPES; -#ifdef __HAIR__ - if (sd->type & PRIMITIVE_ALL_CURVE) - object += ATTR_PRIM_CURVE; -#endif OSLGlobals::AttributeMap &attr_map = kg->osl->attribute_map[object]; ustring stdname(std::string("geom:") + diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index fcba901ae6c..05c0b5693bc 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -193,7 +193,7 @@ size_t Attribute::element_size(Geometry *geom, AttributePrimitive prim) const case ATTR_ELEMENT_FACE: if (geom->type == Geometry::MESH) { Mesh *mesh = static_cast<Mesh *>(geom); - if (prim == ATTR_PRIM_TRIANGLE) { + if (prim == ATTR_PRIM_GEOMETRY) { size = mesh->num_triangles(); } else { @@ -205,7 +205,7 @@ size_t Attribute::element_size(Geometry *geom, AttributePrimitive prim) const case ATTR_ELEMENT_CORNER_BYTE: if (geom->type == Geometry::MESH) { Mesh *mesh = static_cast<Mesh *>(geom); - if (prim == ATTR_PRIM_TRIANGLE) { + if (prim == ATTR_PRIM_GEOMETRY) { size = mesh->num_triangles() * 3; } else { @@ -390,11 +390,9 @@ void Attribute::get_uv_tiles(Geometry *geom, /* Attribute Set */ -AttributeSet::AttributeSet() +AttributeSet::AttributeSet(Geometry *geometry, AttributePrimitive prim) + : geometry(geometry), prim(prim) { - triangle_mesh = NULL; - subd_mesh = NULL; - hair = NULL; } AttributeSet::~AttributeSet() @@ -428,12 +426,7 @@ Attribute *AttributeSet::add(ustring name, TypeDesc type, AttributeElement eleme #endif /* this is weak .. */ - if (triangle_mesh) - attr->resize(triangle_mesh, ATTR_PRIM_TRIANGLE, false); - if (subd_mesh) - attr->resize(subd_mesh, ATTR_PRIM_SUBD, false); - if (hair) - attr->resize(hair, ATTR_PRIM_CURVE, false); + attr->resize(geometry, prim, false); return attr; } @@ -470,7 +463,7 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name) if (name == ustring()) name = Attribute::standard_name(std); - if (triangle_mesh || subd_mesh) { + if (geometry->type == Geometry::MESH) { switch (std) { case ATTR_STD_VERTEX_NORMAL: attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX); @@ -530,7 +523,7 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name) break; } } - else if (hair) { + else if (geometry->type == Geometry::HAIR) { switch (std) { case ATTR_STD_UV: attr = add(name, TypeFloat2, ATTR_ELEMENT_CURVE); @@ -613,12 +606,7 @@ void AttributeSet::remove(Attribute *attribute) void AttributeSet::resize(bool reserve_only) { foreach (Attribute &attr, attributes) { - if (triangle_mesh) - attr.resize(triangle_mesh, ATTR_PRIM_TRIANGLE, reserve_only); - if (subd_mesh) - attr.resize(subd_mesh, ATTR_PRIM_SUBD, reserve_only); - if (hair) - attr.resize(hair, ATTR_PRIM_CURVE, reserve_only); + attr.resize(geometry, prim, reserve_only); } } @@ -648,15 +636,10 @@ AttributeRequest::AttributeRequest(ustring name_) name = name_; std = ATTR_STD_NONE; - triangle_type = TypeDesc::TypeFloat; - triangle_desc.element = ATTR_ELEMENT_NONE; - triangle_desc.offset = 0; - triangle_desc.type = NODE_ATTR_FLOAT; - - curve_type = TypeDesc::TypeFloat; - curve_desc.element = ATTR_ELEMENT_NONE; - curve_desc.offset = 0; - curve_desc.type = NODE_ATTR_FLOAT; + type = TypeDesc::TypeFloat; + desc.element = ATTR_ELEMENT_NONE; + desc.offset = 0; + desc.type = NODE_ATTR_FLOAT; subd_type = TypeDesc::TypeFloat; subd_desc.element = ATTR_ELEMENT_NONE; @@ -669,15 +652,10 @@ AttributeRequest::AttributeRequest(AttributeStandard std_) name = ustring(); std = std_; - triangle_type = TypeDesc::TypeFloat; - triangle_desc.element = ATTR_ELEMENT_NONE; - triangle_desc.offset = 0; - triangle_desc.type = NODE_ATTR_FLOAT; - - curve_type = TypeDesc::TypeFloat; - curve_desc.element = ATTR_ELEMENT_NONE; - curve_desc.offset = 0; - curve_desc.type = NODE_ATTR_FLOAT; + type = TypeDesc::TypeFloat; + desc.element = ATTR_ELEMENT_NONE; + desc.offset = 0; + desc.type = NODE_ATTR_FLOAT; subd_type = TypeDesc::TypeFloat; subd_desc.element = ATTR_ELEMENT_NONE; diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h index d4bf630aeb6..f1fd30fd85a 100644 --- a/intern/cycles/render/attribute.h +++ b/intern/cycles/render/attribute.h @@ -170,12 +170,11 @@ class Attribute { class AttributeSet { public: - Mesh *triangle_mesh; - Mesh *subd_mesh; - Hair *hair; + Geometry *geometry; + AttributePrimitive prim; list<Attribute> attributes; - AttributeSet(); + AttributeSet(Geometry *geometry, AttributePrimitive prim); ~AttributeSet(); Attribute *add(ustring name, TypeDesc type, AttributeElement element); @@ -206,8 +205,8 @@ class AttributeRequest { AttributeStandard std; /* temporary variables used by GeometryManager */ - TypeDesc triangle_type, curve_type, subd_type; - AttributeDescriptor triangle_desc, curve_desc, subd_desc; + TypeDesc type, subd_type; + AttributeDescriptor desc, subd_desc; explicit AttributeRequest(ustring name_); explicit AttributeRequest(AttributeStandard std); diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index a75a114e4f2..880fb7b4c7d 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -56,7 +56,8 @@ NODE_ABSTRACT_DEFINE(Geometry) return type; } -Geometry::Geometry(const NodeType *node_type, const Type type) : Node(node_type), type(type) +Geometry::Geometry(const NodeType *node_type, const Type type) + : Node(node_type), type(type), attributes(this, ATTR_PRIM_GEOMETRY) { need_update = true; need_update_rebuild = false; @@ -300,9 +301,8 @@ void GeometryManager::update_osl_attributes(Device *device, osl_attr.desc.offset = 0; osl_attr.desc.flags = 0; - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_TRIANGLE][attr.name()] = osl_attr; + og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_GEOMETRY][attr.name()] = osl_attr; og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_SUBD][attr.name()] = osl_attr; - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_CURVE][attr.name()] = osl_attr; } /* find geometry attributes */ @@ -318,16 +318,16 @@ void GeometryManager::update_osl_attributes(Device *device, foreach (AttributeRequest &req, attributes.requests) { OSLGlobals::Attribute osl_attr; - if (req.triangle_desc.element != ATTR_ELEMENT_NONE) { - osl_attr.desc = req.triangle_desc; + if (req.desc.element != ATTR_ELEMENT_NONE) { + osl_attr.desc = req.desc; - if (req.triangle_type == TypeDesc::TypeFloat) + if (req.type == TypeDesc::TypeFloat) osl_attr.type = TypeDesc::TypeFloat; - else if (req.triangle_type == TypeDesc::TypeMatrix) + else if (req.type == TypeDesc::TypeMatrix) osl_attr.type = TypeDesc::TypeMatrix; - else if (req.triangle_type == TypeFloat2) + else if (req.type == TypeFloat2) osl_attr.type = TypeFloat2; - else if (req.triangle_type == TypeRGBA) + else if (req.type == TypeRGBA) osl_attr.type = TypeRGBA; else osl_attr.type = TypeDesc::TypeColor; @@ -335,36 +335,11 @@ void GeometryManager::update_osl_attributes(Device *device, if (req.std != ATTR_STD_NONE) { /* if standard attribute, add lookup by geom: name convention */ ustring stdname(string("geom:") + string(Attribute::standard_name(req.std))); - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_TRIANGLE][stdname] = osl_attr; + og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_GEOMETRY][stdname] = osl_attr; } else if (req.name != ustring()) { /* add lookup by geometry attribute name */ - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_TRIANGLE][req.name] = osl_attr; - } - } - - if (req.curve_desc.element != ATTR_ELEMENT_NONE) { - osl_attr.desc = req.curve_desc; - - if (req.curve_type == TypeDesc::TypeFloat) - osl_attr.type = TypeDesc::TypeFloat; - else if (req.curve_type == TypeDesc::TypeMatrix) - osl_attr.type = TypeDesc::TypeMatrix; - else if (req.curve_type == TypeFloat2) - osl_attr.type = TypeFloat2; - else if (req.curve_type == TypeRGBA) - osl_attr.type = TypeRGBA; - else - osl_attr.type = TypeDesc::TypeColor; - - if (req.std != ATTR_STD_NONE) { - /* if standard attribute, add lookup by geom: name convention */ - ustring stdname(string("geom:") + string(Attribute::standard_name(req.std))); - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_CURVE][stdname] = osl_attr; - } - else if (req.name != ustring()) { - /* add lookup by geometry attribute name */ - og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_CURVE][req.name] = osl_attr; + og->attribute_map[i * ATTR_PRIM_TYPES + ATTR_PRIM_GEOMETRY][req.name] = osl_attr; } } @@ -440,27 +415,22 @@ void GeometryManager::update_svm_attributes(Device *, else id = scene->shader_manager->get_attribute_id(req.std); - if (geom->type == Geometry::MESH) { - Mesh *mesh = static_cast<Mesh *>(geom); - if (mesh->num_triangles()) { - attr_map[index].x = id; - attr_map[index].y = req.triangle_desc.element; - attr_map[index].z = as_uint(req.triangle_desc.offset); - - if (req.triangle_type == TypeDesc::TypeFloat) - attr_map[index].w = NODE_ATTR_FLOAT; - else if (req.triangle_type == TypeDesc::TypeMatrix) - attr_map[index].w = NODE_ATTR_MATRIX; - else if (req.triangle_type == TypeFloat2) - attr_map[index].w = NODE_ATTR_FLOAT2; - else if (req.triangle_type == TypeRGBA) - attr_map[index].w = NODE_ATTR_RGBA; - else - attr_map[index].w = NODE_ATTR_FLOAT3; + attr_map[index].x = id; + attr_map[index].y = req.desc.element; + attr_map[index].z = as_uint(req.desc.offset); + + if (req.type == TypeDesc::TypeFloat) + attr_map[index].w = NODE_ATTR_FLOAT; + else if (req.type == TypeDesc::TypeMatrix) + attr_map[index].w = NODE_ATTR_MATRIX; + else if (req.type == TypeFloat2) + attr_map[index].w = NODE_ATTR_FLOAT2; + else if (req.type == TypeRGBA) + attr_map[index].w = NODE_ATTR_RGBA; + else + attr_map[index].w = NODE_ATTR_FLOAT3; - attr_map[index].w |= req.triangle_desc.flags << 8; - } - } + attr_map[index].w |= req.desc.flags << 8; index++; @@ -477,7 +447,7 @@ void GeometryManager::update_svm_attributes(Device *, attr_map[index].w = NODE_ATTR_MATRIX; else if (req.subd_type == TypeFloat2) attr_map[index].w = NODE_ATTR_FLOAT2; - else if (req.triangle_type == TypeRGBA) + else if (req.subd_type == TypeRGBA) attr_map[index].w = NODE_ATTR_RGBA; else attr_map[index].w = NODE_ATTR_FLOAT3; @@ -487,28 +457,6 @@ void GeometryManager::update_svm_attributes(Device *, } index++; - - if (geom->type == Geometry::HAIR) { - Hair *hair = static_cast<Hair *>(geom); - if (hair->num_curves()) { - attr_map[index].x = id; - attr_map[index].y = req.curve_desc.element; - attr_map[index].z = as_uint(req.curve_desc.offset); - - if (req.curve_type == TypeDesc::TypeFloat) - attr_map[index].w = NODE_ATTR_FLOAT; - else if (req.curve_type == TypeDesc::TypeMatrix) - attr_map[index].w = NODE_ATTR_MATRIX; - else if (req.curve_type == TypeFloat2) - attr_map[index].w = NODE_ATTR_FLOAT2; - else - attr_map[index].w = NODE_ATTR_FLOAT3; - - attr_map[index].w |= req.curve_desc.flags << 8; - } - } - - index++; } /* terminator */ @@ -654,13 +602,13 @@ static void update_attribute_element_offset(Geometry *geom, else if (element == ATTR_ELEMENT_VERTEX_MOTION) offset -= mesh->vert_offset; else if (element == ATTR_ELEMENT_FACE) { - if (prim == ATTR_PRIM_TRIANGLE) + if (prim == ATTR_PRIM_GEOMETRY) offset -= mesh->prim_offset; else offset -= mesh->face_offset; } else if (element == ATTR_ELEMENT_CORNER || element == ATTR_ELEMENT_CORNER_BYTE) { - if (prim == ATTR_PRIM_TRIANGLE) + if (prim == ATTR_PRIM_GEOMETRY) offset -= 3 * mesh->prim_offset; else offset -= mesh->corner_offset; @@ -720,38 +668,28 @@ void GeometryManager::device_update_attributes(Device *device, Geometry *geom = scene->geometry[i]; AttributeRequestSet &attributes = geom_attributes[i]; foreach (AttributeRequest &req, attributes.requests) { + Attribute *attr = geom->attributes.find(req); + + update_attribute_element_size(geom, + attr, + ATTR_PRIM_GEOMETRY, + &attr_float_size, + &attr_float2_size, + &attr_float3_size, + &attr_uchar4_size); + if (geom->type == Geometry::MESH) { Mesh *mesh = static_cast<Mesh *>(geom); - Attribute *triangle_mattr = mesh->attributes.find(req); - Attribute *subd_mattr = mesh->subd_attributes.find(req); + Attribute *subd_attr = mesh->subd_attributes.find(req); update_attribute_element_size(mesh, - triangle_mattr, - ATTR_PRIM_TRIANGLE, - &attr_float_size, - &attr_float2_size, - &attr_float3_size, - &attr_uchar4_size); - update_attribute_element_size(mesh, - subd_mattr, + subd_attr, ATTR_PRIM_SUBD, &attr_float_size, &attr_float2_size, &attr_float3_size, &attr_uchar4_size); } - else if (geom->type == Geometry::HAIR) { - Hair *hair = static_cast<Hair *>(geom); - Attribute *curve_mattr = hair->attributes.find(req); - - update_attribute_element_size(hair, - curve_mattr, - ATTR_PRIM_CURVE, - &attr_float_size, - &attr_float2_size, - &attr_float3_size, - &attr_uchar4_size); - } } } @@ -773,10 +711,24 @@ void GeometryManager::device_update_attributes(Device *device, /* todo: we now store std and name attributes from requests even if * they actually refer to the same mesh attributes, optimize */ foreach (AttributeRequest &req, attributes.requests) { + Attribute *attr = geom->attributes.find(req); + update_attribute_element_offset(geom, + dscene->attributes_float, + attr_float_offset, + dscene->attributes_float2, + attr_float2_offset, + dscene->attributes_float3, + attr_float3_offset, + dscene->attributes_uchar4, + attr_uchar4_offset, + attr, + ATTR_PRIM_GEOMETRY, + req.type, + req.desc); + if (geom->type == Geometry::MESH) { Mesh *mesh = static_cast<Mesh *>(geom); - Attribute *triangle_mattr = mesh->attributes.find(req); - Attribute *subd_mattr = mesh->subd_attributes.find(req); + Attribute *subd_attr = mesh->subd_attributes.find(req); update_attribute_element_offset(mesh, dscene->attributes_float, @@ -787,42 +739,11 @@ void GeometryManager::device_update_attributes(Device *device, attr_float3_offset, dscene->attributes_uchar4, attr_uchar4_offset, - triangle_mattr, - ATTR_PRIM_TRIANGLE, - req.triangle_type, - req.triangle_desc); - update_attribute_element_offset(mesh, - dscene->attributes_float, - attr_float_offset, - dscene->attributes_float2, - attr_float2_offset, - dscene->attributes_float3, - attr_float3_offset, - dscene->attributes_uchar4, - attr_uchar4_offset, - subd_mattr, + subd_attr, ATTR_PRIM_SUBD, req.subd_type, req.subd_desc); } - else if (geom->type == Geometry::HAIR) { - Hair *hair = static_cast<Hair *>(geom); - Attribute *curve_mattr = hair->attributes.find(req); - - update_attribute_element_offset(hair, - dscene->attributes_float, - attr_float_offset, - dscene->attributes_float2, - attr_float2_offset, - dscene->attributes_float3, - attr_float3_offset, - dscene->attributes_uchar4, - attr_uchar4_offset, - curve_mattr, - ATTR_PRIM_CURVE, - req.curve_type, - req.curve_desc); - } if (progress.get_cancel()) return; diff --git a/intern/cycles/render/hair.cpp b/intern/cycles/render/hair.cpp index a35d4b6f1da..7220fe7093b 100644 --- a/intern/cycles/render/hair.cpp +++ b/intern/cycles/render/hair.cpp @@ -294,8 +294,6 @@ NODE_DEFINE(Hair) Hair::Hair() : Geometry(node_type, Geometry::HAIR) { curvekey_offset = 0; - - attributes.hair = this; } Hair::~Hair() @@ -368,7 +366,7 @@ void Hair::get_uv_tiles(ustring map, unordered_set<int> &tiles) } if (attr) { - attr->get_uv_tiles(this, ATTR_PRIM_CURVE, tiles); + attr->get_uv_tiles(this, ATTR_PRIM_GEOMETRY, tiles); } } diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 792848e744a..e80e87f2980 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -135,7 +135,7 @@ NODE_DEFINE(Mesh) return type; } -Mesh::Mesh() : Geometry(node_type, Geometry::MESH) +Mesh::Mesh() : Geometry(node_type, Geometry::MESH), subd_attributes(this, ATTR_PRIM_SUBD) { vert_offset = 0; @@ -145,9 +145,6 @@ Mesh::Mesh() : Geometry(node_type, Geometry::MESH) num_subd_verts = 0; - attributes.triangle_mesh = this; - subd_attributes.subd_mesh = this; - volume_isovalue = 0.001f; num_ngons = 0; @@ -329,7 +326,9 @@ void Mesh::get_uv_tiles(ustring map, unordered_set<int> &tiles) } if (attr) { - attr->get_uv_tiles(this, ATTR_PRIM_TRIANGLE, tiles); + attr->get_uv_tiles(this, ATTR_PRIM_GEOMETRY, tiles); + } + if (subd_attr) { subd_attr->get_uv_tiles(this, ATTR_PRIM_SUBD, tiles); } } @@ -546,8 +545,7 @@ void Mesh::add_undisplaced() float3 *data = attr->data_float3(); /* copy verts */ - size_t size = attr->buffer_size( - this, (subdivision_type == SUBDIVISION_NONE) ? ATTR_PRIM_TRIANGLE : ATTR_PRIM_SUBD); + size_t size = attr->buffer_size(this, attrs.prim); /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will * be calculated later, we subtract them from size here so we don't have an overflow while |