[Bf-blender-cvs] [a83b2d3] master: Cycles: Fix wrong attribute count calculation in prevous commit

Sergey Sharybin noreply at git.blender.org
Sat Feb 14 22:57:24 CET 2015


Commit: a83b2d3fd93cde482db3cfe4f481a5ff7df49c63
Author: Sergey Sharybin
Date:   Sun Feb 15 02:55:18 2015 +0500
Branches: master
https://developer.blender.org/rBa83b2d3fd93cde482db3cfe4f481a5ff7df49c63

Cycles: Fix wrong attribute count calculation in prevous commit

The workaround for generated texture coordinates is to be done before
calculating number of elements for attribute, otherwise counter wouldn't
include those attributes.

===================================================================

M	intern/cycles/render/mesh.cpp

===================================================================

diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index e672aab..9c7310d 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -913,6 +913,16 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene,
 		foreach(AttributeRequest& req, attributes.requests) {
 			Attribute *triangle_mattr = mesh->attributes.find(req);
 			Attribute *curve_mattr = mesh->curve_attributes.find(req);
+
+			/* todo: get rid of this exception, it's only here for giving some
+			 * working texture coordinate for subdivision as we can't preserve
+			 * any attributes yet */
+			if(!triangle_mattr && req.std == ATTR_STD_GENERATED) {
+				triangle_mattr = mesh->attributes.add(ATTR_STD_GENERATED);
+				if(mesh->verts.size())
+					memcpy(triangle_mattr->data_float3(), &mesh->verts[0], sizeof(float3)*mesh->verts.size());
+			}
+
 			update_attribute_element_size(mesh,
 			                              triangle_mattr,
 			                              &attr_float_size,
@@ -945,15 +955,6 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene,
 			Attribute *triangle_mattr = mesh->attributes.find(req);
 			Attribute *curve_mattr = mesh->curve_attributes.find(req);
 
-			/* todo: get rid of this exception, it's only here for giving some
-			 * working texture coordinate for subdivision as we can't preserve
-			 * any attributes yet */
-			if(!triangle_mattr && req.std == ATTR_STD_GENERATED) {
-				triangle_mattr = mesh->attributes.add(ATTR_STD_GENERATED);
-				if(mesh->verts.size())
-					memcpy(triangle_mattr->data_float3(), &mesh->verts[0], sizeof(float3)*mesh->verts.size());
-			}
-
 			update_attribute_element_offset(mesh,
 			                                attr_float, attr_float_offset,
 			                                attr_float3, attr_float3_offset,




More information about the Bf-blender-cvs mailing list