[Bf-cycles] Bug in MeshManager::update_svm_attributes?

Thomas Krebs Thomas.Krebs at mecadtron.de
Thu May 17 16:52:10 CEST 2018


We are using Cycles within our application with huge data sets.
We didn't encounter any problems with memory so far.
After updating to the latest version 1.9 (we used some previous
unlabeled version before from about November last year) we
encounter a bad alloc exception. It happens using some bigger models,
with small models we don't see this happen...

Looking around (I do not know too much about the internals...)
I got suspicious about some code in MeshManager::update_svm_attributes:

It reads as:

void MeshManager::update_svm_attributes(Device *, DeviceScene *dscene, 
Scene *scene, vector<AttributeRequestSet>& mesh_attributes)
	/* for SVM, the attributes_map table is used to lookup the offset of an
	 * attribute, based on a unique shader attribute id. */

	/* compute array stride */
	int attr_map_size = 0;

	for(size_t i = 0; i < scene->meshes.size(); i++) {
		Mesh *mesh = scene->meshes[i];
		mesh->attr_map_offset = attr_map_size;
		attr_map_size += (mesh_attributes[i].size() + 1)*ATTR_PRIM_TYPES;

	if(attr_map_size == 0)

	/* create attribute map */
	uint4 *attr_map = 

In the last line the product doesn't seem necessary to me. I may be 
wrong, though.
I changed the line to:

	uint4 *attr_map = dscene->attributes_map.alloc(attr_map_size);

compiled and so far everyting works as expected, even with big data
sets. Can somebody check if this was a bug and fix it accordingly?

Best regards,
Mecadtron GmbH
Sitz der Gesellschaft: Nürnberg
Amtsgericht Nürnberg, HRB20209
Geschäftsführer: Dr. Thomas Krebs
Allersberger Str. 185
90461 Nürnberg
Tel.: +49 911 462369-0
Fax:  +49 911 462369-11

More information about the Bf-cycles mailing list