[Bf-blender-cvs] [9d79ca24c9a] master: Fix Workbench Memory Leak

Jeroen Bakker noreply at git.blender.org
Wed Jun 26 15:16:31 CEST 2019


Commit: 9d79ca24c9a7582f0baf33ac0b8a50cc194bfb46
Author: Jeroen Bakker
Date:   Wed Jun 26 15:15:39 2019 +0200
Branches: master
https://developer.blender.org/rB9d79ca24c9a7582f0baf33ac0b8a50cc194bfb46

Fix Workbench Memory Leak

Memory leaks happened when using final multi view rendering together with workbench.
Workbench assumed that the textures were always NULL

Reviewers: fclem

Differential Revision: https://developer.blender.org/D5136

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

M	source/blender/draw/engines/workbench/workbench_render.c

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

diff --git a/source/blender/draw/engines/workbench/workbench_render.c b/source/blender/draw/engines/workbench/workbench_render.c
index 46d78ca0e37..b4e5e98c92b 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -82,8 +82,14 @@ static bool workbench_render_framebuffers_init(void)
   const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
 
   DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-  dtxl->color = GPU_texture_create_2d(size[0], size[1], GPU_RGBA16F, NULL, NULL);
-  dtxl->depth = GPU_texture_create_2d(size[0], size[1], GPU_DEPTH24_STENCIL8, NULL, NULL);
+
+  /* When doing a multi view rendering the first view will allocate the buffers
+   * the other views will reuse these buffers */
+  if (dtxl->color == NULL) {
+    BLI_assert(dtxl->depth == NULL);
+    dtxl->color = GPU_texture_create_2d(size[0], size[1], GPU_RGBA16F, NULL, NULL);
+    dtxl->depth = GPU_texture_create_2d(size[0], size[1], GPU_DEPTH24_STENCIL8, NULL, NULL);
+  }
 
   if (!(dtxl->depth && dtxl->color)) {
     return false;



More information about the Bf-blender-cvs mailing list