Fix unnecessary buffer reallocation in sculpt mode, causing an assert

Probably did not cause an actual, the assert is a performance warning.

Ref T76858
This commit is contained in:
Brecht Van Lommel 2020-05-19 21:27:10 +02:00
parent 20c30534aa
commit 8d63d7337c
Notes: blender-bot 2023-09-08 04:55:43 +02:00
Referenced by issue #76858, Threading issue in sculpt mode
1 changed files with 4 additions and 1 deletions

View File

@ -151,7 +151,10 @@ static bool gpu_pbvh_vert_buf_data_set(GPU_PBVH_Buffers *buffers, uint vert_len)
/* Initialize vertex buffer (match 'VertexBufferFormat'). */
buffers->vert_buf = GPU_vertbuf_create_with_format_ex(&g_vbo_id.format, GPU_USAGE_STATIC);
}
GPU_vertbuf_data_alloc(buffers->vert_buf, vert_len);
if (buffers->vert_buf->data == NULL || buffers->vert_buf->vertex_len != vert_len) {
/* Allocate buffer if not allocated yet or size changed. */
GPU_vertbuf_data_alloc(buffers->vert_buf, vert_len);
}
#endif
return buffers->vert_buf->data != NULL;