[Bf-blender-cvs] [7e78fbf2ded] blender-v2.81-release: Fix assert and memleak in recent Skin Root Display patch

Clément Foucault noreply at git.blender.org
Wed Oct 16 20:17:52 CEST 2019


Commit: 7e78fbf2dedfd70f8c9971ee1412183abc5a9ca7
Author: Clément Foucault
Date:   Wed Oct 16 19:28:10 2019 +0200
Branches: blender-v2.81-release
https://developer.blender.org/rB7e78fbf2dedfd70f8c9971ee1412183abc5a9ca7

Fix assert and memleak in recent Skin Root Display patch

Caused by 4ddf3215a7df

===================================================================

M	source/blender/draw/intern/draw_cache_extract_mesh.c
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/gpu/intern/gpu_batch.c

===================================================================

diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 0479bdd4de7..fb439016a87 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -4354,6 +4354,7 @@ void mesh_buffer_cache_create_requested(MeshBatchCache *cache,
   TEST_ASSIGN(VBO, vbo, edge_idx);
   TEST_ASSIGN(VBO, vbo, vert_idx);
   TEST_ASSIGN(VBO, vbo, fdot_idx);
+  TEST_ASSIGN(VBO, vbo, skin_roots);
 
   TEST_ASSIGN(IBO, ibo, tris);
   TEST_ASSIGN(IBO, ibo, lines);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 49db8bd9765..ca185fa7d7d 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1328,7 +1328,7 @@ void DRW_mesh_batch_cache_create_requested(
   }
   if (DRW_batch_requested(cache->batch.edit_skin_roots, GPU_PRIM_LINES)) {
     DRW_vbo_request(cache->batch.edit_skin_roots, &mbufcache->vbo.skin_roots);
-    /* HACK(fclem): This is a workaround the deferred batch init
+    /* HACK(fclem): This is to workaround the deferred batch init
      * that prevent drawing using DRW_shgroup_call_instances_with_attribs.
      * So we instead create the whole instancing batch here.
      * Note that we use GPU_PRIM_LINES instead of expected GPU_PRIM_LINE_STRIP
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index fc578b4466c..168d741f92a 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -213,7 +213,9 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo)
     if (batch->verts[v] == NULL) {
 #if TRUST_NO_ONE
       /* for now all VertexBuffers must have same vertex_len */
-      assert(verts->vertex_len == batch->verts[0]->vertex_len);
+      if (batch->verts[0] != NULL) {
+        assert(verts->vertex_len == batch->verts[0]->vertex_len);
+      }
 #endif
       batch->verts[v] = verts;
       /* TODO: mark dirty so we can keep attribute bindings up-to-date */



More information about the Bf-blender-cvs mailing list