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

Brecht Van Lommel brechtvanlommel at gmail.com
Mon May 21 11:22:54 CEST 2018


Hi,

It's indeed a bug, thanks a lot for finding this! I'll commit the fix
shortly.

Regards,
Brecht.

On Thu, May 17, 2018 at 4:52 PM, Thomas Krebs <Thomas.Krebs at mecadtron.de>
wrote:

> Hi,
>
> 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)
>                 return;
>
>         /* create attribute map */
>         uint4 *attr_map = dscene->attributes_map.alloc(a
> ttr_map_size*scene->meshes.size());
>
>
> 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,
> Thomas
> --
> Mecadtron GmbH
> Sitz der Gesellschaft: Nürnberg
> Amtsgericht Nürnberg, HRB20209
> Geschäftsführer: Dr. Thomas Krebs
> Allersberger Str. 185
> 90461 Nürnberg
> Germany
> Tel.: +49 911 462369-0
> Fax:  +49 911 462369-11
> www.mecadtron.de
> www.mecadtron.com
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> https://lists.blender.org/mailman/listinfo/bf-cycles
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-cycles/attachments/20180521/65c303f4/attachment.html>


More information about the Bf-cycles mailing list