[Bf-cycles] Crash on higher vertex count with subd

F Escobar materialesescobar at hotmail.es
Mon Mar 5 09:24:11 CET 2018


Yes I did, I'll post a minimal reproducible example using Cycles standalone, all this changes should be performed on cycles_standalone.cpp file:


//--add this to headers
#include "render/object.h"
#include "render/mesh.h"
#include "subd/subd_dice.h"


//--function definition
ccl::Mesh* createSubdMesh(Scene *scene)
{
scene->mutex.lock();
Mesh *mesh = new Mesh();
scene->meshes.push_back(mesh);
mesh->name = ccl::ustring("MyMeshName");
mesh->subdivision_type = Mesh::SUBDIVISION_LINEAR;
int numVertex = 10; //higher numbers like 1000 will crash the app
mesh->verts.resize(numVertex);
for (int i = 0; i<numVertex; i++)
mesh->verts[i] = ccl::make_float3(0, 0, 0);

int indices[3];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
mesh->reserve_subd_faces(1, 0, 3);
mesh->add_subd_face(indices, 3, 0, false);

if (!mesh->subd_params) {
mesh->subd_params = new SubdParams(mesh);
}
SubdParams& sdparams = *mesh->subd_params;
sdparams.camera = scene->camera;

Object *object = new Object();
object->mesh = mesh;

scene->objects.push_back(object);

mesh->tag_update(scene, true);
object->tag_update(scene);

scene->mutex.unlock();
return mesh;
}


At the end of the already existing funcion scene_init()
createSubdMesh(options.scene);

As I said it only crashes in a higher amount of vertex, it has nothing to do with memory limits and so.



Regards, F.

________________________________
De: Bf-cycles <bf-cycles-bounces at blender.org> en nombre de Mohamed Sakr <3dsakr at gmail.com>
Enviado: sábado, 3 de marzo de 2018 14:29
Para: Discussion list to assist Cycles render engine developers
Asunto: Re: [Bf-cycles] Crash on higher vertex count with subd

did you do mesh->tag_update and object->tag_update?

On Sat, Mar 3, 2018 at 10:26 AM, F Escobar <materialesescobar at hotmail.es<mailto:materialesescobar at hotmail.es>> wrote:
@Mohamed Mesh::add_vertex has the same problem

@Brecht I'll try to figure how to do that, if it helps the call stack points to
cycles.exe!_malloc_base Line 34
cycles.exe!_aligned_offset_malloc_base line 133
________________________________
De: Bf-cycles <bf-cycles-bounces at blender.org<mailto:bf-cycles-bounces at blender.org>> en nombre de Brecht Van Lommel <brechtvanlommel at pandora.be<mailto:brechtvanlommel at pandora.be>>
Enviado: viernes, 2 de marzo de 2018 19:08
Para: Discussion list to assist Cycles render engine developers
Asunto: Re: [Bf-cycles] Crash on higher vertex count with subd

Do you have a backtrace of the crash? I can't immediately think of a reason this would happen.

On Fri, Mar 2, 2018 at 2:33 PM, F Escobar <materialesescobar at hotmail.es<mailto:materialesescobar at hotmail.es>> wrote:
I've tried to create a super basic subd mesh with this code

mesh->subdivision_type = ccl::Mesh::SUBDIVISION_LINEAR;
int numVertex = 3000;
mesh->verts.resize(numVertex);
printf("resized %i\n", numVertex);
for(int i=0;i<numVertex;i++)
mesh->verts[i] = ccl::make_float3(0, 0, 0);

int indices[3];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
mesh->reserve_subd_faces(1, 0, 3);
mesh->add_subd_face(indices, 3, 0, false);

if (!mesh->subd_params) {
mesh->subd_params = new ccl::SubdParams(mesh);
}
ccl::SubdParams& sdparams = *mesh->subd_params;
sdparams.camera = scene->camera;

ccl::Object *object = new ccl::Object();
object->mesh = mesh;
scene->objects.push_back(object);

And yes... it only should generate one triangle, btw it shouldn't be rendered since all the vertex are in the same place (0,0,0) but that is not the question

If I change numVertex  from 3000 to 300 it doesn't crash so it is related to the amount of vertex but anyway 3k is a pretty low amount.

Any idea on this?

Regards, F.


_______________________________________________
Bf-cycles mailing list
Bf-cycles at blender.org<mailto:Bf-cycles at blender.org>
https://lists.blender.org/mailman/listinfo/bf-cycles



_______________________________________________
Bf-cycles mailing list
Bf-cycles at blender.org<mailto: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/20180305/8d169297/attachment.html>


More information about the Bf-cycles mailing list