[Bf-blender-cvs] [2a01fb61f84] blender2.8: Cleanup: use safe free macro & comments

Campbell Barton noreply at git.blender.org
Wed Sep 13 17:16:42 CEST 2017


Commit: 2a01fb61f8402b31b9f85039e28acf310b1da332
Author: Campbell Barton
Date:   Thu Sep 14 01:23:18 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB2a01fb61f8402b31b9f85039e28acf310b1da332

Cleanup: use safe free macro & comments

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

M	source/blender/draw/intern/draw_manager.c

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

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);



More information about the Bf-blender-cvs mailing list