<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
Yes I did, I'll post a minimal reproducible example using Cycles standalone, all this changes should be performed on cycles_standalone.cpp file:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<div><br>
</div>
<div>//--add this to headers</div>
<div>#include "render/object.h"</div>
<div>#include "render/mesh.h"</div>
<div>#include "subd/subd_dice.h"</div>
<br>
<br>
//--function definition
<div>ccl::Mesh* createSubdMesh(Scene *scene)</div>
<div>{</div>
<div><span style="white-space:pre"></span>scene->mutex.lock();</div>
<div><span style="white-space:pre"></span>Mesh *mesh = new Mesh();</div>
<div><span style="white-space:pre"></span>scene->meshes.push_back(mesh);</div>
<div><span style="white-space:pre"></span>mesh->name = ccl::ustring("MyMeshName");</div>
<div><span style="white-space:pre"></span>mesh->subdivision_type = Mesh::SUBDIVISION_LINEAR;</div>
<div><span style="white-space:pre"></span>int numVertex = 10; //higher numbers like 1000 will crash the app</div>
<div><span style="white-space:pre"></span>mesh->verts.resize(numVertex);</div>
<div><span style="white-space:pre"></span>for (int i = 0; i<numVertex; i++)</div>
<div><span style="white-space:pre"></span>mesh->verts[i] = ccl::make_float3(0, 0, 0);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>int indices[3];</div>
<div><span style="white-space:pre"></span>indices[0] = 0;</div>
<div><span style="white-space:pre"></span>indices[1] = 1;</div>
<div><span style="white-space:pre"></span>indices[2] = 2;</div>
<div><span style="white-space:pre"></span>mesh->reserve_subd_faces(1, 0, 3);</div>
<div><span style="white-space:pre"></span>mesh->add_subd_face(indices, 3, 0, false);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>if (!mesh->subd_params) {</div>
<div><span style="white-space:pre"></span>mesh->subd_params = new SubdParams(mesh);</div>
<div><span style="white-space:pre"></span>}</div>
<div><span style="white-space:pre"></span>SubdParams& sdparams = *mesh->subd_params;</div>
<div><span style="white-space:pre"></span>sdparams.camera = scene->camera;</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>Object *object = new Object();</div>
<div><span style="white-space:pre"></span>object->mesh = mesh;</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>scene->objects.push_back(object);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>mesh->tag_update(scene, true);</div>
<div><span style="white-space:pre"></span>object->tag_update(scene);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>scene->mutex.unlock();</div>
<div><span style="white-space:pre"></span>return mesh;</div>
<div>}</div>
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
At the end of the already existing funcion scene_init()<br>
<span style="background-color: rgba(0, 0, 0, 0); white-space: pre;"></span><span style="background-color: rgba(0, 0, 0, 0);">createSubdMesh(options.scene);<br>
</span><br>
As I said it only crashes in a higher amount of vertex, it has nothing to do with memory limits and so.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
Regards, F.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Bf-cycles <bf-cycles-bounces@blender.org> en nombre de Mohamed Sakr <3dsakr@gmail.com><br>
<b>Enviado:</b> sábado, 3 de marzo de 2018 14:29<br>
<b>Para:</b> Discussion list to assist Cycles render engine developers<br>
<b>Asunto:</b> Re: [Bf-cycles] Crash on higher vertex count with subd</font>
<div> </div>
</div>
<div>
<div dir="ltr">did you do mesh->tag_update and object->tag_update?</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Sat, Mar 3, 2018 at 10:26 AM, F Escobar <span dir="ltr">
<<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
@Mohamed <span style="color:rgb(33,33,33); font-size:15px; font-style:normal; font-weight:400">Mesh::add_vertex has the same problem<br>
<br>
@Brecht I'll try to figure how to do that, if it helps the call stack points to </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33); font-size:15px; font-style:normal; font-weight:400">cycles.exe!_malloc_base Line 34</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
<span style="color:rgb(33,33,33); font-size:15px; font-style:normal; font-weight:400">cycles.exe!_aligned_offset_<wbr>malloc_base line 133</span></div>
<hr style="display:inline-block; width:98%">
<div id="x_m_4241246529915457965divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> Bf-cycles <<a href="mailto:bf-cycles-bounces@blender.org" target="_blank">bf-cycles-bounces@blender.org</a><wbr>> en
 nombre de Brecht Van Lommel <<a href="mailto:brechtvanlommel@pandora.be" target="_blank">brechtvanlommel@pandora.be</a>><br>
<b>Enviado:</b> viernes, 2 de marzo de 2018 19:08<br>
<b>Para:</b> Discussion list to assist Cycles render engine developers<br>
<b>Asunto:</b> Re: [Bf-cycles] Crash on higher vertex count with subd</font>
<div> </div>
</div>
<div>
<div class="x_h5">
<div>
<div dir="ltr">Do you have a backtrace of the crash? I can't immediately think of a reason this would happen.</div>
<div class="x_m_4241246529915457965x_gmail_extra"><br>
<div class="x_m_4241246529915457965x_gmail_quote">On Fri, Mar 2, 2018 at 2:33 PM, F Escobar
<span dir="ltr"><<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br>
<blockquote class="x_m_4241246529915457965x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
I've tried to create a super basic subd mesh with this code</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgba(0,0,0,0)">
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>mesh->subdivision_type = ccl::Mesh::SUBDIVISION_LINEAR;</div>
<div><span style="white-space:pre-wrap"></span>int numVertex = 3000;</div>
<div><span style="white-space:pre-wrap"></span>mesh->verts.resize(numVertex);</div>
<div><span style="white-space:pre-wrap"></span>printf("resized %i\n", numVertex);</div>
<div><span style="white-space:pre-wrap"></span>for(int i=0;i<numVertex;i++)</div>
<div><span style="white-space:pre-wrap"></span>mesh->verts[i] = ccl::make_float3(0, 0, 0);</div>
<div></div>
<div><br>
</div>
<div><span style="font-style:normal; font-weight:400; font-size:16px; font-family:Calibri,Helvetica,sans-serif; color:rgb(0,0,0); white-space:pre-wrap"></span>int indices[3];</div>
<div><span style="white-space:pre-wrap"></span>indices[0] = 0;</div>
<div><span style="white-space:pre-wrap"></span>indices[1] = 1;</div>
<div><span style="white-space:pre-wrap"></span>indices[2] = 2;</div>
<div><span style="white-space:pre-wrap"></span>mesh->reserve_subd_faces(1, 0, 3);</div>
<div><span style="white-space:pre-wrap"></span>mesh->add_subd_face(indices, 3, 0, false);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>if (!mesh->subd_params) {</div>
<div><span style="white-space:pre-wrap"></span>mesh->subd_params = new ccl::SubdParams(mesh);</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><span style="white-space:pre-wrap"></span>ccl::SubdParams& sdparams = *mesh->subd_params;</div>
<div><span style="white-space:pre-wrap"></span>sdparams.camera = scene->camera;
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::Object *object = new ccl::Object();</div>
<div><span style="white-space:pre-wrap"></span>object->mesh = mesh;</div>
<div><span style="white-space:pre-wrap"></span>scene->objects.push_back(objec<wbr>t);</div>
<div><br>
</div>
<div>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<br>
<br>
If I change <span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">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.</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400"><br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">Any idea on this?</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400"><br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:400">Regards, F.</span></div>
</div>
<br>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/<wbr>mailman/listinfo/bf-cycles</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>