Change GPU deletion at GPU buffer update time. This should be detected

and done at PBVH update time, since it is possible to have no triangles
to display in a buffer if node is hidden.
This commit is contained in:
Antonis Ryakiotakis 2014-04-11 03:16:16 +03:00
parent 69d2af7643
commit 52af5fa31f
Notes: blender-bot 2023-02-14 11:25:11 +01:00
Referenced by commit 3a20c056e8, Fix T58920: Dyntopo sculpt and snake hook brush artifacts.
Referenced by issue #65523, Dyntopo + Snake tool produce weird artifacts after grab tool
1 changed files with 1 additions and 9 deletions

View File

@ -2096,15 +2096,7 @@ void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
else
totvert = tottri * 3;
/* some nodes may lose all their vertices/faces. Normally we should delete those but since we don't
* support dynamic nodes yet, just return immediately to avoid opengl errors */
if (!tottri) {
if (buffers->index_buf)
glDeleteBuffersARB(1, &buffers->index_buf);
if (buffers->vert_buf)
glDeleteBuffersARB(1, &buffers->vert_buf);
buffers->vert_buf = 0;
buffers->index_buf = 0;
buffers->tot_tri = 0;
return;
}
@ -2529,7 +2521,7 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
offset += buffers->gridkey.grid_area * sizeof(VertexBufferFormat);
}
}
else {
else if (buffers->tot_tri) {
int totelem = buffers->tot_tri * 3;
glVertexPointer(3, GL_FLOAT, sizeof(VertexBufferFormat),