Fix assert and memleak in recent Skin Root Display patch

Caused by 4ddf3215a7
This commit is contained in:
Clément Foucault 2019-10-16 19:28:10 +02:00
parent 131ac2ec82
commit 7e78fbf2de
3 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 */