[Bf-blender-cvs] [8d63d7337ce] blender-v2.83-release: Fix unnecessary buffer reallocation in sculpt mode, causing an assert

Brecht Van Lommel noreply at git.blender.org
Tue May 19 23:41:57 CEST 2020


Commit: 8d63d7337cec3b2dea06b3a520af467d9fc3e66d
Author: Brecht Van Lommel
Date:   Tue May 19 21:27:10 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB8d63d7337cec3b2dea06b3a520af467d9fc3e66d

Fix unnecessary buffer reallocation in sculpt mode, causing an assert

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

Ref T76858

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

M	source/blender/gpu/intern/gpu_buffers.c

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

diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 5221cc09ad9..cef90d57ef5 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -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;



More information about the Bf-blender-cvs mailing list