Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-06-26 16:15:39 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-06-26 16:15:55 +0300
commit9d79ca24c9a7582f0baf33ac0b8a50cc194bfb46 (patch)
treeb887fc0ffc2ab66e4a91a72500594975f7e971c5
parent11dc736033244ae9eeaa94daea3c8d5598d07e76 (diff)
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
-rw-r--r--source/blender/draw/engines/workbench/workbench_render.c10
1 files changed, 8 insertions, 2 deletions
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;