From 2a01fb61f8402b31b9f85039e28acf310b1da332 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Sep 2017 01:23:18 +1000 Subject: Cleanup: use safe free macro & comments --- source/blender/draw/intern/draw_manager.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index a50246bc3e5..573b03d895f 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -319,7 +319,7 @@ enum { STENCIL_ACTIVE = (1 << 1), }; -/* Render State */ +/** Render State: No persistent data between draw calls. */ static struct DRWGlobalState { /* Rendering state */ GPUShader *shader; @@ -359,7 +359,7 @@ static struct DRWGlobalState { double cache_time; } DST = {NULL}; -/* GPU Resource State */ +/** GPU Resource State: Memory storage between drawing. */ static struct DRWResourceState { GPUTexture **bound_texs; GPUUniformBuffer **bound_ubos; @@ -3666,14 +3666,8 @@ void DRW_engines_free(void) if (globals_ramp) GPU_texture_free(globals_ramp); - if (RST.bound_texs) { - MEM_freeN(RST.bound_texs); - RST.bound_texs = NULL; - } - if (RST.bound_ubos) { - MEM_freeN(RST.bound_ubos); - RST.bound_ubos = NULL; - } + MEM_SAFE_FREE(RST.bound_texs); + MEM_SAFE_FREE(RST.bound_ubos); #ifdef WITH_CLAY_ENGINE BLI_remlink(&R_engines, &DRW_engine_viewport_clay_type); -- cgit v1.2.3